Module
Lmenu_object
Home
In: locana/l_menu.rb

Since any object can be added to a menu, this module is automatically applied to all objects added to menus. It applies color and font consistent with the Lmenu class, if fact, the Lmenu class includes this module. It also provides several methods needed by menus.

Methods

box_pos, can_have_focus?, default_bg, default_fg, deselect_menu, ipadx, ipady, next_focus, on_alt_key, on_down_key, on_enter, on_enter_key, on_escape_key, on_exit, on_key_press, on_left_key, on_mouse_ldbl, on_mouse_ldn, on_mouse_lup, on_mouse_out, on_mouse_over, on_right_key, on_up_key, paint_focus, paint_focus?, paint_focus_remove, prev_focus, select_menu, set_focus, skip_object_theme, sticky, sub_menu, toggle_highlight,
Public Instance methods
default_fg() src

Returns :sys_menu_fg because menu objects don’t inherit color from parent objects.

default_bg() src

Returns :sys_menu_bg because menus don’t inherit color from parent objects.

skip_object_theme() src

Returns true because objects placed inside menus don’t pull from the :object portion of the any theme.

box_pos() src

When adding radiobox and checkbox objects to a menu, the default position of the checkbox is to the right. Returns :right if the :box_pos attribute has not been specified for the object.

ipadx() src

Adds a little padding so the items in menus don’t hug the left and right borders. The default is 6.

ipady() src

Adds a little padding so the items in menus don’t hug the top and bottom borders. The default is 1.

select_menu(lshow=nil) src

Calls toggle_highlight to select or change the colors on the this item so it appears highlighted. Any other selected menu item sibling is automatically unselected first.

deselect_menu() src

This deselects or un-highlights the item. It calls toggle_highlight to remove the highlighted colors.

toggle_highlight(new_value=nil) src

Calls toggle_highlight_color because highlighting for menu items is done by toggling the color between the highlighted colors (fg_highlight and bg_highlight) and normal colors (fg and bg). This makes sure that highlighting is consistent for all objects in the menu.

can_have_focus?() src

Returns false because menu items don’t get the keyboard focus in the same was as other Locana objects. The focus is managed internally by this module rather than letting Locana manage the focus as with other Locana objects.

paint_focus?() src

Returns false to disable the normal focus Locana objects places in a menu. The focus indicator is handled by toggle_highlight which calls toggle_highlight_color.

paint_focus() src

Items in a menu don’t paint a focus because the focus indicator is handled by toggle_highlight which calls toggle_highlight_color. This does nothing.

paint_focus_remove() src

Items in a menu don’t paint a focus because the focus indicator is handled by toggle_highlight which calls toggle_highlight_color. This does nothing.

set_focus() src

If this object is a popup style menu, the focus is forwarded to the first child in the popup menu, otherwise this objects gets the focus.

next_focus() src

Disabled when this object is in a menu. Managing the focus for objects in menus are handled differently from other Locana objects.

prev_focus() src

Disabled when this object is in a menu. Managing the focus for objects in menus are handled differently from other Locana objects.

on_enter(levent=nil, &block) src

Ignore this event.

on_exit(levent=nil, &block) src

Ignore this event.

on_mouse_ldbl(levent=nil, &block) src

Triggers the on_mouse_ldn so multiple clicks don’t appear to get lost.

on_mouse_ldn(levent=nil, &block) src

Triggers the on_click event and skips the normal on_mouse_ldn event.

on_mouse_lup(levent=nil, &block) src

Skips the normal on_mouse_lup event.

on_mouse_out(levent=nil, &block) src

Deselects or un-highlights the menu.

on_mouse_over(levent=nil, &block) src

Selects or highlights the menu.

on_alt_key(levent=nil, &block) src

Closes any open menus and exits the menubar. The normal on_alt_key event for objects not in a menu will activate a menubar. Basically, the on_alt_key toggles between activating the menubar and deactivating the menubar.

on_escape_key(levent=nil, &block) src

Closes any open menus and exit the menubar.

on_left_key(levent=nil, &block) src

The following steps are taken depending on the circumstances:

on_right_key(levent=nil, &block) src

The following steps are taken depending on the circumstances:

on_up_key(levent=nil, &block) src

The following steps are taken depending on the circumstances:

on_down_key(levent=nil, &block) src

The following steps are taken depending on the circumstances:

on_enter_key(levent=nil, &block) src

If object has a sub-menu then the sub-menu is activated or selected. Otherwise triggers the on_click event.

on_key_press(levent=nil, &block) src

Checks for an accelerator in the parent menu. If an accelerator is found, the menu with the accelerator is selected or activated.

sub_menu() src

Returns the sub-menu if one exists.

sticky() src

If this object has an explicit :sticky attribute defined, it is returned. Otherwise, returns :new when this object is in a popup style menu.


Seva Software


Thank you for taking the time to visit this web page. I trust you found the information contained in this page useful.
Please email any questions, concerns, or issues with this web site to webmaster@sevasoftware.com.
Please remember Seva Software when your company would benefit from an experienced database architect and software engineer.

http://www.arunadb.org http://www.locana.org http://www.ruby-lang.org http://www.coolwell.org http://www.sevasoftware.com