libt3widget
List of all members | Classes | Public Member Functions | Friends
t3_widget::menu_bar_t Class Reference

Class implementing a menu bar. More...

Inheritance diagram for t3_widget::menu_bar_t:
t3_widget::widget_t t3_widget::window_component_t t3_widget::mouse_target_t t3_widget::window_component_t

Public Member Functions

virtual bool accepts_focus (void)
 Query whether this widget accepts focus. More...
 
void add_menu (menu_panel_t *menu)
 Add a menu to the menu bar. More...
 
virtual void hide (void)
 Hide the window_component_t. More...
 
virtual bool is_hotkey (key_t key)
 Query whether key is a hotkey for this widget. More...
 
 menu_bar_t (bool _hidden=false)
 Create a new menu_bar_t. More...
 
virtual bool process_key (key_t key)
 Handle a key press by the user. More...
 
virtual bool process_mouse_event (mouse_event_t event)
 Process a mouse event. More...
 
void remove_menu (menu_panel_t *menu)
 Remove a menu from the menu bar. More...
 
virtual void set_focus (focus_t focus)
 Set whether this window_component_t has the input focus. More...
 
void set_hidden (bool _hidden)
 Set the "hidden" display property. More...
 
virtual bool set_size (optint height, optint width)
 Set the size of this window_component_t. More...
 
virtual void show (void)
 Display the window_component_t. More...
 
 T3_WIDGET_SIGNAL (activate, void, int)
 Signal emitted when a menu item is selected. More...
 
virtual void update_contents (void)
 Update the contents of the window. More...
 
virtual ~menu_bar_t (void)
 Destroy the menu_bar_t. More...
 
- Public Member Functions inherited from t3_widget::widget_t
virtual void force_redraw (void)
 Request that this window_component_t be completely redrawn. More...
 
virtual bool is_enabled (void)
 Query the enabled status of this widget. More...
 
virtual bool is_shown (void)
 Query the visibility status of this widget. More...
 
virtual void set_anchor (window_component_t *anchor, int relation)
 Set this widget's anchor. More...
 
virtual void set_enabled (bool enable)
 Set the enabled status of this widget. More...
 
virtual void set_position (optint top, optint left)
 Move the window_component_t to a specified position. More...
 
- Public Member Functions inherited from t3_widget::window_component_t
virtual t3_window_t * get_base_window (void)
 Retrieve the t3_window_t for this window_component_t. More...
 
 window_component_t (void)
 Base constructor. More...
 
virtual ~window_component_t (void)
 Base destructor. More...
 
- Public Member Functions inherited from t3_widget::mouse_target_t
void grab_mouse (void)
 Grab all future mouse events. More...
 
void register_mouse_target (t3_window_t *target)
 Register a window to receive mouse events. More...
 
void release_mouse_grab (void)
 Release a previous mouse grab. More...
 
void unregister_mouse_target (t3_window_t *target)
 Unregister a window to receive mouse events. More...
 

Friends

class menu_panel_t
 

Additional Inherited Members

- Public Types inherited from t3_widget::window_component_t
enum  focus_t {
  FOCUS_OUT, FOCUS_SET, FOCUS_IN_FWD, FOCUS_IN_BCK,
  FOCUS_REVERT
}
 
- Static Public Member Functions inherited from t3_widget::mouse_target_t
static bool handle_mouse_event (mouse_event_t event)
 
- Protected Member Functions inherited from t3_widget::widget_t
void init_unbacked_window (int height, int width, bool register_as_mouse_target=false)
 Initialize the window with an unbacked t3_window_t with height and width. More...
 
void init_window (int height, int width, bool register_as_mouse_target=true)
 Initialize the window with a t3_window_t with height and width. More...
 
 widget_t (int height, int width, bool register_as_mouse_target=true)
 Constructor which creates a default t3_window_t with height and width. More...
 
 widget_t (void)
 Constructor which does not create a default t3_window_t. More...
 
- Protected Member Functions inherited from t3_widget::mouse_target_t
 mouse_target_t (bool use_window=true)
 
- Protected Attributes inherited from t3_widget::widget_t
bool enabled
 Widget is enabled. More...
 
bool redraw
 Widget requires redrawing on next update_contents call. More...
 
bool shown
 Widget is shown. More...
 
- Protected Attributes inherited from t3_widget::window_component_t
cleanup_t3_window_ptr window
 The t3_window_t used for presenting this item on screen (see libt3window). More...
 

Detailed Description

Class implementing a menu bar.

Constructor & Destructor Documentation

t3_widget::menu_bar_t::menu_bar_t ( bool  _hidden = false)

Create a new menu_bar_t.

Parameters
_hiddenBoolean indicating whether this menu_bar_t has "hidden" display type.

A menu_bar_t can either be displayed continuously, or it can be hidden while none of its menus are active. The latter option should only be used when the user specifically asks for it, otherwise the user may not even be aware of the menu bar's existance.

t3_widget::menu_bar_t::~menu_bar_t ( void  )
virtual

Destroy the menu_bar_t.

Note that this does destroys the menus contained by this menu_bar_t.

Member Function Documentation

bool t3_widget::menu_bar_t::accepts_focus ( void  )
virtual

Query whether this widget accepts focus.

Reimplemented from t3_widget::widget_t.

void t3_widget::menu_bar_t::add_menu ( menu_panel_t menu)

Add a menu to the menu bar.

Note that this will be called automatically if the menu_bar_t is passed to the menu_panel_t constructor.

void t3_widget::menu_bar_t::hide ( void  )
virtual

Hide the window_component_t.

Reimplemented from t3_widget::widget_t.

bool t3_widget::menu_bar_t::is_hotkey ( key_t  key)
virtual

Query whether key is a hotkey for this widget.

Reimplemented from t3_widget::widget_t.

bool t3_widget::menu_bar_t::process_key ( key_t  key)
virtual

Handle a key press by the user.

Returns
A boolean indicating whether this window_component_t handled the key press.

Implements t3_widget::window_component_t.

bool t3_widget::menu_bar_t::process_mouse_event ( mouse_event_t  event)
virtual

Process a mouse event.

Returns
A boolean indicating whether this mouse_target_t handled the mouse event.

Reimplemented from t3_widget::widget_t.

void t3_widget::menu_bar_t::remove_menu ( menu_panel_t menu)

Remove a menu from the menu bar.

This does not destroy the menu.

void t3_widget::menu_bar_t::set_focus ( focus_t  focus)
virtual

Set whether this window_component_t has the input focus.

Note that this merely notifies the window_component_t that it should change it's appearance to indicate the user that this window_component_t has the input focus. Which window_component_t actually receives the input events is handled outside of the window_component_t.

Reimplemented from t3_widget::widget_t.

void t3_widget::menu_bar_t::set_hidden ( bool  _hidden)

Set the "hidden" display property.

See #memu_bar_t for details.

bool t3_widget::menu_bar_t::set_size ( optint  height,
optint  width 
)
virtual

Set the size of this window_component_t.

Parameters
heightThe new height of the window_component_t in cells, or None if it should remain unchanged.
widthThe new width of the window_component_t in cells, or None if it should remain unchanged.
Returns
A boolean indicating whether all allocations required for the resize operation succeeded.

Implements t3_widget::window_component_t.

void t3_widget::menu_bar_t::show ( void  )
virtual

Display the window_component_t.

Reimplemented from t3_widget::widget_t.

t3_widget::menu_bar_t::T3_WIDGET_SIGNAL ( activate  ,
void  ,
int   
)

Signal emitted when a menu item is selected.

The integer passed as the first argument is determined when creating the menu item through menu_panel_t::add_item.

void t3_widget::menu_bar_t::update_contents ( void  )
virtual

Update the contents of the window.

Implements t3_widget::window_component_t.