nobody at rubyforge.org
2006-Nov-04 10:21 UTC
[Wxruby-development] [720] trunk/wxruby2/doc/textile/menu.txtl: Update, rubyify and tidy
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:'':'';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[720] trunk/wxruby2/doc/textile/menu.txtl: Update, rubyify and tidy</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>720</dd> <dt>Author</dt> <dd>brokentoy</dd> <dt>Date</dt> <dd>2006-11-04 05:21:28 -0500 (Sat, 04 Nov 2006)</dd> </dl> <h3>Log Message</h3> <pre>Update, rubyify and tidy</pre> <h3>Modified Paths</h3> <ul> <li><a href="#trunkwxruby2doctextilemenutxtl">trunk/wxruby2/doc/textile/menu.txtl</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="trunkwxruby2doctextilemenutxtl"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/doc/textile/menu.txtl (719 => 720)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/doc/textile/menu.txtl        2006-11-01 01:37:15 UTC (rev 719) +++ trunk/wxruby2/doc/textile/menu.txtl        2006-11-04 10:21:28 UTC (rev 720) </span><span class="lines">@@ -1,30 +1,36 @@ </span><span class="cx"> h1(#wxmenu). Wx::Menu </span><span class="cx"> </span><del>-A menu is a popup (or pull down) list of items, one of which may be -selected before the menu goes away (clicking elsewhere dismisses the -menu). Menus may be used to construct either menu bars or popup menus. </del><ins>+A menu is a pull-down or pop-up list of items. The Wx::Menu class may be +used to construct either menu bars (associated with a "Frame":frame.html +via its "Menubar":menubar.html ) or popup menus. Items are represented +as text, and some platforms, they may also have icons. One item is +selected by clicking on it, or by using a shortcut, to start an +application action. Clicking elsewhere dismisses the menu. </ins><span class="cx"> </span><del>-A menu item has an integer ID associated with it which can be used to -identify the selection, or to change the menu item in some way. A menu item -with a special identifier $-1$ is a separator item and doesn''t have an -associated command but just makes a separator line appear in the menu. </del><ins>+A menu item has an integer ID associated with it is used to identify it +when it is clicked, and to access and change the menu item after it has +been created. A menu item with a special identifier @-1@ is a separator. +Separators don''t have an associated command but just make a separator line +appear in the menu. </ins><span class="cx"> </span><del>-*NB:* Please note that _ID_ABOUT_ and _ID_EXIT_ are -predefined by Widgets and have a special meaning since entries </del><ins>+*NB:* Please note that @ID_ABOUT@ and @ID_EXIT@ are +predefined by Widgets and have a special meaning. Entries </ins><span class="cx"> using these IDs will be taken out of the normal menus under MacOS X </span><span class="cx"> and will be inserted into the system menu (following the appropriate </span><del>-MacOS X interface guideline). On PalmOS _ID_EXIT_ is disabled according </del><ins>+MacOS X interface guideline). On PalmOS @ID_EXIT@ is disabled according </ins><span class="cx"> to Palm OS Companion guidelines. </span><span class="cx"> </span><del>-Menu items may be either normal items, check items or radio items. Normal items -don''t have any special properties while the check items have a boolean flag -associated to them and they show a checkmark in the menu when the flag is set. -Widgets automatically toggles the flag value when the item is clicked and its -value may be retrieved using either "is_checked":#Menu_ischecked method -of Menu or MenuBar itself or by using -"Event#is_checked":event.html#Event_ischecked when you get the menu -notification for the item in question. </del><ins>+h2. Types of menu item </ins><span class="cx"> </span><ins>+Menu items may be either normal items, check items or radio +items. Normal items don''t have any special properties. Check items have +a boolean flag associated to them and they show a checkmark in the menu +when the flag is set. Widgets automatically toggles the flag value when +the item is clicked and its value may be retrieved using either +"is_checked":#Menu_ischecked method of Menu or MenuBar itself or by +using "Event#is_checked":event.html#Event_ischecked when you get the +menu notification for the item in question. + </ins><span class="cx"> The radio items are similar to the check items except that all the other items </span><span class="cx"> in the same radio group are unchecked when a radio item is checked. The radio </span><span class="cx"> group is formed by a contiguous range of radio items, i.e. it starts at the </span><span class="lines">@@ -34,12 +40,12 @@ </span><span class="cx"> the radio items risks to not work correctly. Finally note that radio items </span><span class="cx"> are not supported under Motif. </span><span class="cx"> </span><del>-h2. Allocation strategy </del><ins>+h2. Deletion of menus </ins><span class="cx"> </span><del>-All menus except the popup ones must be created on the heap. All menus -attached to a menubar or to another menu will be deleted by their parent when -it is deleted. As the frame menubar is deleted by the frame itself, it means -that normally all menus used are deleted automatically. </del><ins>+All menus attached to a menubar or to another menu will be deleted by +their parent when it is deleted. As the frame menubar is deleted by the +frame itself, it means that normally all menus used are deleted +automatically. </ins><span class="cx"> </span><span class="cx"> h2. Derived from </span><span class="cx"> </span><span class="lines">@@ -49,22 +55,21 @@ </span><span class="cx"> </span><span class="cx"> h2. Event handling </span><span class="cx"> </span><del>-If the menu is part of a menubar, then "MenuBar":menubar.html event processing is used. </del><ins>+If the menu is part of a menubar, then "MenuBar":menubar.html event +processing is used, using @evt_menu@. </ins><span class="cx"> </span><del>-With a popup menu, there is a variety of ways to handle a menu selection event -(EVT_COMMAND_MENU_SELECTED). </del><ins>+To handle a popup menu, handle a menu selection event +(EVT_COMMAND_MENU_SELECTED). Provide @evt_menu@ handlers in the window +which pops up the menu, or in an ancestor ofthis window. </ins><span class="cx"> </span><ins>+h2. Example </ins><span class="cx"> </span><del>-# Derive a new class from Menu and define event table entries using the EVT_MENU macro. -# Set a new event handler for Menu, using an object whose class has EVT_MENU entries. -# Provide EVT_MENU handlers in the window which pops up the menu, or in an ancestor of -this window. -# Define a callback of type Function, which you pass to the Menu constructor. -The callback takes a reference to the menu, and a reference to a -"CommandEvent":commandevent.html. This method is deprecated and should -not be used in the new code, it is provided for backwards compatibility only. </del><ins>+ file_menu = Wx::Menu.new + # add a menu item with arbitrary ID 2001 + file_menu.append(2001, ''&Open file'') + # handle this menu item event + evt_menu(2001) { | evt | on_open_file(evt) } </ins><span class="cx"> </span><del>- </del><span class="cx"> h2. See also </span><span class="cx"> </span><span class="cx"> "MenuBar":menubar.html, "Window#popup_menu":window.html#Window_popupmenu, "Event handling overview":eventhandlingoverview.html, "FileHistory (most recently used files menu)":filehistory.html </span><span class="lines">@@ -77,6 +82,8 @@ </span><span class="cx"> </span><span class="cx"> * "Menu.new":#Menu_new </span><span class="cx"> * "Menu#append":#Menu_append </span><ins>+* "Menu#append_item":#Menu_appenditem +* "Menu#append_menu":#Menu_appendmenu </ins><span class="cx"> * "Menu#append_check_item":#Menu_appendcheckitem </span><span class="cx"> * "Menu#append_radio_item":#Menu_appendradioitem </span><span class="cx"> * "Menu#append_separator":#Menu_appendseparator </span><span class="lines">@@ -122,25 +129,6 @@ </span><span class="cx"> * _title_ A title for the popup menu: the empty string denotes no title. </span><span class="cx"> * _style_ If set to @MENU_TEAROFF@, the menu will be detachable (GTK only). </span><span class="cx"> </span><del>- *Menu.new*(%(arg-type)Integer% style) - -Constructs a Menu object. - -h4. Parameters - -* _style_ If set to @MENU_TEAROFF@, the menu will be detachable (GTK only). - - *destructor*() - -Destructor, destroying the menu. - -Note: under Motif, a popup menu must have a valid parent (the window -it was last popped up on) when being destroyed. Therefore, make sure -you delete or re-use the popup menu _before_ destroying the -parent window. Re-use in this context means popping up the menu on -a different window from last time, which causes an implicit destruction -and recreation of internal data structures. - </del><span class="cx"> h3(#Menu_append). Menu#append </span><span class="cx"> </span><span class="cx"> "MenuItem":menuitem.html *append*(%(arg-type)Integer% id, %(arg-type)String% item, </span><span class="lines">@@ -149,33 +137,36 @@ </span><span class="cx"> </span><span class="cx"> Adds a string item to the end of the menu. </span><span class="cx"> </span><del>- "MenuItem":menuitem.html *append*(%(arg-type)Integer% id, %(arg-type)String% item, - %(arg-type)Menu% subMenu, - %(arg-type)String% helpString = "") </del><ins>+h3(#Menu_appenditem). Menu#append_item </ins><span class="cx"> </span><del>-Adds a pull-right submenu to the end of the menu. Append the submenu to the parent -menu _after_ you have added your menu items, or accelerators may not be -registered properly. </del><ins>+ "MenuItem":menuitem.html *append_item*(%(arg-type)MenuItem% menuItem) </ins><span class="cx"> </span><del>- "MenuItem":menuitem.html *append*(%(arg-type)MenuItem% menuItem) </del><ins>+Adds a "MenuItem":menuitem.html object. This is the most generic variant +of Append() method because it may be used for both items (including +separators) and submenus and because you can also specify various extra +properties of a menu item this way, such as bitmaps and fonts. </ins><span class="cx"> </span><del>-Adds a menu item object. This is the most generic variant of Append() method -because it may be used for both items (including separators) and submenus and -because you can also specify various extra properties of a menu item this way, -such as bitmaps and fonts. </del><ins>+h3(#Menu_appendmenu). Menu#append_menu </ins><span class="cx"> </span><ins>+ "MenuItem":menuitem.html *append_menu*(%(arg-type)Integer% id, %(arg-type)String% item, + %(arg-type)Menu% subMenu, + %(arg-type)String% helpString = "") + +Adds a pull-right submenu to the end of the menu. Append the submenu to +the parent menu _after_ you have added your menu items, or accelerators +may not be registered properly. + </ins><span class="cx"> h4. Parameters </span><span class="cx"> </span><span class="cx"> * _id_ The menu command identifier. </span><span class="cx"> * _item_ The string to appear on the menu item. </span><span class="cx"> * _menu_ Pull-right submenu. </span><del>-* _kind_ May be @ITEM_SEPARATOR@, @ITEM_NORMAL@, -@ITEM_CHECK@ or @ITEM_RADIO@ -* _helpString_ An optional help string associated with the item. -By default, the handler for the EVT_MENU_HIGHLIGHT event displays -this string in the status line. -* _menuItem_ A menuitem object. It will be owned by the Menu object after this function -is called, so do not delete it yourself. </del><ins>+* _kind_ May be @ITEM_SEPARATOR@, @ITEM_NORMAL@, @ITEM_CHECK@ or @ITEM_RADIO@ +* _helpString_ An optional help string associated with the item. By +default, the handler for the EVT_MENU_HIGHLIGHT event displays this +string in the status line. +* _menuItem_ A menuitem object. It will be owned by the Menu object +after this function is called, so do not delete it yourself. </ins><span class="cx"> </span><span class="cx"> h4. Remarks </span><span class="cx"> </span><span class="lines">@@ -185,17 +176,17 @@ </span><span class="cx"> The _item_ string for the normal menu items (not submenus or separators) </span><span class="cx"> may include the accelerator which can be used to activate the menu item </span><span class="cx"> from keyboard. The accelerator string follows the item label and is separated </span><del>-from it by a @TAB@ character (@''$@@$t''@). Its general syntax is -any combination of @"CTRL"@, @"ALT"@ and @"SHIFT"@ strings (case </del><ins>+from it by a @TAB@ character "\t". Its general syntax is +any combination of @CTRL@, @ALT@ and @SHIFT@ strings (case </ins><span class="cx"> doesn''t matter) separated by either @''-''@ or @''+''@ characters and </span><span class="cx"> followed by the accelerator itself. The accelerator may be any alphanumeric </span><span class="cx"> character, any function key (from @F1@ to @F12@) or one of the special </span><span class="cx"> characters listed in the table below (again, case doesn''t matter): </span><span class="cx"> </span><span class="cx"> </span><del>-|@DEL@| or @DELETE@Delete key| -|@INS@| or @INSERT@Insert key| -|@ENTER@| or @RETURN@Enter key| </del><ins>+|@DEL@ or @DELETE@|Delete key| +|@INS@ or @INSERT@|Insert key| +|@ENTER@ or @RETURN@|Enter key| </ins><span class="cx"> |@PGUP@|PageUp key| </span><span class="cx"> |@PGDN@|PageDown key| </span><span class="cx"> |@LEFT@|Left cursor arrow key| </span><span class="lines">@@ -206,19 +197,17 @@ </span><span class="cx"> |@END@|End key| </span><span class="cx"> |@SPACE@|Space| </span><span class="cx"> |@TAB@|Tab key| </span><del>-|@ESC@| or @ESCAPE@Escape key (Windows only)| </del><ins>+|@ESC@ or @ESCAPE@| Escape key (Windows only)| </ins><span class="cx"> </span><span class="cx"> </span><span class="cx"> h4. See also </span><span class="cx"> </span><span class="cx"> "Menu#append_separator":menu.html#Menu_appendseparator, "Menu#append_check_item":menu.html#Menu_appendcheckitem, "Menu#append_radio_item":menu.html#Menu_appendradioitem, "Menu#insert":menu.html#Menu_insert, "Menu#set_label":menu.html#Menu_setlabel, "Menu#get_help_string":menu.html#Menu_gethelpstring, "Menu#set_help_string":menu.html#Menu_sethelpstring, "MenuItem":menuitem.html </span><span class="cx"> </span><del>- - </del><span class="cx"> h3(#Menu_appendcheckitem). Menu#append_check_item </span><span class="cx"> </span><span class="cx"> "MenuItem":menuitem.html *append_check_item*(%(arg-type)Integer% id, %(arg-type)String% item, </span><del>- %(arg-type)String% helpString = "") </del><ins>+ %(arg-type)String% helpString = "") </ins><span class="cx"> </span><span class="cx"> Adds a checkable item to the end of the menu. </span><span class="cx"> </span><span class="lines">@@ -229,7 +218,7 @@ </span><span class="cx"> h3(#Menu_appendradioitem). Menu#append_radio_item </span><span class="cx"> </span><span class="cx"> "MenuItem":menuitem.html *append_radio_item*(%(arg-type)Integer% id, %(arg-type)String% item, </span><del>- %(arg-type)String% helpString = "") </del><ins>+ %(arg-type)String% helpString = "") </ins><span class="cx"> </span><span class="cx"> Adds a radio item to the end of the menu. All consequent radio items form a </span><span class="cx"> group and when an item in the group is checked, all the others are </span><span class="lines">@@ -337,8 +326,6 @@ </span><span class="cx"> Finds the menu item object associated with the given menu item identifier and, </span><span class="cx"> optionally, the (sub)menu it belongs to. </span><span class="cx"> </span><del>- - </del><span class="cx"> h4. Parameters </span><span class="cx"> </span><span class="cx"> * _itemString_ Menu item string to find. </span><span class="lines">@@ -350,7 +337,7 @@ </span><span class="cx"> </span><span class="cx"> First form: menu item identifier, or @NOT_FOUND@ if none is found. </span><span class="cx"> </span><del>-Second form: returns the menu item object, or NULL if it is not found. </del><ins>+Second form: returns the "MenuItem":menuitem.html object, or NULL if it is not found. </ins><span class="cx"> </span><span class="cx"> h4. Remarks </span><span class="cx"> </span><span class="lines">@@ -363,7 +350,7 @@ </span><span class="cx"> </span><span class="cx"> "MenuItem":menuitem.html *find_item_by_position*(%(arg-type)size_t% position) </span><span class="cx"> </span><del>-Returns the MenuItem given a position in the menu. </del><ins>+Returns the "MenuItem":menuitem.html at the given position in the menu. </ins><span class="cx"> </span><span class="cx"> h3(#Menu_gethelpstring). Menu#get_help_string </span><span class="cx"> </span><span class="lines">@@ -410,7 +397,7 @@ </span><span class="cx"> </span><span class="cx"> h3(#Menu_getmenuitems). Menu#get_menu_items </span><span class="cx"> </span><del>- "MenuItemList":menuitemlist.html *get_menu_items*() </del><ins>+ Array *get_menu_items*() </ins><span class="cx"> </span><span class="cx"> Returns the list of items in the menu. MenuItemList is a pseudo-template </span><span class="cx"> list class containing MenuItem pointers. </span><span class="lines">@@ -625,7 +612,7 @@ </span><span class="cx"> * _title_ The title to set. </span><span class="cx"> </span><span class="cx"> h4. Remarks </span><del>- </del><ins>+                                                                         </ins><span class="cx"> This is relevant only to popup menus, use </span><span class="cx"> "MenuBar#set_label_top":menubar.html#MenuBar_setlabeltop for the menus in the </span><span class="cx"> menubar. </span></span></pre> </div> </div> </body> </html>