Management of controls in resizable dialogs. More...
#include <window.h>


Public Types | |
| typedef std::list< ResizeEntry > | super |
Public Member Functions | |
| ResizeManager (HWND hwnd) | |
| void | Add (UINT id, int flags) |
| void | Add (HWND hwnd, int flags) |
| void | HandleSize (int cx, int cy) |
| void | Resize (int dx, int dy) |
| void | SetMinMaxInfo (LPMINMAXINFO lpmmi) |
Public Attributes | |
| SIZE | _min_wnd_size |
Protected Attributes | |
| HWND | _hwnd |
| SIZE | _last_size |
Management of controls in resizable dialogs.
Definition at line 484 of file window.h.
| typedef std::list<ResizeEntry> ResizeManager::super |
| ResizeManager::ResizeManager | ( | HWND | hwnd ) |
Definition at line 771 of file window.cpp.
References _last_size, and _min_wnd_size.
: _hwnd(hwnd) { ClientRect clnt(hwnd); _last_size.cx = clnt.right; _last_size.cy = clnt.bottom; WindowRect rect(hwnd); _min_wnd_size.cx = rect.right - rect.left; _min_wnd_size.cy = rect.bottom - rect.top; }
| void ResizeManager::Add | ( | UINT | id, |
| int | flags | ||
| ) | [inline] |
Definition at line 490 of file window.h.
Referenced by FindProgramDlg::FindProgramDlg(), and TrayNotifyDlg::TrayNotifyDlg().
{push_back(ResizeEntry(id, flags));}

| void ResizeManager::Add | ( | HWND | hwnd, |
| int | flags | ||
| ) | [inline] |
Definition at line 493 of file window.h.
{push_back(ResizeEntry(hwnd, flags));}
| void ResizeManager::HandleSize | ( | int | cx, |
| int | cy | ||
| ) |
Definition at line 783 of file window.cpp.
References ResizeEntry::_flags, _hwnd, ResizeEntry::_id, _last_size, HWND, MOVE_BOTTOM, MOVE_LEFT, MOVE_RIGHT, MOVE_TOP, and ScreenToClient().
Referenced by Resize(), and ResizeController< Dialog >::WndProc().
{
ClientRect clnt_rect(_hwnd);
SIZE new_size = {cx, cy};
int dx = new_size.cx - _last_size.cx;
int dy = new_size.cy - _last_size.cy;
if (!dx && !dy)
return;
_last_size = new_size;
HDWP hDWP = BeginDeferWindowPos(size());
for(ResizeManager::const_iterator it=begin(); it!=end(); ++it) {
const ResizeEntry& e = *it;
RECT move = {0};
if (e._flags & MOVE_LEFT)
move.left += dx;
if (e._flags & MOVE_RIGHT)
move.right += dx;
if (e._flags & MOVE_TOP)
move.top += dy;
if (e._flags & MOVE_BOTTOM)
move.bottom += dy;
UINT flags = 0;
if (!move.left && !move.top)
flags = SWP_NOMOVE;
if (move.right==move.left && move.bottom==move.top)
flags |= SWP_NOSIZE;
if (flags != (SWP_NOMOVE|SWP_NOSIZE)) {
HWND hwnd = GetDlgItem(_hwnd, e._id);
if (hwnd) {
WindowRect rect(hwnd);
ScreenToClient(_hwnd, rect);
rect.left += move.left;
rect.right += move.right;
rect.top += move.top;
rect.bottom += move.bottom;
hDWP = DeferWindowPos(hDWP, hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, flags|SWP_NOACTIVATE|SWP_NOZORDER);
}
}
}
EndDeferWindowPos(hDWP);
}


| void ResizeManager::Resize | ( | int | dx, |
| int | dy | ||
| ) |
Definition at line 842 of file window.cpp.
References _hwnd, _min_wnd_size, HandleSize(), and MoveVisible().
Referenced by FindProgramDlg::FindProgramDlg(), and TrayNotifyDlg::TrayNotifyDlg().
{
::SetWindowPos(_hwnd, 0, 0, 0, _min_wnd_size.cx+dx, _min_wnd_size.cy+dy, SWP_NOMOVE|SWP_NOACTIVATE);
MoveVisible(_hwnd);
ClientRect clnt_rect(_hwnd);
HandleSize(clnt_rect.right, clnt_rect.bottom);
}


| void ResizeManager::SetMinMaxInfo | ( | LPMINMAXINFO | lpmmi ) | [inline] |
Definition at line 499 of file window.h.
References _min_wnd_size.
Referenced by ResizeController< Dialog >::WndProc().
{
lpmmi->ptMinTrackSize.x = _min_wnd_size.cx;
lpmmi->ptMinTrackSize.y = _min_wnd_size.cy;
}

HWND ResizeManager::_hwnd [protected] |
Definition at line 508 of file window.h.
Referenced by HandleSize(), and Resize().
SIZE ResizeManager::_last_size [protected] |
Definition at line 509 of file window.h.
Referenced by HandleSize(), and ResizeManager().
Definition at line 505 of file window.h.
Referenced by Resize(), ResizeManager(), and SetMinMaxInfo().
|
ROS Explorer Source Code Documentation
generated on 02.01.2013 by
|