594 Window *AllocateWindowDesc(const WindowDesc *desc); |
595 Window *AllocateWindowDesc(const WindowDesc *desc); |
595 Window *AllocateWindowDescFront(const WindowDesc *desc, int window_number); |
596 Window *AllocateWindowDescFront(const WindowDesc *desc, int window_number); |
596 |
597 |
597 void DrawWindowViewport(Window *w); |
598 void DrawWindowViewport(Window *w); |
598 |
599 |
|
600 /** |
|
601 * Sets the enabled/disabled status of a widget. |
|
602 * By default, widgets are enabled. |
|
603 * On certain conditions, they have to be disabled. |
|
604 * @param w : Window on which the widget is located |
|
605 * @param widget_index : index of this widget in the window |
|
606 * @param disab_stat : status to use ie: disabled = true, enabled = false |
|
607 */ |
|
608 static inline void SetWindowWidgetDisabledState(Window *w, byte widget_index, bool disab_stat) |
|
609 { |
|
610 SB(w->disabled_state, widget_index, 1, !!disab_stat); |
|
611 } |
|
612 |
|
613 /** |
|
614 * Sets a widget to disabled. |
|
615 * @param w : Window on which the widget is located |
|
616 * @param widget_index : index of this widget in the window |
|
617 */ |
|
618 static inline void DisableWindowWidget(Window *w, byte widget_index) |
|
619 { |
|
620 SetWindowWidgetDisabledState(w, widget_index, true); |
|
621 } |
|
622 |
|
623 /** |
|
624 * Sets a widget to Enabled. |
|
625 * @param w : Window on which the widget is located |
|
626 * @param widget_index : index of this widget in the window |
|
627 */ |
|
628 static inline void EnableWindowWidget(Window *w, byte widget_index) |
|
629 { |
|
630 SetWindowWidgetDisabledState(w, widget_index, false); |
|
631 } |
|
632 |
|
633 /** |
|
634 * Gets the enabled/disabled status of a widget. |
|
635 * @param w : Window on which the widget is located |
|
636 * @param widget_index : index of this widget in the window |
|
637 * @return status of the widget ie: disabled = true, enabled = false |
|
638 */ |
|
639 static inline bool IsWindowWidgetDisabled(Window *w, byte widget_index) |
|
640 { |
|
641 return HASBIT(w->disabled_state, widget_index); |
|
642 } |
|
643 |
|
644 /** |
|
645 * Sets the hidden/shown status of a widget. |
|
646 * By default, widgets are visible. |
|
647 * On certain conditions, they have to be hidden. |
|
648 * @param w Window on which the widget is located |
|
649 * @param widget_index index of this widget in the window |
|
650 * @param hidden_stat status to use ie. hidden = true, visible = false |
|
651 */ |
|
652 static inline void SetWindowWidgetHiddenState(Window *w, byte widget_index, bool hidden_stat) |
|
653 { |
|
654 SB(w->hidden_state, widget_index, 1, !!hidden_stat); |
|
655 } |
|
656 |
|
657 /** |
|
658 * Sets a widget hidden. |
|
659 * @param w : Window on which the widget is located |
|
660 * @param widget_index : index of this widget in the window |
|
661 */ |
|
662 static inline void HideWindowWidget(Window *w, byte widget_index) |
|
663 { |
|
664 SetWindowWidgetHiddenState(w, widget_index, true); |
|
665 } |
|
666 |
|
667 /** |
|
668 * Sets a widget visible. |
|
669 * @param w : Window on which the widget is located |
|
670 * @param widget_index : index of this widget in the window |
|
671 */ |
|
672 static inline void ShowWindowWidget(Window *w, byte widget_index) |
|
673 { |
|
674 SetWindowWidgetHiddenState(w, widget_index, false); |
|
675 } |
|
676 |
|
677 /** |
|
678 * Gets the visibility of a widget. |
|
679 * @param w : Window on which the widget is located |
|
680 * @param widget_index : index of this widget in the window |
|
681 * @return status of the widget ie: hidden = true, visible = false |
|
682 */ |
|
683 static inline bool IsWindowWidgetHidden(Window *w, byte widget_index) |
|
684 { |
|
685 return HASBIT(w->hidden_state, widget_index); |
|
686 } |
|
687 |
|
688 /** |
|
689 * Sets the lowered/raised status of a widget. |
|
690 * @param w : Window on which the widget is located |
|
691 * @param widget_index : index of this widget in the window |
|
692 * @param hidden_stat : status to use ie: lowered = true, raised = false |
|
693 */ |
|
694 static inline void SetWidgetLoweredState(Window *w, byte widget_index, bool lowered_stat) |
|
695 { |
|
696 SB(w->click_state, widget_index, 1, !!lowered_stat); |
|
697 } |
|
698 |
|
699 /** |
|
700 * Invert the lowered/raised status of a widget. |
|
701 * @param w : Window on which the widget is located |
|
702 * @param widget_index : index of this widget in the window |
|
703 */ |
|
704 static inline void ToggleWidgetLoweredState(Window *w, byte widget_index) |
|
705 { |
|
706 TOGGLEBIT(w->click_state, widget_index); |
|
707 } |
|
708 |
|
709 /** |
|
710 * Marks a widget as lowered. |
|
711 * @param w : Window on which the widget is located |
|
712 * @param widget_index : index of this widget in the window |
|
713 */ |
|
714 static inline void LowerWindowWidget(Window *w, byte widget_index) |
|
715 { |
|
716 SetWidgetLoweredState(w, widget_index, true); |
|
717 } |
|
718 |
|
719 /** |
|
720 * Marks a widget as raised. |
|
721 * @param w : Window on which the widget is located |
|
722 * @param widget_index : index of this widget in the window |
|
723 */ |
|
724 static inline void RaiseWindowWidget(Window *w, byte widget_index) |
|
725 { |
|
726 SetWidgetLoweredState(w, widget_index, false); |
|
727 } |
|
728 |
|
729 /** |
|
730 * Gets the lowered state 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 * @return status of the widget ie: lowered = true, raised= false |
|
734 */ |
|
735 static inline bool IsWindowWidgetLowered(Window *w, byte widget_index) |
|
736 { |
|
737 return HASBIT(w->click_state, widget_index); |
|
738 } |
|
739 |
599 void InitWindowSystem(void); |
740 void InitWindowSystem(void); |
600 void UnInitWindowSystem(void); |
741 void UnInitWindowSystem(void); |
601 void ResetWindowSystem(void); |
742 void ResetWindowSystem(void); |
602 int GetMenuItemIndex(const Window *w, int x, int y); |
743 int GetMenuItemIndex(const Window *w, int x, int y); |
603 void InputLoop(void); |
744 void InputLoop(void); |