More wxFrame updates

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 2000-02-17 23:31:03 +00:00
parent c692969f82
commit 80d83cbcc2
3 changed files with 202 additions and 141 deletions

View File

@ -53,7 +53,7 @@ public:
virtual bool ShowFullScreen( bool bShow virtual bool ShowFullScreen( bool bShow
,long lStyle = wxFULLSCREEN_ALL ,long lStyle = wxFULLSCREEN_ALL
); );
virtual bool IsFullScreen(void) const { return m_fsIsShowing; }; virtual bool IsFullScreen(void) const { return m_bFfsIsShowing; };
// implementation only from now on // implementation only from now on
@ -91,9 +91,9 @@ public:
// TODO: should this go into a wxFrameworkSettings class perhaps? // TODO: should this go into a wxFrameworkSettings class perhaps?
static void UseNativeStatusBar(bool bUseNative) static void UseNativeStatusBar(bool bUseNative)
{ m_useNativeStatusBar = useNative; }; { m_bUseNativeStatusBar = bUseNative; };
static bool UsesNativeStatusBar() static bool UsesNativeStatusBar()
{ return m_useNativeStatusBar; }; { return m_bUseNativeStatusBar; };
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
WXHMENU GetWinMenu() const { return m_hMenu; } WXHMENU GetWinMenu() const { return m_hMenu; }
@ -131,8 +131,8 @@ public:
// tooltip management // tooltip management
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
WXHWND GetToolTipCtrl(void) const { return m_hwndToolTip; } WXHWND GetToolTipCtrl(void) const { return m_hHwndToolTip; }
void SetToolTipCtrl(WXHWND hHwndTT) { m_hwndToolTip = hwndTT; } void SetToolTipCtrl(WXHWND hHwndTT) { m_hHwndToolTip = hHwndTT; }
#endif // tooltips #endif // tooltips
protected: protected:
@ -194,7 +194,7 @@ protected:
private: private:
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
WXHWND m_hHwndToolTip; WXHWND m_hWndToolTip;
#endif // tooltips #endif // tooltips
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -77,10 +77,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
void wxFrame::Init() void wxFrame::Init()
{ {
m_iconized = FALSE; m_bIconized = FALSE;
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
m_hwndToolTip = 0; m_hHwndToolTip = 0;
#endif #endif
// Data to save/restore when calling ShowFullScreen // Data to save/restore when calling ShowFullScreen
m_lFsStyle = 0L; m_lFsStyle = 0L;
@ -106,7 +106,6 @@ bool wxFrame::Create(
int nY = rPos.y; int nY = rPos.y;
int nWidth = rSize.x; int nWidth = rSize.x;
int nHeight = rSize.y; int nHeight = rSize.y;
SWP vSwp;
SetName(rsName); SetName(rsName);
m_windowStyle = lStyle; m_windowStyle = lStyle;
@ -121,14 +120,14 @@ bool wxFrame::Create(
else else
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();
if (pParent) if (pParent)
pParent->AddChild(this); pParent->AddChild(this);
m_bIconized = FALSE; m_bIconized = FALSE;
// //
// We pass NULL as parent to MSWCreate because frames with parents behave // We pass NULL as parent to MSWCreate because frames with parents behave
// very strangely under Win95 shell. // very strangely under Win95 shell.
// Alteration by JACS: keep normal Windows behaviour (float on top of parent) // Alteration by JACS: keep normal Windows behaviour (float on top of parent)
// with this style. // with this style.
// //
@ -167,7 +166,7 @@ wxFrame::~wxFrame()
if (wxTheApp->GetExitOnFrameDelete()) if (wxTheApp->GetExitOnFrameDelete())
{ {
::WinPostMsg(m_hwnd, WM_QUIT, 0, 0); ::WinPostMsg(GetHwnd(), WM_QUIT, 0, 0);
} }
} }
wxModelessWindows.DeleteObject(this); wxModelessWindows.DeleteObject(this);
@ -184,16 +183,13 @@ wxFrame::~wxFrame()
{ {
if (GetParent() && GetParent()->GetHWND()) if (GetParent() && GetParent()->GetHWND())
{ {
::WinQueryWindowPos( (HWND) GetParent()->GetHWND()
,&vSwp
);
::WinSetWindowPos( (HWND) GetParent()->GetHWND() ::WinSetWindowPos( (HWND) GetParent()->GetHWND()
,HWND_TOP ,HWND_TOP
,vSwp.x ,0
,vSwp.y ,0
,vSwp.cx ,0
,vSwp,cy ,0
,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW ,SWP_ZORDER
); );
} }
} }
@ -202,180 +198,245 @@ wxFrame::~wxFrame()
// //
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc. // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
// //
void wxFrame::DoGetClientSize(int *x, int *y) const void wxFrame::DoGetClientSize(
int* pX
, int* pY
) const
{ {
// TODO: //
/* // OS/2 PM's coordinates go from bottom-left not
RECT rect; // top-left thus the += instead of the -=
::GetClientRect(GetHwnd(), &rect); //
RECTL vRect;
HWND hWndClient;
//
// PM has no GetClientRect that inherantly knows about the client window
// We have to explicitly go fetch it!
//
hWndClient = ::WinWindowFromId(GetHwnd(), FID_CLIENT);
::WinQueryWindowRect(hWndClient, &vRect);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
if ( GetStatusBar() ) if ( GetStatusBar() )
{ {
int statusX, statusY; int nStatusX
GetStatusBar()->GetClientSize(&statusX, &statusY); int nStatusY;
rect.bottom -= statusY;
} GetStatusBar()->GetClientSize( &nStatusX
,&nStatusY
);
vRect.yBottom += nStatusY;
}
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
wxPoint pt(GetClientAreaOrigin()); wxPoint vPoint(GetClientAreaOrigin());
rect.bottom -= pt.y;
rect.right -= pt.x; vRect.bottom += pt.y;
vRect.right -= pt.x;
if ( x ) if (pX)
*x = rect.right; *pX = vRect.xRight;
if ( y ) if (pY)
*y = rect.bottom; *pY = vRect.yBottom;
*/ } // end of wxFrame::DoGetClientSize
}
//
// Set the client size (i.e. leave the calculation of borders etc. // Set the client size (i.e. leave the calculation of borders etc.
// to wxWindows) // to wxWindows)
void wxFrame::DoSetClientSize(int width, int height) //
void wxFrame::DoSetClientSize(
int nWidth
, int nHeight
)
{ {
HWND hWnd = GetHwnd(); HWND hWnd = GetHwnd();
HWND hWndClient;
RECTL vRect;
RECT vRect2;
// TODO: hWndClient = ::WinWindowFromId(GetHwnd(), FID_CLIENT);
/* ::WinQueryWindowRect(hWndClient, &vRect);
RECT rect;
::GetClientRect(hWnd, &rect);
RECT rect2; ::WinQueryWindowRect(hWnd, &vRect2);
GetWindowRect(hWnd, &rect2);
// Find the difference between the entire window (title bar and all) //
// and the client area; add this to the new client size to move the // Find the difference between the entire window (title bar and all)
// window // and the client area; add this to the new client size to move the
int actual_width = rect2.right - rect2.left - rect.right + width; // window. Remember OS/2's backwards y coord system!
int actual_height = rect2.bottom - rect2.top - rect.bottom + height; //
int nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
int nActualHeight = vRect2.yTop + vRect2.yTop - vRect.yTop + nHeight;
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
if ( GetStatusBar() ) if ( GetStatusBar() )
{ {
int statusX, statusY; int nStatusX;
GetStatusBar()->GetClientSize(&statusX, &statusY); int nStatusY;
actual_height += statusY;
} GetStatusBar()->GetClientSize( &nStatusX
,&nStatusY
);
nActualHeight += nStatusY;
}
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
wxPoint pt(GetClientAreaOrigin()); wxPoint vPoint(GetClientAreaOrigin());
actual_width += pt.y; nActualWidth += vPoint.y;
actual_height += pt.x; nActualHeight += vPoint.x;
POINT point; POINTL vPointl;
point.x = rect2.left;
point.y = rect2.top;
MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)TRUE); vPointl.x = vRect2.xLeft;
vPoint.y = vRect2.yTop;
wxSizeEvent event(wxSize(width, height), m_windowId); ::WinSetWindowPos( hWnd
event.SetEventObject( this ); ,HWND_TOP
GetEventHandler()->ProcessEvent(event); ,vPointl.x
*/ ,vPointl.y
} ,nActualWidth
,nActualHeight
,SWP_MOVE | SWP_SIZE | SWP_SHOW
);
void wxFrame::DoGetSize(int *width, int *height) const wxSizeEvent vEvent( wxSize( nWidth
,nHeight
)
,m_windowId
);
vEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(vEvent);
} // end of wxFrame::DoSetClientSize
void wxFrame::DoGetSize(
int* pWidth
, int* pHeight
) const
{ {
// TODO: RECTL vRect;
/*
RECT rect;
GetWindowRect(GetHwnd(), &rect);
*width = rect.right - rect.left;
*height = rect.bottom - rect.top;
*/
}
void wxFrame::DoGetPosition(int *x, int *y) const ::WinQueryWindowRect(GetHwnd(), &vRect);
*pWidth = vRect.xRight - vRect.xLeft;
*pHeight = vRect.yTop - vRect.yBottom;
} // end of wxFrame::DoGetSize
void wxFrame::DoGetPosition(
int* pX
, int* pY
) const
{ {
// TODO: RECTL vRect;
/* POINT vPoint;
RECT rect;
GetWindowRect(GetHwnd(), &rect);
POINT point;
point.x = rect.left;
point.y = rect.top;
*x = point.x; ::WinQueryWindowRect(GetHwnd(), &vRect);
*y = point.y; vPoint.x = vRect.xLeft;
*/
} //
// OS/2 is backwards [WIN32 it is vRect.yTop]
//
vPoint.y = vRect.yBottom;
*pX = vPoint.x;
*pY = vPoint.y;
} // end of wxFrame::DoGetPosition
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// variations around ::ShowWindow() // variations around ::ShowWindow()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxFrame::DoShowWindow(int nShowCmd) void wxFrame::DoShowWindow(
int nShowCmd
)
{ {
// TODO: ::WinShowWindow(GetHwnd(), nShowCmd);
/* m_bIconized = nShowCmd == SWP_MINIMIZE;
::ShowWindow(GetHwnd(), nShowCmd); } // end of wxFrame::DoShowWindow
m_iconized = nShowCmd == SW_MINIMIZE; bool wxFrame::Show(
*/ bool bShow
} )
bool wxFrame::Show(bool show)
{ {
// TODO: DoShowWindow(show ? SWP_SHOW : SW_HIDE);
/*
DoShowWindow(show ? SW_SHOW : SW_HIDE);
if ( show ) if (bShow)
{ {
::BringWindowToTop(GetHwnd()); wxActivateEvent vEvent(wxEVT_ACTIVATE, TRUE, m_windowId);
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId); ::WinSetWindowPos( (HWND) GetHWND()
event.SetEventObject( this ); ,HWND_TOP
GetEventHandler()->ProcessEvent(event); ,0
,0
,0
,0
,SWP_ZORDER
);
vEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(vEvent);
} }
else else
{ {
//
// Try to highlight the correct window (the parent) // Try to highlight the correct window (the parent)
if ( GetParent() ) //
if (GetParent())
{ {
HWND hWndParent = GetHwndOf(GetParent()); HWND hWndParent = GetHwndOf(GetParent());
if (hWndParent) if (hWndParent)
::BringWindowToTop(hWndParent); ::WinSetWindowPos( hWndParent
,HWND_TOP
,0
,0
,0
,0
,SWP_ZORDER
);
} }
} }
*/
return TRUE; return TRUE;
} } // end of wxFrame::Show
void wxFrame::Iconize(bool iconize) void wxFrame::Iconize(
bool bIconize
)
{ {
// DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE); DoShowWindow(bIconize ? SWP_MINIMIZE : SWP_RESTORE);
} } // end of wxFrame::Iconize
void wxFrame::Maximize(bool maximize) void wxFrame::Maximize(
bool bMaximize)
{ {
// DoShowWindow(maximize ? SW_MAXIMIZE : SW_RESTORE); DoShowWindow(bMaximize ? SWP_MAXIMIZE : SWP_RESTORE);
} } // end of wxFrame::Maximize
void wxFrame::Restore() void wxFrame::Restore()
{ {
// DoShowWindow(SW_RESTORE); DoShowWindow(SWP_RESTORE);
} } // end of wxFrame::Restore
bool wxFrame::IsIconized() const bool wxFrame::IsIconized() const
{ {
// TODO: SWP vSwp;
/* bool bIconic;
((wxFrame *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0);
return m_iconized; ::WinQueryWindowPos(GetHwnd(), &vSwp)
*/
return FALSE; if (vSwp.fl & SWP_MINIMIZE)
} ((wxFrame*)this)->m_bIconized = TRUE;
else
((wxFrame*)this)->m_bIconized = FALSE;
return m_bIconized;
} // end of wxFrame::IsIconized
// Is it maximized? // Is it maximized?
bool wxFrame::IsMaximized() const bool wxFrame::IsMaximized() const
{ {
// TODO: SWP vSwp;
/* bool bIconic;
return (::IsZoomed(GetHwnd()) != 0);
*/ ::WinQueryWindowPos(GetHwnd(), &vSwp)
return FALSE; return (vSwp.fl & SWP_MAXIMIZE);
} } // end of wxFrame::IsMaximized
void wxFrame::SetIcon(const wxIcon& icon) void wxFrame::SetIcon(const wxIcon& icon)
{ {
@ -497,7 +558,7 @@ bool wxFrame::OS2Create(int id, wxWindow *parent, const wxChar *wclass, wxWindow
int x, int y, int width, int height, long style) int x, int y, int width, int height, long style)
{ {
m_defaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON); m_hDefaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON);
// If child windows aren't properly drawn initially, WS_CLIPCHILDREN // If child windows aren't properly drawn initially, WS_CLIPCHILDREN
// could be the culprit. But without it, you can get a lot of flicker. // could be the culprit. But without it, you can get a lot of flicker.

View File

@ -127,7 +127,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
long style, long style,
const wxString& name) const wxString& name)
{ {
m_defaultIcon = (WXHICON) (wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON : wxDEFAULT_MDIPARENTFRAME_ICON); m_hDefaultIcon = (WXHICON) (wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON : wxDEFAULT_MDIPARENTFRAME_ICON);
m_clientWindow = NULL; m_clientWindow = NULL;
m_currentChild = NULL; m_currentChild = NULL;
@ -375,7 +375,7 @@ MRESULT wxMDIParentFrame::OS2WindowProc(HWND hwnd,
} }
*/ */
if ( !processed ) if ( !processed )
rc = wxFrame::OS2WindowProc(hwnd, message, wParam, lParam); rc = wxFrame::OS2WindowProc(message, wParam, lParam);
return rc; return rc;
} }
@ -559,8 +559,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
long style, long style,
const wxString& name) const wxString& name)
{ {
m_defaultIcon = (WXHICON)(wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON m_hDefaultIcon = (WXHICON)(wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON
: wxDEFAULT_MDICHILDFRAME_ICON); : wxDEFAULT_MDICHILDFRAME_ICON);
SetName(name); SetName(name);
@ -836,7 +836,7 @@ MRESULT wxMDIChildFrame::OS2WindowProc(HWND hwnd,
} }
*/ */
if ( !processed ) if ( !processed )
rc = wxFrame::OS2WindowProc(hwnd, message, wParam, lParam); rc = wxFrame::OS2WindowProc(message, wParam, lParam);
return rc; return rc;
} }