added wxTLW for MSW
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -30,10 +30,10 @@ class WXDLLEXPORT wxDialogBase : public wxTopLevelWindow
|
||||
{
|
||||
public:
|
||||
wxDialogBase() { Init(); }
|
||||
~wxDialogBase() {}
|
||||
|
||||
virtual ~wxDialogBase() { }
|
||||
|
||||
void Init();
|
||||
|
||||
|
||||
// the modal dialogs have a return code - usually the id of the last
|
||||
// pressed button
|
||||
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
// lines into a vertical wxBoxSizer
|
||||
wxSizer *CreateTextSizer( const wxString &message );
|
||||
#endif // wxUSE_STATTEXT && wxUSE_TEXTCTRL
|
||||
|
||||
|
||||
#if wxUSE_BUTTON
|
||||
// places buttons into a horizontal wxBoxSizer
|
||||
wxSizer *CreateButtonSizer( long flags );
|
||||
@@ -55,10 +55,10 @@ protected:
|
||||
int m_returnCode;
|
||||
|
||||
// FIXME - temporary hack in absence of wxTLW !!
|
||||
#ifdef wxTopLevelWindowNative
|
||||
#ifdef wxTopLevelWindowNative
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_CONTROL_CONTAINER();
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dialog.h
|
||||
// Name: wx/msw/dialog.h
|
||||
// Purpose: wxDialog class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
@@ -56,15 +56,7 @@ public:
|
||||
long style = wxDEFAULT_DIALOG_STYLE,
|
||||
const wxString& name = wxDialogNameStr);
|
||||
|
||||
~wxDialog();
|
||||
|
||||
// override some base class virtuals
|
||||
virtual bool Destroy();
|
||||
virtual bool Show(bool show);
|
||||
virtual void Iconize(bool iconize);
|
||||
virtual bool IsIconized() const;
|
||||
|
||||
virtual bool IsTopLevel() const { return TRUE; }
|
||||
virtual ~wxDialog();
|
||||
|
||||
void SetModal(bool flag);
|
||||
virtual bool IsModal() const;
|
||||
@@ -78,16 +70,15 @@ public:
|
||||
// returns TRUE if we're in a modal loop
|
||||
bool IsModalShowing() const;
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
bool Iconized() const { return IsIconized(); };
|
||||
#endif
|
||||
|
||||
// wxMSW only: remove the "Close" button from the dialog
|
||||
bool EnableCloseButton(bool enable = TRUE);
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// override some base class virtuals
|
||||
virtual bool Show(bool show);
|
||||
|
||||
// event handlers
|
||||
bool OnClose();
|
||||
void OnCharHook(wxKeyEvent& event);
|
||||
@@ -110,10 +101,6 @@ public:
|
||||
#endif // wxUSE_CTL3D
|
||||
|
||||
protected:
|
||||
// override more base class virtuals
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
|
||||
// show modal dialog and enter modal loop
|
||||
void DoShowModal();
|
||||
|
||||
|
@@ -45,22 +45,13 @@ public:
|
||||
virtual ~wxFrameMSW();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual void Raise();
|
||||
virtual void Maximize(bool maximize = TRUE);
|
||||
virtual bool IsMaximized() const;
|
||||
virtual void Iconize(bool iconize = TRUE);
|
||||
virtual bool IsIconized() const;
|
||||
virtual void Restore();
|
||||
virtual void SetIcon(const wxIcon& icon);
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; };
|
||||
virtual void Raise();
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// override some more virtuals
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
// event handlers
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
@@ -124,14 +115,8 @@ protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// common part of Iconize(), Maximize() and Restore()
|
||||
void DoShowWindow(int nShowCmd);
|
||||
|
||||
// override base class virtuals
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
@@ -154,14 +139,8 @@ protected:
|
||||
|
||||
virtual bool IsMDIChild() const { return FALSE; }
|
||||
|
||||
// is the frame currently iconized?
|
||||
bool m_iconized;
|
||||
|
||||
// should the frame be maximized when it will be shown? set by Maximize()
|
||||
// when it is called while the frame is hidden
|
||||
bool m_maximizeOnShow;
|
||||
|
||||
WXHICON m_defaultIcon;
|
||||
// get default (wxWindows) icon for the frame
|
||||
virtual WXHICON GetDefaultIcon() const;
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
static bool m_useNativeStatusBar;
|
||||
|
@@ -30,8 +30,6 @@ class WXDLLEXPORT wxMDIChildFrame;
|
||||
|
||||
class WXDLLEXPORT wxMDIParentFrame : public wxFrame
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
|
||||
public:
|
||||
wxMDIParentFrame();
|
||||
wxMDIParentFrame(wxWindow *parent,
|
||||
@@ -102,6 +100,8 @@ protected:
|
||||
virtual void InternalSetMenuBar();
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual WXHICON GetDefaultIcon() const;
|
||||
|
||||
wxMDIClientWindow * m_clientWindow;
|
||||
wxMDIChildFrame * m_currentChild;
|
||||
wxMenu* m_windowMenu;
|
||||
@@ -113,6 +113,7 @@ private:
|
||||
friend class WXDLLEXPORT wxMDIChildFrame;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -178,6 +179,8 @@ protected:
|
||||
virtual void InternalSetMenuBar();
|
||||
virtual bool IsMDIChild() const { return TRUE; }
|
||||
|
||||
virtual WXHICON GetDefaultIcon() const;
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
|
@@ -248,6 +248,38 @@ inline bool wxIsCtrlDown()
|
||||
return (::GetKeyState(VK_CONTROL) & 0x100) != 0;
|
||||
}
|
||||
|
||||
// wrapper around GetWindowRect() and GetClientRect() APIs doing error checking
|
||||
// for Win32
|
||||
inline RECT wxGetWindowRect(HWND hwnd)
|
||||
{
|
||||
RECT rect;
|
||||
#ifdef __WIN16__
|
||||
::GetWindowRect(hwnd, &rect);
|
||||
#else // Win32
|
||||
if ( !::GetWindowRect(hwnd, &rect) )
|
||||
{
|
||||
wxLogLastError(_T("GetWindowRect"));
|
||||
}
|
||||
#endif // Win16/32
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
inline RECT wxGetClientRect(HWND hwnd)
|
||||
{
|
||||
RECT rect;
|
||||
#ifdef __WIN16__
|
||||
::GetClientRect(hwnd, &rect);
|
||||
#else // Win32
|
||||
if ( !::GetClientRect(hwnd, &rect) )
|
||||
{
|
||||
wxLogLastError(_T("GetClientRect"));
|
||||
}
|
||||
#endif // Win16/32
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// small helper classes
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -357,8 +389,8 @@ WXDLLEXPORT extern WXWORD wxGetWindowId(WXHWND hWnd);
|
||||
// Does this window style specify any border?
|
||||
inline bool wxStyleHasBorder(long style)
|
||||
{
|
||||
return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER |
|
||||
wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
|
||||
return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER |
|
||||
wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
|
||||
}
|
||||
|
||||
// find the window for HWND which is part of some wxWindow, returns just the
|
||||
|
87
include/wx/msw/toplevel.h
Normal file
87
include/wx/msw/toplevel.h
Normal file
@@ -0,0 +1,87 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/toplevel.h
|
||||
// Purpose: wxTopLevelWindowMSW is the MSW implementation of wxTLW
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 20.09.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MSW_TOPLEVEL_H_
|
||||
#define _WX_MSW_TOPLEVEL_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "toplevel.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTopLevelWindowMSW
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxTopLevelWindowMSW : public wxTopLevelWindowBase
|
||||
{
|
||||
public:
|
||||
// constructors and such
|
||||
wxTopLevelWindowMSW() { Init(); }
|
||||
|
||||
wxTopLevelWindowMSW(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxTopLevelWindowMSW();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual void Maximize(bool maximize = TRUE);
|
||||
virtual bool IsMaximized() const;
|
||||
virtual void Iconize(bool iconize = TRUE);
|
||||
virtual bool IsIconized() const;
|
||||
virtual void SetIcon(const wxIcon& icon);
|
||||
virtual void Restore();
|
||||
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// common part of Iconize(), Maximize() and Restore()
|
||||
void DoShowWindow(int nShowCmd);
|
||||
|
||||
// implement the geometry-related methods for a top level window
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
// is the frame currently iconized?
|
||||
bool m_iconized;
|
||||
|
||||
// should the frame be maximized when it will be shown? set by Maximize()
|
||||
// when it is called while the frame is hidden
|
||||
bool m_maximizeOnShow;
|
||||
};
|
||||
|
||||
// list of all frames and modeless dialogs
|
||||
extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows;
|
||||
|
||||
#endif // _WX_MSW_TOPLEVEL_H_
|
||||
|
@@ -52,10 +52,7 @@ class WXDLLEXPORT wxTopLevelWindowBase : public wxWindow
|
||||
public:
|
||||
// construction
|
||||
wxTopLevelWindowBase();
|
||||
#ifdef __DARWIN__
|
||||
virtual ~wxTopLevelWindowBase() {}
|
||||
#endif
|
||||
|
||||
|
||||
// top level wnd state
|
||||
// --------------------
|
||||
|
||||
@@ -108,6 +105,10 @@ public:
|
||||
// so should be there for all platforms
|
||||
void OnActivate(wxActivateEvent &WXUNUSED(event)) { }
|
||||
|
||||
#ifdef __DARWIN__
|
||||
virtual ~wxTopLevelWindowBase() {}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// the frame client to screen translation should take account of the
|
||||
// toolbar which may shift the origin of the client area
|
||||
@@ -129,7 +130,10 @@ protected:
|
||||
|
||||
|
||||
// include the real class declaration
|
||||
#if defined(__WXGTK__)
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/toplevel.h"
|
||||
#define wxTopLevelWindowNative wxTopLevelWindowMSW
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/toplevel.h"
|
||||
#define wxTopLevelWindowNative wxTopLevelWindowGTK
|
||||
#elif defined(__WXMGL__)
|
||||
|
Reference in New Issue
Block a user