|
OWLNext 6.32
|
#include <framewin.h>
Public Member Functions | |
| TFrameWindow (TWindow *parent, LPCTSTR title=0, TWindow *clientWnd=0, bool shrinkToClient=false, TModule *module=0) | |
| TFrameWindow (TWindow *parent, const tstring &title, TWindow *client=0, bool shrinkToClient=false, TModule *=0) | |
| TFrameWindow (HWND hWnd, TModule *module=0) | |
| ~TFrameWindow () | |
| virtual bool | AssignMenu (TResId menuResId) |
| virtual bool | SetMenu (HMENU newMenu) |
| void | SetMenuDescr (const TMenuDescr &menuDescr) |
| const TMenuDescr * | GetMenuDescr () const |
| virtual bool | MergeMenu (const TMenuDescr &childMenuDescr) |
| bool | RestoreMenu () |
| void | SetBarDescr (TBarDescr *barDescr, TAutoDelete=AutoDelete) |
| const TBarDescr * | GetBarDescr () const |
| virtual bool | MergeBar (const TBarDescr &childBarDescr) |
| virtual bool | RestoreBar () |
| TModule * | GetMergeModule () |
| HICON | GetIcon () const |
| HICON | GetIconSm () const |
| bool | SetIcon (TModule *iconModule, TResId iconResId) |
| bool | SetIconSm (TModule *iconModule, TResId iconResIdSm) |
| virtual TWindow * | GetClientWindow () |
| virtual TWindow * | SetClientWindow (TWindow *clientWnd) |
| void | RemoveChild (TWindow *child) |
| virtual HWND | GetCommandTarget () |
| bool | GetKeyboardHandling () const |
| void | SetKeyboardHandling (bool kh=true) |
| void | EnableKBHandler () |
| bool | PreProcessMsg (MSG &msg) |
| bool | IdleAction (long idleCount) |
| bool | HoldFocusHWnd (HWND hWndLose, HWND hWndGain) |
| bool | SetDocTitle (LPCTSTR docname, int index) |
Protected Member Functions | |
| TFrameWindow () | |
| void | Init (TWindow *clientWnd, bool shrinkToClient) |
| TResult | EvCommand (uint id, HWND hWndCtl, uint notifyCode) |
| void | EvCommandEnable (TCommandEnabler &ce) |
| void | BroadcastResizeToChildren (uint sizeType, TSize &size) |
| void | EvInitMenuPopup (HMENU hPopupMenu, uint index, bool sysMenu) |
| void | EvPaint () |
| bool | EvEraseBkgnd (HDC) |
| HANDLE | EvQueryDragIcon () |
| void | EvSetFocus (HWND hWndLostFocus) |
| void | EvSize (uint sizeType, TSize &size) |
| void | EvParentNotify (uint event, uint childHandleOrX, uint childIDOrY) |
| void | EvPaletteChanged (THandle hWndPalChg) |
| bool | EvQueryNewPalette () |
| void | SetupWindow () |
| void | CleanupWindow () |
| HWND | GetHWndRestoreFocus () |
| void | SetHWndRestoreFocus (HWND hwndRestoreFocus) |
| int | GetDocTitleIndex () const |
| void | SetDocTitleIndex (int index) |
| void | SetMergeModule (TModule *module) |
Derived from TWindow, TFrameWindow controls such window-specific behavior as keyboard navigation and command processing for client windows. For example, when a window is reactivated, TFrameWindow is responsible for restoring a window's input focus and for adding menu bar and icon support. TFrameWindow is a streamable class.
In terms of window areas, the frame area consists of the border, system menus, toolbars and status bars whereas the client area excludes these areas. Although frame windows can support a client window, the frame window remains separate from the client window so that you can change the client window without affecting the frame window.
ObjectWindows uses this frame and client structure for both TFrameWindow and TMDIChild classes. Both these classes can hold a client class. Having a separate class for the client area of the window adds more flexibility to your program. For example, this separate client area, which might be a dialog box, can be moved into another frame window, either a main window or an MDI child window.
TFrameWindow adds the notion of a client window, keyboard navigation, and special processing for commands (see member function EvCommand() )
See TFloatingFrame for a description of a floating frame with the same default functionality as a frame window.
| owl::TFrameWindow::TFrameWindow | ( | TWindow * | parent, |
| LPCTSTR | title = 0, |
||
| TWindow * | clientWnd = 0, |
||
| bool | shrinkToClient = false, |
||
| TModule * | module = 0 |
||
| ) |
Constructs a window object with the parent window supplied in parent, which is zero if this is the main window. title, which by default is zero, contains the title displayed in the window's caption bar. clientWnd is the client window for this frame window or zero if none exists. shrinkToClient controls whether the client window will size to fit the frame or the frame window will fit the client. Note that this parameter only affects the size of the main window. When a client window is used in a frame window that doesn't have shrinktoClient set, the client window resizes to fit the frame window. When a client window is used in a frame window that has the shrinktoClient set, the frame window shrinks to fit the size of the client window.
| owl::TFrameWindow::TFrameWindow | ( | TWindow * | parent, |
| const tstring & | title, | ||
| TWindow * | client = 0, |
||
| bool | shrinkToClient = false, |
||
| TModule * | module = 0 |
||
| ) |
String-aware overload.
| owl::TFrameWindow::TFrameWindow | ( | HWND | THandle, |
| TModule * | module = 0 |
||
| ) |
Constructor for a TFrameWindow that is being used as an alias for a non-ObjectWindows window. hWnd is the handle to the existing window object that TFrameWindow controls; module contains the module passed to the base class's contructor.
This constructor is generally not used by derived classes, only as generic alias to a framewindow-like HWND
References Init().
| owl::TFrameWindow::~TFrameWindow | ( | ) |
Destructor for a TFrameWindow.
Deletes any associated menu descriptor.
References owl::TApplication::ClearMainWindow(), owl::TWindow::GetApplication(), owl::TWindow::IsFlagSet(), and owl::wfMainWindow.
| owl::TFrameWindow::TFrameWindow | ( | ) | [protected] |
< String-aware overload
Protected constructor for use by immediate virtually derived classes. Immediate derivitives must call Init() before constructions are done.
| bool owl::TFrameWindow::AssignMenu | ( | TResId | menuResId | ) | [virtual] |
Perform a high-level menu assignment either before or after the HWND for the window has been created.
Sets Attr.Menu to the supplied menuResId and frees any previous strings pointed to by Attr.Menu. If HWindow is nonzero, loads and sets the menu of the window, destroying any previously existing menu.
Returns true if successful; false otherwise
References owl::TWindow::GetHandle(), owl::TWindow::GetMenu(), owl::TResIdT< T >::IsString(), and SetMenu().
| void owl::TFrameWindow::BroadcastResizeToChildren | ( | uint | sizeType, |
| TSize & | size | ||
| ) | [protected] |
Tell child windows frame has minimized/maximized/restored (They may want to change enabled state or release/restore resources)
References owl::TWindow::ChildBroadcastMessage(), and WM_OWLFRAMESIZE.
| void owl::TFrameWindow::CleanupWindow | ( | ) | [protected, virtual] |
Cleans up any associated icons.
Reimplemented from owl::TWindow.
Reimplemented in owl::TDecoratedFrame, owl::TTraceWindow, and ocf::TOleFrame.
References SetIcon(), and SetIconSm().
| void owl::TFrameWindow::EnableKBHandler | ( | ) | [inline] |
Sets the keyboard handling flag to true.
Sets a flag indicating that the receiver has requested keyboard navigation (translation of keyboard input into control selections). By default, the keyboard interface, which lets users use the tab and arrow keys to move between the controls, is disabled for windows and dialog boxes.
References SetKeyboardHandling().
| TResult owl::TFrameWindow::EvCommand | ( | uint | id, |
| HWND | hCtl, | ||
| uint | notifyCode | ||
| ) | [protected, virtual] |
Handle WM_COMMAND to provide extra processing for commands: Extra processing for commands: starts with the command target window (usually the focus window) and gives it and its parent windows an opportunity to handle the command.
Reimplemented from owl::TWindow.
Reimplemented in owl::TDecoratedFrame, owl::TFloatingFrame, and ocf::TRemViewBucket.
References owl::TWindow::EvCommand(), GetCommandTarget(), owl::TWindow::GetHandle(), owl::TWindow::GetParent(), and owl::TWindow::GetWindowPtr().
| void owl::TFrameWindow::EvCommandEnable | ( | TCommandEnabler & | commandEnabler | ) | [protected, virtual] |
Handle WM_COMMAND_ENABLE to provide command enable distribution and default support for windows without command enable handlers.
Handles checking and unchecking of the frame window's menu items. EvCommandEnable uses TWindow's RouteCommandEnable member function to perform the majority of this command enabling work.
Reimplemented from owl::TWindow.
Reimplemented in owl::TDecoratedFrame, owl::TFloatingFrame, and ocf::TRemViewBucket.
References GetCommandTarget(), and owl::TWindow::RouteCommandEnable().
| bool owl::TFrameWindow::EvEraseBkgnd | ( | HDC | hDC | ) | [protected] |
Response method for an incoming WM_ERASEBKGND message. EvEraseBkgnd erases the background of the window specified in HDC. It returns true if the background is erased; otherwise, it returns false.
If this frame window is iconic, and there is a client window, then give it a chance to erase the background since it may want to take over painting.
If not iconic, forward to TWindow for normal erase background processing
Reimplemented from owl::TWindow.
References owl::TWindow::IsIconic().
| void owl::TFrameWindow::EvInitMenuPopup | ( | HMENU | hPopupMenu, |
| uint | index, | ||
| bool | sysMenu | ||
| ) | [protected] |
Responds to WM_INITMENUPOPUP by performing a command enable run on each of the menu items in the popup menu
Sent before a pop-up menu is displayed, EvInitMenuPopup lets an application change the items on the menu before the menu is displayed. EvInitMenuPopup controls whether the items on the pop-up menu are enabled or disabled, checked or unchecked, or strings. HMENU indicates the menu handle. index is the index of the pop-up menu. sysMenu indicates if the pop-up menu is the system menu.
Reimplemented from owl::TWindow.
References owl::TWindow::DrawMenuBar(), and owl::TWindow::GetMenu().
| void owl::TFrameWindow::EvPaint | ( | ) | [protected] |
Responds to a WM_PAINT message in the client window in order to paint the iconic window's icon or to allow client windows a change to paint the icon.
If iconic, and an icon has been defined then draw that. Or, if iconic & there is a client window, then call its paint function.
If not iconic, forwards to TWindow for normal paint processing
Reimplemented from owl::TWindow.
References owl::TWindow::GetHandle(), owl::TWindow::IsIconic(), owl::TWindow::Paint(), owl::TPaintDC::Ps, and owl::TWindow::SendMessage().
| void owl::TFrameWindow::EvPaletteChanged | ( | THandle | hWndPalChg | ) | [protected] |
Forwards the WM_PALETTECHANGED message to the client window.
Reimplemented from owl::TWindow.
References owl::TWindow::ForwardMessage(), and GetClientWindow().
| void owl::TFrameWindow::EvParentNotify | ( | uint | event, |
| uint | childHandleOrX, | ||
| uint | childIDOrY | ||
| ) | [protected] |
Responds to a message to notify the parent window that a given event has occurred. If the client window is destroyed, closes the parent window. If shrinkToClient is set and the child window has changed size, the frame is adjusted. When a TFrameWindow's client window is destroyed, the TFrameWindow object sees the WM_PARENTNOTIFY message and posts a close message to itself. Without this message, an empty frame would remain and the client window would then have to determine how to destroy the frame. If you don't want this to happen, you can derive from the frame window and have your application handle the EvParentNotify or EvClose messages.
Reimplemented from owl::TWindow.
References owl::TWindow::ClearFlag(), owl::TWindow::DefaultProcessing(), owl::TWindow::GetHandle(), owl::TWindow::GetWindowPtr(), owl::TWindow::IsFlagSet(), owl::TWindow::IsIconic(), owl::TWindow::PostMessage(), owl::wfFullyCreated, and owl::wfShrinkToClient.
| HANDLE owl::TFrameWindow::EvQueryDragIcon | ( | ) | [protected] |
Responds to a WM_QUERYDRAGICON message sent to a minimized (iconic) window that is going to be dragged. Instead of the default icon, EvQueryDragIcon uses the icon that was set using SetIcon. This member is not available under Presentation Manager.
Reimplemented from owl::TWindow.
| bool owl::TFrameWindow::EvQueryNewPalette | ( | ) | [protected] |
Forwards the WM_QUERYNEWPALETTE message to the client window.
Reimplemented from owl::TWindow.
References owl::TWindow::ForwardMessage(), and GetClientWindow().
| void owl::TFrameWindow::EvSetFocus | ( | HWND | hWndLostFocus | ) | [protected] |
Restores the focus to the active window. hWndLostFocus contains the handle for the window that lost focus.
Handle WM_SETFOCUS to return focus back to the child that had it most recently, or find the best one to give it to otherwise.
Reimplemented from owl::TWindow.
References GetCommandTarget(), owl::TWindow::IsChild(), owl::TWindow::IsWindow(), and owl::TWindow::SetFocus().
| void owl::TFrameWindow::EvSize | ( | uint | sizeType, |
| TSize & | size | ||
| ) | [protected] |
Response method for an incoming WM_SIZE message
Resizes the client window' so that it is equivalent to the client rectangle's size. Calls TWindow::EvSize() in response to an incoming WM_SIZE message.
If no WM_SIZE sent, forwards WM_SIZE message to client so it can recalc.
Reimplemented from owl::TWindow.
Reimplemented in owl::TDecoratedFrame, and ocf::TOleFrame.
References BroadcastResizeToChildren(), owl::TWindow::ForwardMessage(), and owl::TWindow::GetClientRect().
| const TBarDescr * owl::TFrameWindow::GetBarDescr | ( | ) | const [inline] |
Returns a pointer to the control bar descriptor.
| TWindow * owl::TFrameWindow::GetClientWindow | ( | ) | [virtual] |
Returns a pointer to the client window. If you are trying to access a window-based object in a TMDIChild (which is a frame window), you can use this function.
Reimplemented in owl::TMDIFrame.
| HWND owl::TFrameWindow::GetCommandTarget | ( | ) | [virtual] |
Locates and returns the child window that is the target of the command and command enable messages. If the current application does not have focus or if the focus is within a toolbar in the application, GetCommandTarget returns the most recently active child window.
If an alternative form of command processing is desired, a user's main window class can override this function. TFrameWindow's EvCommand and EvCommandEnable functions use GetCommandTarget to find the command target window. This member is not available under Presentation Manager.
Reimplemented in owl::TFloatingFrame, and owl::TMDIFrame.
References GetClientWindow(), owl::TWindow::GetFocus(), owl::TWindow::GetWindowPtr(), and owl::TWindow::IsChild().
| int owl::TFrameWindow::GetDocTitleIndex | ( | ) | const [inline, protected] |
Returns the document title index.
| HWND owl::TFrameWindow::GetHWndRestoreFocus | ( | ) | [inline, protected] |
Returns the handle of the window to restore the focus to.
| HICON owl::TFrameWindow::GetIcon | ( | ) | const [inline] |
Retrieve handle of icon of frame window
| HICON owl::TFrameWindow::GetIconSm | ( | ) | const [inline] |
Retrieve handle of icon of frame window
| bool owl::TFrameWindow::GetKeyboardHandling | ( | ) | const [inline] |
Returns flag indicating that the receiver has requested "keyboard handling" (translation of keyboard input into control selections).
| const TMenuDescr * owl::TFrameWindow::GetMenuDescr | ( | ) | const [inline] |
Returns a pointer to the menu descriptor for the frame window.
| TModule * owl::TFrameWindow::GetMergeModule | ( | ) | [inline] |
Returns the module of the merge menu.
| bool owl::TFrameWindow::HoldFocusHWnd | ( | HWND | hWndLose, |
| HWND | hWndGain | ||
| ) | [virtual] |
Overrides TWindow's virtual function. Responds to a request by a child window to hold its HWND when it is losing focus. Stores the child's HWND in HwndRestoreFocus.
return true if caller can stop searching for a window to hold its handle.
Reimplemented from owl::TWindow.
References owl::TWindow::GetHandle(), and owl::TWindow::IsChild().
| bool owl::TFrameWindow::IdleAction | ( | long | idleCount | ) | [virtual] |
Overrides TWindow's virtual function. TApplication calls the main window's IdleAction when no messages are waiting to be processed. TFrameWindow uses this idle time to perform command enabling for the menu bar. It also forwards IdleAction to each of its children. IdleAction can be overridden to do background processing.
Reimplemented from owl::TWindow.
Reimplemented in owl::TTraceWindow.
References owl::TWindow::GetFocus(), owl::TWindow::GetMenu(), owl::TWindow::GetWindowLong(), and owl::TWindow::IsWindow().
| void owl::TFrameWindow::Init | ( | TWindow * | clientWnd, |
| bool | shrinkToClient | ||
| ) | [protected] |
Normal initialization of a default constructed TFrameWindow. Is ignored if called more than once.
This initialize function is for use with virtually derived classes, which must call Init before construction is completed. This procedure provides necessary data to virtually derived classes and takes care of providing the data in the appropriate sequence.
References owl::TWindow::SetFlag(), and owl::wfShrinkToClient.
| bool owl::TFrameWindow::MergeBar | ( | const TBarDescr & | childBarDescr | ) | [inline, virtual] |
Do nothing. Return false. Overriden in TDecoratedFrame.
Reimplemented in owl::TDecoratedFrame.
| bool owl::TFrameWindow::MergeMenu | ( | const TMenuDescr & | childMenuDescr | ) | [virtual] |
Merges the given menu descriptor with this frame's own menu descriptor and displays the resulting menu in this frame. See TMenuDescr for a description of menu bar types that can be merged.
Optionally use an existing HMENU to merge into & set
References owl::TWindow::GetApplication(), owl::TWindow::GetHandle(), owl::TMenuDescr::GetModule(), owl::TWindow::IsFlagSet(), owl::TMenuDescr::Merge(), owl::TApplication::PreProcessMenu(), SetMenu(), and owl::wfMainWindow.
| bool owl::TFrameWindow::PreProcessMsg | ( | MSG & | msg | ) | [virtual] |
Overrides TWindow's virtual function. Performs preprocessing of window messages. If the child window has requested keyboard navigation, PreProcessMsg handles any accelerator key messages and then processes any other keyboard messages.
Reimplemented from owl::TWindow.
Reimplemented in owl::TDecoratedFrame, and owl::TMDIChild.
References owl::TWindow::GetParent(), and owl::TWindow::PreProcessMsg().
| void owl::TFrameWindow::RemoveChild | ( | TWindow * | child | ) | [virtual] |
If someone removes our client with a RemoveChild() call, update our client and restore focus ptrs.
Reimplemented from owl::TWindow.
Reimplemented in owl::TDecoratedFrame.
References owl::TWindow::GetHandle().
| bool owl::TFrameWindow::RestoreBar | ( | ) | [inline, virtual] |
Do nothing in TFrameWindow. Overriden in TDecoratedFrame.
Reimplemented in owl::TDecoratedFrame.
| void owl::TFrameWindow::SetBarDescr | ( | TBarDescr * | barDescr, |
| TAutoDelete | delonClose = AutoDelete |
||
| ) |
Sets the control bar descriptor to the new bar descriptor.
References owl::TWindow::GetHandle(), owl::TWindow::IsFlagSet(), RestoreBar(), and owl::wfMainWindow.
Sets the client window to the specified window. Users are responsible for destroying the old client window if they want to eliminate it.
Assume clientWnd was parented to us.
Reimplemented in owl::TDecoratedFrame.
References owl::TWindow::Create(), owl::TWindow::GetFocus(), owl::TWindow::GetHandle(), NoColor, NoErase, RemoveChild(), owl::TWindow::SetBkgndColor(), owl::TWindow::SetFocus(), owl::TWindow::SetParent(), and owl::TWindow::ShowWindow().
| bool owl::TFrameWindow::SetDocTitle | ( | LPCTSTR | docname, |
| int | index | ||
| ) | [virtual] |
Overrides TWindow's virtual function. Pastes the number of the view into the caption and then shows the number on the screen. This function can be overridden if you don't want to use the default implementation, which displays a number on the screen. That is, you might want to write "Two" instead of ":2" on the screen. For an example of the behavior of this function, see step 12 of the ObjectWindows tutorial, which renumbers the views if one of them is closed.
Generates a composite title based on the caption, docname, and index if it is > 0.
[<Title> - ]<docname>[:<index>]
Reimplemented from owl::TWindow.
Reimplemented in ocf::TRemViewBucket.
References owl::TWindow::GetCaption(), and owl::TWindow::SetWindowText().
| void owl::TFrameWindow::SetDocTitleIndex | ( | int | index | ) | [inline, protected] |
Sets the current document's title index.
| void owl::TFrameWindow::SetHWndRestoreFocus | ( | HWND | hwndRestoreFocus | ) | [inline, protected] |
Sets the remembered focused window.
Sets the icon in the module specified in iconModule to the resource ID specified in iconResId. See the sample file BMPVIEW.CPP for an example of painting an icon from a bitmap. You can set the iconResId to one of these predefined values as well as user-defined values:
IDI_APPLICATION Default icon used for applicationsIDI_ASTERISK Asterisk used for an informative messageIDI_EXCLAMATION Exclamation mark used for a warning messageIDI_HAND Hand used for warning messagesIDI_QUESTION Question mark used for prompting a response References owl::TModule::FindResModule(), owl::TWindow::IsWindow(), and owl::TWindow::SendMessage().
Set the Small Icon (16 x 16)
References owl::TModule::FindResModule(), owl::TWindow::IsWindow(), and owl::TWindow::SendMessage().
| void owl::TFrameWindow::SetKeyboardHandling | ( | bool | kh = true | ) | [inline] |
Sets flag indicating that the receiver has requested "keyboard handling" (translation of keyboard input into control selections).
| bool owl::TFrameWindow::SetMenu | ( | HMENU | newMenu | ) | [virtual] |
Overrides TWindow's non-virtual SetMenu function, thus allowing derived classes the opportunity to implement this function differently from TWindow. SetMenu sets the window's menu to the menu indicated by newMenu. If newMenu is 0, the window's current menu is removed. SetMenu returns 0 if the menu remains unchanged; otherwise, it returns a nonzero value.
It also calls the application's PreProcessMenu() if it is the main window to let it make any changes just before setting.
Reimplemented from owl::TWindow.
Reimplemented in owl::TMDIFrame.
References owl::TWindow::GetApplication(), owl::TWindow::IsFlagSet(), owl::TApplication::PreProcessMenu(), and owl::wfMainWindow.
| void owl::TFrameWindow::SetMenuDescr | ( | const TMenuDescr & | menuDescr | ) |
Sets the menu descriptor to the new menu descriptor.
References owl::TWindow::GetHandle(), owl::TWindow::GetMenu(), owl::TWindow::IsFlagSet(), SetMenu(), and owl::wfMainWindow.
| void owl::TFrameWindow::SetMergeModule | ( | TModule * | module | ) | [inline, protected] |
Remembers where the merged menu came from.
| void owl::TFrameWindow::SetupWindow | ( | ) | [protected, virtual] |
Calls TWindow::SetUpWindow to create windows in a child list. SetupWindow performs the initial adjustment of the client window if one exists, assigns the frame's menu based on the menu descriptor, and initializes HwndRestoreFocus.
TH Previous version would be to search for first child with tabstop. TH Why not use CommandTarget?
Reimplemented from owl::TWindow.
Reimplemented in owl::TDecoratedFrame, owl::TPreviewWin, owl::TTraceWindow, and ocf::TOleFrame.
References GetCommandTarget(), owl::TWindow::GetHandle(), owl::TWindow::GetMenu(), owl::TWindow::GetWindowPlacement(), owl::TWindow::IsChild(), owl::TWindow::IsFlagSet(), owl::TWindow::SendMessage(), SetMenu(), owl::TWindow::SetWindowPlacement(), and owl::wfMainWindow.
1.7.4