show resize grip on resizeable dialogs (slightly modified patch 1910654)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -353,6 +353,7 @@ wxMSW:
|
|||||||
- Allow tooltips longer than 64 (up to 128) characters in wxTaskBarIcon
|
- Allow tooltips longer than 64 (up to 128) characters in wxTaskBarIcon
|
||||||
- Fix centering wxFileDialog and allow positioning it
|
- Fix centering wxFileDialog and allow positioning it
|
||||||
- Allow centering wxMessageDialog on its parent window (troelsk)
|
- Allow centering wxMessageDialog on its parent window (troelsk)
|
||||||
|
- Show resize gripper on resizeable dialogs (Kolya Kosenko)
|
||||||
- Implement support for display enumeration under WinCE (Vince Harron)
|
- Implement support for display enumeration under WinCE (Vince Harron)
|
||||||
- Use different Win32 class names in different wx instances (Thomas Hauk)
|
- Use different Win32 class names in different wx instances (Thomas Hauk)
|
||||||
|
|
||||||
|
@@ -85,6 +85,8 @@ public:
|
|||||||
|
|
||||||
virtual void Raise();
|
virtual void Raise();
|
||||||
|
|
||||||
|
virtual void SetWindowStyleFlag(long style);
|
||||||
|
|
||||||
#ifdef __POCKETPC__
|
#ifdef __POCKETPC__
|
||||||
// Responds to the OK button in a PocketPC titlebar. This
|
// Responds to the OK button in a PocketPC titlebar. This
|
||||||
// can be overridden, or you can change the id used for
|
// can be overridden, or you can change the id used for
|
||||||
@@ -106,6 +108,13 @@ protected:
|
|||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
// these functions deal with the gripper window shown in the corner of
|
||||||
|
// resizeable dialogs
|
||||||
|
void CreateGripper();
|
||||||
|
void DestroyGripper();
|
||||||
|
void ShowGripper(bool show);
|
||||||
|
void ResizeGripper();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxWindow* m_oldFocus;
|
wxWindow* m_oldFocus;
|
||||||
bool m_endModalCalled; // allow for closing within InitDialog
|
bool m_endModalCalled; // allow for closing within InitDialog
|
||||||
@@ -117,6 +126,9 @@ private:
|
|||||||
// this pointer is non-NULL only while the modal event loop is running
|
// this pointer is non-NULL only while the modal event loop is running
|
||||||
wxDialogModalData *m_modalData;
|
wxDialogModalData *m_modalData;
|
||||||
|
|
||||||
|
// gripper window for a resizable dialog, NULL if we're not resizable
|
||||||
|
WXHWND m_hGripper;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxDialog)
|
DECLARE_DYNAMIC_CLASS(wxDialog)
|
||||||
DECLARE_NO_COPY_CLASS(wxDialog)
|
DECLARE_NO_COPY_CLASS(wxDialog)
|
||||||
};
|
};
|
||||||
|
@@ -152,6 +152,7 @@ void wxDialog::Init()
|
|||||||
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
|
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
|
||||||
m_dialogToolBar = NULL;
|
m_dialogToolBar = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
m_hGripper = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDialog::Create(wxWindow *parent,
|
bool wxDialog::Create(wxWindow *parent,
|
||||||
@@ -183,6 +184,9 @@ bool wxDialog::Create(wxWindow *parent,
|
|||||||
CreateToolBar();
|
CreateToolBar();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if( HasFlag(wxRESIZE_BORDER) )
|
||||||
|
CreateGripper();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,6 +196,8 @@ wxDialog::~wxDialog()
|
|||||||
|
|
||||||
// this will also reenable all the other windows for a modal dialog
|
// this will also reenable all the other windows for a modal dialog
|
||||||
Show(false);
|
Show(false);
|
||||||
|
|
||||||
|
DestroyGripper();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -335,6 +341,75 @@ void wxDialog::EndModal(int retCode)
|
|||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxDialog gripper handling
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxDialog::SetWindowStyleFlag(long style)
|
||||||
|
{
|
||||||
|
wxDialogBase::SetWindowStyleFlag(style);
|
||||||
|
|
||||||
|
if( HasFlag(wxRESIZE_BORDER) )
|
||||||
|
CreateGripper();
|
||||||
|
else
|
||||||
|
DestroyGripper();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDialog::CreateGripper()
|
||||||
|
{
|
||||||
|
if( !m_hGripper )
|
||||||
|
{
|
||||||
|
m_hGripper = (WXHWND)::CreateWindow
|
||||||
|
(
|
||||||
|
wxT("SCROLLBAR"),
|
||||||
|
wxT(""),
|
||||||
|
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
|
||||||
|
SBS_SIZEGRIP |
|
||||||
|
SBS_SIZEBOX |
|
||||||
|
SBS_SIZEBOXBOTTOMRIGHTALIGN,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
GetHwnd(),
|
||||||
|
0,
|
||||||
|
wxGetInstance(),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
// position the gripper correctly after creation
|
||||||
|
ResizeGripper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDialog::DestroyGripper()
|
||||||
|
{
|
||||||
|
if ( m_hGripper )
|
||||||
|
{
|
||||||
|
::DestroyWindow((HWND) m_hGripper);
|
||||||
|
m_hGripper = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDialog::ShowGripper(bool show)
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( m_hGripper, _T("shouldn't be called if we have no gripper") );
|
||||||
|
|
||||||
|
::ShowWindow((HWND)m_hGripper, show ? SW_SHOW : SW_HIDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDialog::ResizeGripper()
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( m_hGripper, _T("shouldn't be called if we have no gripper") );
|
||||||
|
|
||||||
|
HWND hwndGripper = (HWND)m_hGripper;
|
||||||
|
|
||||||
|
const wxRect rectGripper = wxRectFromRECT(wxGetWindowRect(hwndGripper));
|
||||||
|
const wxSize size = GetClientSize() - rectGripper.GetSize();
|
||||||
|
|
||||||
|
::SetWindowPos(hwndGripper, HWND_BOTTOM,
|
||||||
|
size.x, size.y,
|
||||||
|
rectGripper.width, rectGripper.height,
|
||||||
|
SWP_NOACTIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxWin event handlers
|
// wxWin event handlers
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -416,6 +491,23 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
|
if ( m_hGripper )
|
||||||
|
{
|
||||||
|
switch ( wParam )
|
||||||
|
{
|
||||||
|
case SIZE_MAXIMIZED:
|
||||||
|
ShowGripper(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SIZE_RESTORED:
|
||||||
|
ShowGripper(true);
|
||||||
|
// fall through
|
||||||
|
|
||||||
|
default:
|
||||||
|
ResizeGripper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// the Windows dialogs unfortunately are not meant to be resizeable
|
// the Windows dialogs unfortunately are not meant to be resizeable
|
||||||
// at all and their standard class doesn't include CS_[VH]REDRAW
|
// at all and their standard class doesn't include CS_[VH]REDRAW
|
||||||
// styles which means that the window is not refreshed properly
|
// styles which means that the window is not refreshed properly
|
||||||
|
Reference in New Issue
Block a user