Ruby/Desktop(wxRuby)/Документация/Frame
Материал из Викиучебника
A frame is a window whose size and position can (usually) be changed by the user. It usually has thick borders and a title bar, and can optionally contain a menu bar, toolbar and status bar. A frame can contain any window that is not a frame or dialog.
A frame that has a status bar and toolbar created via the CreateStatusBar/CreateToolBar functions manages these windows, and adjusts the value returned by GetClientSize to reflect the remaining size available to application windows.
[править] Derived from
- TopLevelWindow
- Window
- EvtHandler
- Object
[править] Window styles
| DEFAULT_FRAME_STYLE | Defined as MINIMIZE_BOX|MAXIMIZE_BOX|RESIZE_BORDER| SYSTEM_MENU|CAPTION|CLOSE_BOX|CLIP_CHILDREN |
| ICONIZE | Display the frame iconized (minimized). Windows only. |
| CAPTION | Puts a caption on the frame. |
| MINIMIZE | Identical to ICONIZE. Windows only. |
| MINIMIZE_BOX | Displays a minimize box on the frame. |
| MAXIMIZE | Displays the frame maximized. Windows only. |
| MAXIMIZE_BOX | Displays a maximize box on the frame. |
| CLOSE_BOX | Displays a close box on the frame. |
| STAY_ON_TOP | Stay on top of all other windows, see also FRAME_FLOAT_ON_PARENT. |
| SYSTEM_MENU | Displays a system menu. |
| RESIZE_BORDER | Displays a resizeable border around the window. |
| FRAME_TOOL_WINDOW | Causes a frame with a small titlebar to be created; the frame does not appear in the taskbar under Windows or GTK+. |
| FRAME_NO_TASKBAR | Creates an otherwise normal frame but it does not appear in the taskbar under Windows or GTK+ (note that it will minimize to the desktop window under Windows which may seem strange to the users and thus it might be better to use this style only without MINIMIZE_BOX style). In GTK, the flag is respected only if GTK+ is at least version 2.2. Has no effect under other platforms. |
| FRAME_FLOAT_ON_PARENT | The frame will always beon top of its parent (unlike STAY_ON_TOP). A frame created with this stylemust have a non-NULL parent. |
| FRAME_EX_CONTEXTHELP | Under Windows, puts a query button on the caption. When pressed, Windows will go into a context-sensitive help mode and Widgets will senda EVT_HELP event if the user clicked on an application window. Note that this is not currently supported in wxRuby |
| FRAME_SHAPED | Windows with this style are allowed to have their shape changed with the set_shape method. |
| FRAME_EX_METAL | On Mac OS X, frames with this style will be shown with a metallic look. This is an extra style. |
The default frame style is for normal, resizeable frames. To create a frame which can not be resized by user, you may use the following combination of styles:
DEFAULT_FRAME_STYLE & ~ (RESIZE_BORDER|RESIZE_BOX|MAXIMIZE_BOX).
See also window styles overview.
[править] Default event processing
The following event handlers are available for Frame:
evt_size() { | event | ... } |
If the frame has exactly one child window, not counting the status and toolbar, this child is resized to take the entire frame client area. If two or more windows are present, they should be laid out explicitly either by manually handling the SizeEvent from this handler, or, preferably, using sizers |
evt_menu_highlight() { | event | ... } |
The default implementation displays the help string associated with the selected item in the first pane of the status bar, if there is one. The MenuEvent may be manually handled if preferred |