620 Window *AllocateWindowDescFront(const WindowDesc *desc, int window_number, void *data = NULL); |
620 Window *AllocateWindowDescFront(const WindowDesc *desc, int window_number, void *data = NULL); |
621 |
621 |
622 void DrawWindowViewport(const Window *w); |
622 void DrawWindowViewport(const Window *w); |
623 void ResizeWindow(Window *w, int x, int y); |
623 void ResizeWindow(Window *w, int x, int y); |
624 |
624 |
625 /** |
|
626 * Sets the enabled/disabled status of a widget. |
|
627 * By default, widgets are enabled. |
|
628 * On certain conditions, they have to be disabled. |
|
629 * @param w : Window on which the widget is located |
|
630 * @param widget_index : index of this widget in the window |
|
631 * @param disab_stat : status to use ie: disabled = true, enabled = false |
|
632 */ |
|
633 static inline void SetWindowWidgetDisabledState(Window *w, byte widget_index, bool disab_stat) |
|
634 { |
|
635 assert(widget_index < w->widget_count); |
|
636 SB(w->widget[widget_index].display_flags, WIDG_DISABLED, 1, !!disab_stat); |
|
637 } |
|
638 |
|
639 /** |
|
640 * Sets a widget to disabled. |
|
641 * @param w : Window on which the widget is located |
|
642 * @param widget_index : index of this widget in the window |
|
643 */ |
|
644 static inline void DisableWindowWidget(Window *w, byte widget_index) |
|
645 { |
|
646 SetWindowWidgetDisabledState(w, widget_index, true); |
|
647 } |
|
648 |
|
649 /** |
|
650 * Sets a widget to Enabled. |
|
651 * @param w : Window on which the widget is located |
|
652 * @param widget_index : index of this widget in the window |
|
653 */ |
|
654 static inline void EnableWindowWidget(Window *w, byte widget_index) |
|
655 { |
|
656 SetWindowWidgetDisabledState(w, widget_index, false); |
|
657 } |
|
658 |
|
659 /** |
|
660 * Gets the enabled/disabled status of a widget. |
|
661 * @param w : Window on which the widget is located |
|
662 * @param widget_index : index of this widget in the window |
|
663 * @return status of the widget ie: disabled = true, enabled = false |
|
664 */ |
|
665 static inline bool IsWindowWidgetDisabled(const Window *w, byte widget_index) |
|
666 { |
|
667 assert(widget_index < w->widget_count); |
|
668 return HasBit(w->widget[widget_index].display_flags, WIDG_DISABLED); |
|
669 } |
|
670 |
|
671 /** |
|
672 * Sets the hidden/shown status of a widget. |
|
673 * By default, widgets are visible. |
|
674 * On certain conditions, they have to be hidden. |
|
675 * @param w Window on which the widget is located |
|
676 * @param widget_index index of this widget in the window |
|
677 * @param hidden_stat status to use ie. hidden = true, visible = false |
|
678 */ |
|
679 static inline void SetWindowWidgetHiddenState(Window *w, byte widget_index, bool hidden_stat) |
|
680 { |
|
681 assert(widget_index < w->widget_count); |
|
682 SB(w->widget[widget_index].display_flags, WIDG_HIDDEN, 1, !!hidden_stat); |
|
683 } |
|
684 |
|
685 /** |
|
686 * Sets a widget hidden. |
|
687 * @param w : Window on which the widget is located |
|
688 * @param widget_index : index of this widget in the window |
|
689 */ |
|
690 static inline void HideWindowWidget(Window *w, byte widget_index) |
|
691 { |
|
692 SetWindowWidgetHiddenState(w, widget_index, true); |
|
693 } |
|
694 |
|
695 /** |
|
696 * Sets a widget visible. |
|
697 * @param w : Window on which the widget is located |
|
698 * @param widget_index : index of this widget in the window |
|
699 */ |
|
700 static inline void ShowWindowWidget(Window *w, byte widget_index) |
|
701 { |
|
702 SetWindowWidgetHiddenState(w, widget_index, false); |
|
703 } |
|
704 |
|
705 /** |
|
706 * Gets the visibility of a widget. |
|
707 * @param w : Window on which the widget is located |
|
708 * @param widget_index : index of this widget in the window |
|
709 * @return status of the widget ie: hidden = true, visible = false |
|
710 */ |
|
711 static inline bool IsWindowWidgetHidden(const Window *w, byte widget_index) |
|
712 { |
|
713 assert(widget_index < w->widget_count); |
|
714 return HasBit(w->widget[widget_index].display_flags, WIDG_HIDDEN); |
|
715 } |
|
716 |
|
717 /** |
|
718 * Sets the lowered/raised status of a widget. |
|
719 * @param w : Window on which the widget is located |
|
720 * @param widget_index : index of this widget in the window |
|
721 * @param lowered_stat : status to use ie: lowered = true, raised = false |
|
722 */ |
|
723 static inline void SetWindowWidgetLoweredState(Window *w, byte widget_index, bool lowered_stat) |
|
724 { |
|
725 assert(widget_index < w->widget_count); |
|
726 SB(w->widget[widget_index].display_flags, WIDG_LOWERED, 1, !!lowered_stat); |
|
727 } |
|
728 |
|
729 /** |
|
730 * Invert the lowered/raised status of a widget. |
|
731 * @param w : Window on which the widget is located |
|
732 * @param widget_index : index of this widget in the window |
|
733 */ |
|
734 static inline void ToggleWidgetLoweredState(Window *w, byte widget_index) |
|
735 { |
|
736 assert(widget_index < w->widget_count); |
|
737 ToggleBit(w->widget[widget_index].display_flags, WIDG_LOWERED); |
|
738 } |
|
739 |
|
740 /** |
|
741 * Marks a widget as lowered. |
|
742 * @param w : Window on which the widget is located |
|
743 * @param widget_index : index of this widget in the window |
|
744 */ |
|
745 static inline void LowerWindowWidget(Window *w, byte widget_index) |
|
746 { |
|
747 SetWindowWidgetLoweredState(w, widget_index, true); |
|
748 } |
|
749 |
|
750 /** |
|
751 * Marks a widget as raised. |
|
752 * @param w : Window on which the widget is located |
|
753 * @param widget_index : index of this widget in the window |
|
754 */ |
|
755 static inline void RaiseWindowWidget(Window *w, byte widget_index) |
|
756 { |
|
757 SetWindowWidgetLoweredState(w, widget_index, false); |
|
758 } |
|
759 |
|
760 /** |
|
761 * Gets the lowered state of a widget. |
|
762 * @param w : Window on which the widget is located |
|
763 * @param widget_index : index of this widget in the window |
|
764 * @return status of the widget ie: lowered = true, raised= false |
|
765 */ |
|
766 static inline bool IsWindowWidgetLowered(const Window *w, byte widget_index) |
|
767 { |
|
768 assert(widget_index < w->widget_count); |
|
769 return HasBit(w->widget[widget_index].display_flags, WIDG_LOWERED); |
|
770 } |
|
771 |
|
772 void InitWindowSystem(); |
625 void InitWindowSystem(); |
773 void UnInitWindowSystem(); |
626 void UnInitWindowSystem(); |
774 void ResetWindowSystem(); |
627 void ResetWindowSystem(); |
775 int GetMenuItemIndex(const Window *w, int x, int y); |
628 int GetMenuItemIndex(const Window *w, int x, int y); |
776 void InputLoop(); |
629 void InputLoop(); |
777 void InvalidateWidget(const Window *w, byte widget_index); |
|
778 void InvalidateThisWindowData(Window *w); |
630 void InvalidateThisWindowData(Window *w); |
779 void InvalidateWindowData(WindowClass cls, WindowNumber number); |
631 void InvalidateWindowData(WindowClass cls, WindowNumber number); |
780 void RaiseWindowButtons(Window *w); |
632 void RaiseWindowButtons(Window *w); |
781 void RelocateAllWindows(int neww, int newh); |
633 void RelocateAllWindows(int neww, int newh); |
782 int PositionMainToolbar(Window *w); |
634 int PositionMainToolbar(Window *w); |
783 void CDECL SetWindowWidgetsDisabledState(Window *w, bool disab_stat, int widgets, ...); |
|
784 void CDECL SetWindowWidgetsHiddenState(Window *w, bool hidden_stat, int widgets, ...); |
|
785 void CDECL SetWindowWidgetsLoweredState(Window *w, bool lowered_stat, int widgets, ...); |
|
786 |
635 |
787 /* misc_gui.cpp */ |
636 /* misc_gui.cpp */ |
788 void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[]); |
637 void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[]); |
789 static inline void GuiShowTooltips(StringID str) |
638 static inline void GuiShowTooltips(StringID str) |
790 { |
639 { |