#include <widget.h>
Inheritance diagram for MWidgets::Widget:

Public Member Functions | |
| Widget () | |
| Constructor. | |
| void | Create (int x, int y, int w, int h, string caption, string classname, DWORD styles, HWND parent, DWORD stylesex=0) |
| Create widgets window. | |
| virtual | ~Widget () |
| Destructor. | |
| HWND | GetHwnd () |
| Return widgets HWND. | |
| HINSTANCE | GetHinstance () |
| Return widgets HINSTANCE. | |
| void | Show () |
| Show widget. | |
| void | Hide () |
| Hide widget. | |
| void | SetText (string text) |
| Replace text in widget. | |
| string | GetText () |
| Return wigets text. | |
| void | DestroyChildWindows () |
| Kill all child widgets. | |
| void | SetMenuBar (Menu *pMenu) |
| Sets widget menu bar. | |
| void | RemoveMenuBar () |
| Removes widgets menu bar. | |
| template<class T> | |
| void | SetOnCreateHandler (T *pProcessor, void(T::*EventCallBack)(Widget *sender)) |
| Create event handler object for OnCreate event;. | |
| virtual void | OnCreate () |
| Callback function for create window event. | |
| template<class T> | |
| void | SetLeftButtonDownHandler (T *pProcessor, void(T::*EventCallBack)(Widget *sender, int x, int y, DWORD buttonMask)) |
| Create event handler object for LeftButtonDown event;. | |
| virtual void | OnLeftButtonDown (int x, int y, DWORD buttonMask) |
| Callback function for left mouse button down event. | |
| template<class T> | |
| void | SetRightButtonDownHandler (T *pProcessor, void(T::*EventCallBack)(Widget *sender, int x, int y, DWORD buttonMask)) |
| Create event handler object for RightButtonDown event;. | |
| virtual void | OnRightButtonDown (int x, int y, DWORD buttonMask) |
| Callback function for right mouse button down event. | |
| template<class T> | |
| void | SetOnSizeHandler (T *pProcessor, void(T::*EventCallBack)(Widget *sender)) |
| Create event handler object for OnSize event;. | |
| virtual void | OnSize (int left, int top, int right, int bottom) |
| Virtual callback function for size event. | |
| void | Enable (BOOL bEnable) |
| Enable/Disable widget. | |
| bool | IsDestroyed () |
| Return true if widgets window is destroyed. | |
| void | Destroy () |
| Destroy widgets window. | |
| void | SetHotKey (UINT fsModifiers, UINT vk, BaseEventHandler *pEventHandler) |
| Create event handler for hot key event;. | |
| template<class T> | |
| void | SetHotKey (UINT fsModifiers, UINT vk, T *pProcessor, void(T::*EventCallBack)(Widget *sender)) |
| Create event handler for hot key event;. | |
| virtual WIDGET_TYPE | GetType ()=0 |
| Return class's identifier like WINDOW or BUTTON. | |
| HWND | GetParent () |
| Return widgets parent. | |
| void | Move (int x, int y) |
| Move widget. | |
| void | Size (int w, int h) |
| Resize window. | |
Static Public Member Functions | |
| static LRESULT CALLBACK | WindowProcedure (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
| Controls window procedure. | |
Protected Member Functions | |
| virtual LRESULT | OnMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
| Message processing procedure for control. | |
| virtual void | OnCommand (WORD code, WORD id) |
| Process WM_COMMAND codes from controls. | |
| void | ProcessMenu (WORD id) |
| Process menu messages. | |
| void | ProcessAccelerators (WORD id) |
| Process accelerators messages. | |
| void | ProcessHotKey (WORD id) |
| Process hotkeys messages. | |
Static Protected Member Functions | |
| static Widget * | GetObjectFromHwnd (HWND hWnd) |
| Convert userdata associated with specifiend window to Widget object. | |
| static BOOL CALLBACK | DestroyChildProc (HWND hwnd, LPARAM lParam) |
| Callback function for EnumChildProc from DestroyChildWindows. | |
Protected Attributes | |
| HWND | m_hWnd |
| Table's window HWND. | |
| HINSTANCE | m_hInstance |
| Application's Instance. | |
| WNDPROC | m_prevWndProc |
| Real windows procedure for subclassing. | |
| HMENU | m_hContextMenu |
| Handle to current context menu. | |
| std::map< std::string, UINT > | m_mapHotKeyIds |
| Map of hotkeys keys and ids. | |
| std::map< UINT, BaseEventHandler * > | m_mapHotKeyHendles |
| Map of hotkeys id and event handler. | |
| BaseEventHandler * | m_pOnCreateHandler |
| Create window event handler. | |
| BaseEventHandler * | m_pOnLButtonDownHandler |
| Left mouse button down handler. | |
| BaseEventHandler * | m_pOnRButtonDownHandler |
| Right mouse button down handler. | |
| BaseEventHandler * | m_pOnSizeHandler |
| OnSize event handler. | |
Friends | |
| class | ContextMenu |
Definition at line 30 of file widget.h.
| MWidgets::Widget::Widget | ( | ) |
Constructor.
Definition at line 133 of file widget.cpp.
References m_hContextMenu, m_hInstance, m_hWnd, m_pOnCreateHandler, m_pOnLButtonDownHandler, m_pOnRButtonDownHandler, m_pOnSizeHandler, and m_prevWndProc.
| MWidgets::Widget::~Widget | ( | ) | [virtual] |
Destructor.
Definition at line 18 of file widget.cpp.
References MWidgets::Widgets::DelWidget(), MWidgets::Widgets::Instance(), m_hWnd, m_mapHotKeyHendles, m_pOnCreateHandler, m_pOnLButtonDownHandler, and m_pOnRButtonDownHandler.
| void MWidgets::Widget::Create | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h, | |||
| string | caption, | |||
| string | classname, | |||
| DWORD | styles, | |||
| HWND | parent, | |||
| DWORD | stylesex = 0 | |||
| ) |
Create widgets window.
| w | new widget's width. | |
| h | new widget's height. | |
| caption | new widget's caption. | |
| styles | widget's(Window Styles) styles. |
Definition at line 153 of file widget.cpp.
References MWidgets::Widgets::AddWidget(), CATCHEXCEPT, EXCEPT, MWidgets::Widgets::Instance(), m_hContextMenu, m_hInstance, m_hWnd, m_prevWndProc, and WindowProcedure().
Referenced by MWidgets::Window::Create(), MWidgets::TextBox::Create(), MWidgets::StatusBar::Create(), MWidgets::RadioButton::Create(), MWidgets::Label::Create(), MWidgets::GroupBox::Create(), MWidgets::Grid::Create(), MWidgets::DockWindow::Create(), MWidgets::Dialog::Create(), MWidgets::ComboBox::Create(), MWidgets::CheckBox::Create(), and MWidgets::Button::Create().
| void MWidgets::Widget::Destroy | ( | ) |
| BOOL CALLBACK MWidgets::Widget::DestroyChildProc | ( | HWND | hwnd, | |
| LPARAM | lParam | |||
| ) | [static, protected] |
Callback function for EnumChildProc from DestroyChildWindows.
| hwnd | [in] Handle to a child window of the parent window specified in EnumChildWindows. | |
| lParam | [in] Specifies the application-defined value given in EnumChildWindows. |
Definition at line 236 of file widget.cpp.
Referenced by DestroyChildWindows().
| void MWidgets::Widget::DestroyChildWindows | ( | ) |
Kill all child widgets.
Definition at line 243 of file widget.cpp.
References DestroyChildProc(), and m_hWnd.
| void MWidgets::Widget::Enable | ( | BOOL | bEnable | ) |
Enable/Disable widget.
| bEnable | if equals "true" enable widget. |
Definition at line 308 of file widget.cpp.
References m_hWnd.
| HINSTANCE MWidgets::Widget::GetHinstance | ( | ) |
| HWND MWidgets::Widget::GetHwnd | ( | ) |
Return widgets HWND.
Definition at line 188 of file widget.cpp.
References m_hWnd.
Referenced by MWidgets::DockWindow::CheckDockPos(), MWidgets::TextBox::Create(), MWidgets::StatusBar::Create(), MWidgets::RadioButton::Create(), MWidgets::Label::Create(), MWidgets::GroupBox::Create(), MWidgets::Grid::Create(), MWidgets::DockWindow::Create(), MWidgets::ComboBox::Create(), MWidgets::CheckBox::Create(), MWidgets::Button::Create(), MWidgets::Window::DockToBottom(), MWidgets::Window::DockToLeft(), MWidgets::Window::DockToRight(), MWidgets::Window::DockToTop(), MWidgets::Dialog::DoModal(), MWidgets::DockWindow::OnMessage(), MWidgets::ContextMenu::TrackMenu(), and MWidgets::Window::UpdateLayout().
| Widget * MWidgets::Widget::GetObjectFromHwnd | ( | HWND | hWnd | ) | [static, protected] |
Convert userdata associated with specifiend window to Widget object.
| hWnd | window HWND. |
Definition at line 41 of file widget.cpp.
Referenced by MWidgets::Grid::EditWindowProcedure(), OnMessage(), and WindowProcedure().
| HWND MWidgets::Widget::GetParent | ( | ) |
Return widgets parent.
Definition at line 375 of file widget.cpp.
References m_hWnd.
Referenced by MWidgets::RadioButton::SetCheked(), and MWidgets::Grid::TestColRowResizing().
| string MWidgets::Widget::GetText | ( | ) |
Return wigets text.
Definition at line 219 of file widget.cpp.
References m_hWnd.
Referenced by MWidgets::ComboBox::OnMessage().
| virtual WIDGET_TYPE MWidgets::Widget::GetType | ( | ) | [pure virtual] |
Return class's identifier like WINDOW or BUTTON.
Implemented in MWidgets::Button, MWidgets::CheckBox, MWidgets::ComboBox, MWidgets::Dialog, MWidgets::DockWindow, MWidgets::Grid, MWidgets::GroupBox, MWidgets::Label, MWidgets::RadioButton, MWidgets::StatusBar, MWidgets::TextBox, and MWidgets::Window.
Referenced by MWidgets::DockWindow::Create().
| void MWidgets::Widget::Hide | ( | ) |
Hide widget.
Definition at line 207 of file widget.cpp.
References m_hWnd.
Referenced by MWidgets::Dialog::DoModal().
| bool MWidgets::Widget::IsDestroyed | ( | ) |
Return true if widgets window is destroyed.
Definition at line 313 of file widget.cpp.
References m_hWnd.
| void MWidgets::Widget::Move | ( | int | x, | |
| int | y | |||
| ) |
Move widget.
| x | position of the left side of the window, in client coordinates. | |
| y | position of the top side of the window, in client coordinates. |
Definition at line 388 of file widget.cpp.
References m_hWnd.
| void MWidgets::Widget::OnCommand | ( | WORD | code, | |
| WORD | id | |||
| ) | [protected, virtual] |
Process WM_COMMAND codes from controls.
| code | notification code. |
Reimplemented in MWidgets::Button, MWidgets::CheckBox, MWidgets::ComboBox, MWidgets::RadioButton, and MWidgets::TextBox.
Definition at line 129 of file widget.cpp.
Referenced by OnMessage().
| void MWidgets::Widget::OnCreate | ( | ) | [virtual] |
Callback function for create window event.
Definition at line 319 of file widget.cpp.
References MWidgets::BaseEventHandler::Call(), and m_pOnCreateHandler.
Referenced by OnMessage().
| void MWidgets::Widget::OnLeftButtonDown | ( | int | x, | |
| int | y, | |||
| DWORD | buttonMask | |||
| ) | [virtual] |
Callback function for left mouse button down event.
| x | coordiate x of mouse. | |
| y | coordiate y of mouse. |
Definition at line 285 of file widget.cpp.
References MWidgets::BaseEventHandler::Call(), and m_pOnLButtonDownHandler.
Referenced by OnMessage().
| LRESULT MWidgets::Widget::OnMessage | ( | HWND | hWnd, | |
| UINT | message, | |||
| WPARAM | wParam, | |||
| LPARAM | lParam | |||
| ) | [protected, virtual] |
Message processing procedure for control.
Common procedures for all widgets.
Reimplemented in MWidgets::Button, MWidgets::ComboBox, MWidgets::Dialog, MWidgets::DockWindow, MWidgets::Grid, MWidgets::GroupBox, and MWidgets::Window.
Definition at line 59 of file widget.cpp.
References MWidgets::Widgets::DelWidget(), GetObjectFromHwnd(), MWidgets::Widgets::Instance(), m_hWnd, m_prevWndProc, OnCommand(), OnCreate(), OnLeftButtonDown(), OnRightButtonDown(), OnSize(), ProcessAccelerators(), ProcessHotKey(), and ProcessMenu().
Referenced by MWidgets::Window::OnMessage(), MWidgets::GroupBox::OnMessage(), MWidgets::Grid::OnMessage(), MWidgets::DockWindow::OnMessage(), MWidgets::Dialog::OnMessage(), MWidgets::ComboBox::OnMessage(), MWidgets::Button::OnMessage(), and WindowProcedure().
| void MWidgets::Widget::OnRightButtonDown | ( | int | x, | |
| int | y, | |||
| DWORD | buttonMask | |||
| ) | [virtual] |
Callback function for right mouse button down event.
| x | coordiate x of mouse. | |
| y | coordiate y of mouse. |
Definition at line 294 of file widget.cpp.
References MWidgets::BaseEventHandler::Call(), and m_pOnRButtonDownHandler.
Referenced by OnMessage().
| void MWidgets::Widget::OnSize | ( | int | left, | |
| int | top, | |||
| int | right, | |||
| int | bottom | |||
| ) | [virtual] |
Virtual callback function for size event.
| left | left coordinate of client area. | |
| top | top coordinate of client area. | |
| right | rightcoordinate of client area. | |
| bottom | bottom coordinate of client area. |
Reimplemented in MWidgets::Grid.
Definition at line 380 of file widget.cpp.
References MWidgets::BaseEventHandler::Call(), and m_pOnSizeHandler.
Referenced by MWidgets::Window::OnMessage(), and OnMessage().
| void MWidgets::Widget::ProcessAccelerators | ( | WORD | id | ) | [protected] |
Process accelerators messages.
| id | accelerators id. |
Definition at line 302 of file widget.cpp.
Referenced by OnMessage().
| void MWidgets::Widget::ProcessHotKey | ( | WORD | id | ) | [protected] |
Process hotkeys messages.
| id | hotkeys id. |
Definition at line 364 of file widget.cpp.
References m_mapHotKeyHendles.
Referenced by OnMessage().
| void MWidgets::Widget::ProcessMenu | ( | WORD | id | ) | [protected] |
Process menu messages.
| id | menu item id. |
Definition at line 248 of file widget.cpp.
References EXCEPT, m_hContextMenu, and m_hWnd.
Referenced by OnMessage().
| void MWidgets::Widget::RemoveMenuBar | ( | ) |
| void MWidgets::Widget::SetHotKey | ( | UINT | fsModifiers, | |
| UINT | vk, | |||
| T * | pProcessor, | |||
| void(T::*)(Widget *sender) | EventCallBack | |||
| ) | [inline] |
Create event handler for hot key event;.
| fsModifiers | Specifies keys that must be pressed in combination with the key specified by the vk parameter; | |
| vk | Specifies the virtual-key code of the hot key. | |
| pProcessor | object that own EventCallBack; method that realize event handler. |
Definition at line 181 of file widget.h.
References SetHotKey().
| void MWidgets::Widget::SetHotKey | ( | UINT | fsModifiers, | |
| UINT | vk, | |||
| BaseEventHandler * | pEventHandler | |||
| ) |
Create event handler for hot key event;.
| fsModifiers | Specifies keys that must be pressed in combination with the key specified by the vk parameter; | |
| vk | Specifies the virtual-key code of the hot key. | |
| pEventHandler | pointer to event handler object. |
Definition at line 327 of file widget.cpp.
References MWidgets::Widgets::GetNewId(), MWidgets::Widgets::Instance(), m_hWnd, m_mapHotKeyHendles, and m_mapHotKeyIds.
Referenced by SetHotKey().
| void MWidgets::Widget::SetLeftButtonDownHandler | ( | T * | pProcessor, | |
| void(T::*)(Widget *sender, int x, int y, DWORD buttonMask) | EventCallBack | |||
| ) | [inline] |
Create event handler object for LeftButtonDown event;.
| pProcessor | object that own EventCallBack; method that realize event handler. |
Definition at line 123 of file widget.h.
References m_pOnLButtonDownHandler.
| void MWidgets::Widget::SetMenuBar | ( | Menu * | pMenu | ) |
Sets widget menu bar.
| pMenu | pointer to menu object. |
Definition at line 271 of file widget.cpp.
References MWidgets::Menu::GetHMENU(), and m_hWnd.
| void MWidgets::Widget::SetOnCreateHandler | ( | T * | pProcessor, | |
| void(T::*)(Widget *sender) | EventCallBack | |||
| ) | [inline] |
Create event handler object for OnCreate event;.
| pProcessor | object that own EventCallBack; method that realize event handler. |
Definition at line 111 of file widget.h.
References m_pOnCreateHandler.
| void MWidgets::Widget::SetOnSizeHandler | ( | T * | pProcessor, | |
| void(T::*)(Widget *sender) | EventCallBack | |||
| ) | [inline] |
Create event handler object for OnSize event;.
| pProcessor | object that own EventCallBack; method that realize event handler. |
Definition at line 151 of file widget.h.
References m_pOnSizeHandler.
| void MWidgets::Widget::SetRightButtonDownHandler | ( | T * | pProcessor, | |
| void(T::*)(Widget *sender, int x, int y, DWORD buttonMask) | EventCallBack | |||
| ) | [inline] |
Create event handler object for RightButtonDown event;.
| pProcessor | object that own EventCallBack; method that realize event handler. |
Definition at line 137 of file widget.h.
References m_pOnRButtonDownHandler.
| void MWidgets::Widget::SetText | ( | string | text | ) |
Replace text in widget.
| text | new text. |
Definition at line 213 of file widget.cpp.
References m_hWnd.
| void MWidgets::Widget::Show | ( | ) |
Show widget.
Definition at line 200 of file widget.cpp.
References m_hWnd.
Referenced by MWidgets::Dialog::DoModal().
| void MWidgets::Widget::Size | ( | int | w, | |
| int | h | |||
| ) |
Resize window.
| w | new width of the window, in pixels. | |
| h | new height of the window, in pixels. |
Definition at line 393 of file widget.cpp.
References m_hWnd.
| LRESULT CALLBACK MWidgets::Widget::WindowProcedure | ( | HWND | hWnd, | |
| UINT | message, | |||
| WPARAM | wParam, | |||
| LPARAM | lParam | |||
| ) | [static] |
Controls window procedure.
Definition at line 47 of file widget.cpp.
References GetObjectFromHwnd(), and OnMessage().
Referenced by Create(), and MWidgets::Widgets::Init().
friend class ContextMenu [friend] |
HMENU MWidgets::Widget::m_hContextMenu [protected] |
Handle to current context menu.
Definition at line 36 of file widget.h.
Referenced by Create(), ProcessMenu(), MWidgets::ContextMenu::TrackMenu(), and Widget().
HINSTANCE MWidgets::Widget::m_hInstance [protected] |
Application's Instance.
Definition at line 34 of file widget.h.
Referenced by Create(), MWidgets::Grid::Create(), MWidgets::Button::Create(), GetHinstance(), and Widget().
HWND MWidgets::Widget::m_hWnd [protected] |
Table's window HWND.
Definition at line 33 of file widget.h.
Referenced by MWidgets::StatusBar::AddPart(), MWidgets::ComboBox::AddString(), MWidgets::ComboBox::Clear(), Create(), MWidgets::StatusBar::Create(), MWidgets::Grid::Create(), MWidgets::DockWindow::Create(), MWidgets::Button::Create(), MWidgets::ComboBox::DelString(), Destroy(), DestroyChildWindows(), MWidgets::Window::DockToBottom(), MWidgets::Window::DockToLeft(), MWidgets::Window::DockToRight(), MWidgets::Window::DockToTop(), MWidgets::Dialog::DoModal(), MWidgets::Grid::Draw(), MWidgets::DockWindow::DrawGripper(), Enable(), MWidgets::Grid::EnsureVisible(), MWidgets::Window::GetBottomWidth(), MWidgets::RadioButton::GetCheked(), MWidgets::CheckBox::GetCheked(), GetHwnd(), MWidgets::ComboBox::GetItemsCount(), MWidgets::Window::GetLeftHeight(), GetParent(), MWidgets::Window::GetRightHeight(), GetText(), MWidgets::Window::GetTopWidth(), Hide(), IsDestroyed(), Move(), OnMessage(), MWidgets::GroupBox::OnMessage(), MWidgets::Grid::OnMessage(), MWidgets::DockWindow::OnMessage(), MWidgets::Button::OnMessage(), ProcessMenu(), MWidgets::Grid::RecalculateVisibles(), MWidgets::Grid::Refresh(), RemoveMenuBar(), MWidgets::Grid::ResizeToAlignCol(), MWidgets::Grid::ResizeToMaxSize(), MWidgets::Grid::ResizeToMinSize(), MWidgets::RadioButton::SetCheked(), MWidgets::CheckBox::SetCheked(), SetHotKey(), MWidgets::Button::SetImage(), SetMenuBar(), MWidgets::StatusBar::SetPartText(), MWidgets::Button::SetPressed(), SetText(), Show(), Size(), MWidgets::Window::UpdateLayout(), Widget(), and ~Widget().
std::map<UINT,BaseEventHandler*> MWidgets::Widget::m_mapHotKeyHendles [protected] |
Map of hotkeys id and event handler.
Definition at line 38 of file widget.h.
Referenced by ProcessHotKey(), SetHotKey(), and ~Widget().
std::map<std::string,UINT> MWidgets::Widget::m_mapHotKeyIds [protected] |
BaseEventHandler* MWidgets::Widget::m_pOnCreateHandler [protected] |
Create window event handler.
Definition at line 42 of file widget.h.
Referenced by OnCreate(), SetOnCreateHandler(), Widget(), and ~Widget().
Left mouse button down handler.
Definition at line 44 of file widget.h.
Referenced by OnLeftButtonDown(), SetLeftButtonDownHandler(), Widget(), and ~Widget().
Right mouse button down handler.
Definition at line 46 of file widget.h.
Referenced by OnRightButtonDown(), SetRightButtonDownHandler(), Widget(), and ~Widget().
BaseEventHandler* MWidgets::Widget::m_pOnSizeHandler [protected] |
OnSize event handler.
Definition at line 48 of file widget.h.
Referenced by OnSize(), SetOnSizeHandler(), Widget(), and MWidgets::Window::~Window().
WNDPROC MWidgets::Widget::m_prevWndProc [protected] |
Real windows procedure for subclassing.
Definition at line 35 of file widget.h.
Referenced by Create(), OnMessage(), and Widget().
1.4.7