Support for Toplevel window

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13428 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2002-01-07 00:44:31 +00:00
parent c9782ca3af
commit 3011bf2bdc
5 changed files with 126 additions and 128 deletions

View File

@@ -13,8 +13,7 @@
#define _WX_CHECKBOX_H_ #define _WX_CHECKBOX_H_
#include "wx/control.h" #include "wx/control.h"
WXDLLEXPORT_DATA(extern const char*) wxCheckBoxNameStr;
WXDLLEXPORT_DATA(extern const char*) wxCheckBoxNameStr;
// Checkbox item (single checkbox) // Checkbox item (single checkbox)
class WXDLLEXPORT wxBitmap; class WXDLLEXPORT wxBitmap;
@@ -22,72 +21,108 @@ class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase
{ {
public: public:
inline wxCheckBox() { } inline wxCheckBox() { }
inline wxCheckBox(wxWindow *parent, wxWindowID id, const wxString& label, inline wxCheckBox( wxWindow* pParent
const wxPoint& pos = wxDefaultPosition, ,wxWindowID vId
const wxSize& size = wxDefaultSize, long style = 0, ,const wxString& rsLabel
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = 0
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
const wxValidator& validator = wxDefaultValidator, ,const wxValidator& rValidator = wxDefaultValidator
#endif #endif
const wxString& name = wxCheckBoxNameStr) ,const wxString& rsName = wxCheckBoxNameStr
)
{ {
Create(parent, id, label, pos, size, style, validator, name); Create( pParent
,vId
,rsLabel
,rPos
,rSize
,lStyle
#if wxUSE_VALIDATORS
,rValidator
#endif
,rsName
);
} }
bool Create(wxWindow *parent, wxWindowID id, const wxString& label, bool Create( wxWindow* pParent
const wxPoint& pos = wxDefaultPosition, ,wxWindowID vId
const wxSize& size = wxDefaultSize, long style = 0, ,const wxString& rsLabel
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = 0
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
const wxValidator& validator = wxDefaultValidator, ,const wxValidator& rValidator = wxDefaultValidator
#endif #endif
const wxString& name = wxCheckBoxNameStr); ,const wxString& rsName = wxCheckBoxNameStr
);
virtual void SetValue(bool); virtual void SetValue(bool bValue);
virtual bool GetValue() const ; virtual bool GetValue(void) const ;
virtual bool OS2Command(WXUINT param, WXWORD id); virtual bool OS2Command( WXUINT uParam
virtual void SetLabel(const wxString& label); ,WXWORD wId
virtual void Command(wxCommandEvent& event); );
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, virtual void SetLabel(const wxString& rsLabel);
WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual void Command(wxCommandEvent& rEvent);
protected: protected:
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize(void) const;
private: private:
DECLARE_DYNAMIC_CLASS(wxCheckBox) DECLARE_DYNAMIC_CLASS(wxCheckBox)
}; };
class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox
{ {
DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox)
public: public:
int checkWidth ;
int checkHeight ;
inline wxBitmapCheckBox() { checkWidth = -1; checkHeight = -1; } inline wxBitmapCheckBox() { m_nCheckWidth = -1; m_nCheckHeight = -1; }
inline wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label, inline wxBitmapCheckBox( wxWindow* pParent
const wxPoint& pos = wxDefaultPosition, ,wxWindowID vId
const wxSize& size = wxDefaultSize, long style = 0, ,const wxBitmap* pLabel
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = 0
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
const wxValidator& validator = wxDefaultValidator, ,const wxValidator& rValidator = wxDefaultValidator
#endif #endif
const wxString& name = wxCheckBoxNameStr) ,const wxString& rsName = wxCheckBoxNameStr
)
{ {
Create(parent, id, label, pos, size, style, validator, name); Create( pParent
,vId
,pLabel
,rPos
,rSize
,lStyle
,rValidator
,rsName
);
} }
bool Create(wxWindow *parent, wxWindowID id, const wxBitmap *bitmap, bool Create( wxWindow* pParent
const wxPoint& pos = wxDefaultPosition, ,wxWindowID vId
const wxSize& size = wxDefaultSize, long style = 0, ,const wxBitmap* pLabel
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = 0
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
const wxValidator& validator = wxDefaultValidator, ,const wxValidator& rValidator = wxDefaultValidator
#endif #endif
const wxString& name = wxCheckBoxNameStr); ,const wxString& rsName = wxCheckBoxNameStr
);
virtual void SetLabel(const wxBitmap& rBitmap);
int m_nCheckWidth;
int m_nCheckHeight;
virtual void SetLabel(const wxBitmap& bitmap);
private: private:
virtual void SetLabel(const wxString& string)
{ wxCheckBox::SetLabel(string); }; virtual void SetLabel(const wxString& rsString)
{ wxCheckBox::SetLabel(rsString); };
DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox)
}; };
#endif #endif
// _WX_CHECKBOX_H_ // _WX_CHECKBOX_H_

View File

@@ -41,7 +41,6 @@ public:
{ {
long lModalStyle = lStyle ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; long lModalStyle = lStyle ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
bModal = FALSE;
Create( pParent Create( pParent
,-1 ,-1
,rsTitle ,rsTitle
@@ -84,36 +83,30 @@ public:
); );
~wxDialog(); ~wxDialog();
virtual bool Destroy(void);
virtual bool Show(bool bShow);
virtual void Iconize(bool bIconize);
virtual bool IsIconized(void) const;
virtual bool IsTopLevel(void) const { return TRUE; }
void SetModal(bool bFlag); void SetModal(bool bFlag);
virtual bool IsModal(void) const; virtual bool IsModal(void) const;
//
// For now, same as Show(TRUE) but returns return code // For now, same as Show(TRUE) but returns return code
// virtual int ShowModal();
virtual int ShowModal(void);
virtual void EndModal(int nRetCode); // may be called to terminate the dialog with the given return code
virtual void EndModal(int retCode);
// //
// Returns TRUE if we're in a modal loop // Returns TRUE if we're in a modal loop
// //
bool IsModalShowing() const; bool IsModalShowing() const;
#if WXWIN_COMPATIBILITY
bool Iconized() const { return IsIconized(); };
#endif
// //
// Implementation only from now on // Implementation only from now on
// ------------------------------- // -------------------------------
// //
//
// Override some base class virtuals
//
virtual bool Show(bool bShow);
// //
// Event handlers // Event handlers
// //
@@ -121,10 +114,6 @@ public:
void OnCharHook(wxKeyEvent& rEvent); void OnCharHook(wxKeyEvent& rEvent);
void OnCloseWindow(wxCloseEvent& rEvent); void OnCloseWindow(wxCloseEvent& rEvent);
//
// May be called to terminate the dialog with the given return code
//
// //
// Standard buttons // Standard buttons
// //
@@ -144,17 +133,9 @@ public:
,WXWPARAM wParam ,WXWPARAM wParam
,WXLPARAM lParam ,WXLPARAM lParam
); );
protected: protected:
// //
// Override more base class virtuals
//
virtual void DoSetClientSize( int nWidth
,int nHeight
);
virtual void DoGetPosition( int* pnX
,int* pnY
) const;
//
// Show modal dialog and enter modal loop // Show modal dialog and enter modal loop
// //
void DoShowModal(void); void DoShowModal(void);
@@ -162,7 +143,7 @@ protected:
// //
// Common part of all ctors // Common part of all ctors
// //
void Init(); void Init(void);
private: private:
wxWindow* m_pOldFocus; wxWindow* m_pOldFocus;

View File

@@ -48,27 +48,18 @@ public:
virtual ~wxFrame(); virtual ~wxFrame();
// implement base class pure virtuals // implement base class pure virtuals
virtual void Maximize(bool bMaximize = TRUE);
virtual bool IsMaximized(void) const;
virtual void Iconize(bool bIconize = TRUE);
virtual bool IsIconized(void) const;
virtual void Restore(void);
#if wxUSE_MENUS_NATIVE #if wxUSE_MENUS_NATIVE
virtual void SetMenuBar(wxMenuBar* pMenubar); virtual void SetMenuBar(wxMenuBar* pMenubar);
#endif #endif
virtual void SetIcon(const wxIcon& rIcon);
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_bFsIsShowing; };
// implementation only from now on // implementation only from now on
// ------------------------------- // -------------------------------
void AlterChildPos(void); virtual void Raise(void);
// override some more virtuals
virtual bool Show(bool bShow = TRUE);
// event handlers // event handlers
void OnActivate(wxActivateEvent& rEvent); void OnActivate(wxActivateEvent& rEvent);
@@ -125,18 +116,7 @@ public:
,WXHMENU hMenu ,WXHMENU hMenu
); );
bool OS2Create( int nId void SendSizeEvent(void);
,wxWindow* pParent
,const wxChar* zWclass
,wxWindow* pWxWin
,const wxChar* zTitle
,int nX
,int nY
,int nWidth
,int nHeight
,long nStyle
);
// tooltip management // tooltip management
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; } WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; }
@@ -152,7 +132,6 @@ public:
void SetClient(WXHWND c_Hwnd); void SetClient(WXHWND c_Hwnd);
void SetClient(wxWindow* c_Window); void SetClient(wxWindow* c_Window);
wxWindow *GetClient(); wxWindow *GetClient();
HWND GetFrame(void) const { return m_hFrame; }
friend MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam); friend MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
friend MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam); friend MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
@@ -161,22 +140,15 @@ protected:
// common part of all ctors // common part of all ctors
void Init(void); void Init(void);
// common part of Iconize(), Maximize() and Restore() virtual WXHICON GetDefaultIcon(void) const;
void DoShowWindow(int nShowCmd);
// override base class virtuals // override base class virtuals
virtual void DoGetClientSize( int* pWidth virtual void DoGetClientSize( int* pWidth
,int* pHeight ,int* pHeight
) const; ) const;
virtual void DoGetSize( int* pWidth
,int* pHeight
) const;
virtual void DoGetPosition( int* pX
,int* pY
) const;
virtual void DoSetClientSize( int nWidth virtual void DoSetClientSize( int nWidth
,int nWeight ,int nWeight
); );
inline virtual bool IsMDIChild(void) const { return FALSE; }
#if wxUSE_MENUS_NATIVE #if wxUSE_MENUS_NATIVE
// helper // helper
@@ -229,7 +201,6 @@ private:
// that we don't have child objects for (m_hWnd in wxWindow is the // that we don't have child objects for (m_hWnd in wxWindow is the
// handle of the Frame's client window! // handle of the Frame's client window!
// //
WXHWND m_hFrame;
WXHWND m_hTitleBar; WXHWND m_hTitleBar;
WXHWND m_hHScroll; WXHWND m_hHScroll;
WXHWND m_hVScroll; WXHWND m_hVScroll;
@@ -238,8 +209,6 @@ private:
// Swp structures for various client data // Swp structures for various client data
// DW: Better off in attached RefData? // DW: Better off in attached RefData?
// //
SWP m_vSwp;
SWP m_vSwpClient;
SWP m_vSwpTitleBar; SWP m_vSwpTitleBar;
SWP m_vSwpMenuBar; SWP m_vSwpMenuBar;
SWP m_vSwpHScroll; SWP m_vSwpHScroll;

View File

@@ -232,10 +232,22 @@ inline bool wxStyleHasBorder(long style)
wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0; wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
} }
inline RECTL wxGetWindowRect(HWND hWnd)
{
RECTL vRect;
::WinQueryWindowRect(hWnd, &vRect);
return vRect;
} // end of wxGetWindowRect
WXDLLEXPORT extern void wxOS2SetFont( HWND hWnd WXDLLEXPORT extern void wxOS2SetFont( HWND hWnd
,const wxFont& rFont ,const wxFont& rFont
); );
WXDLLEXPORT extern bool wxCheckWindowWndProc( WXHWND hWnd
,WXFARPROC fnWndProc
);
#endif #endif
// _WX_PRIVATE_H_ // _WX_PRIVATE_H_

View File

@@ -23,6 +23,13 @@
#include <os2.h> #include <os2.h>
// ---------------------------------------------------------------------------
// forward declarations
// ---------------------------------------------------------------------------
#ifndef CW_USEDEFAULT
# define CW_USEDEFAULT ((int)0x80000000)
#endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// forward declarations // forward declarations
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -247,20 +254,14 @@ public:
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
// returns TRUE if the window has been created // returns TRUE if the window has been created
bool OS2Create( WXHWND hParent bool OS2Create( PSZ zClass
,PSZ zClass ,const char* zTitle
,const wxChar* zTitle
,WXDWORD dwStyle ,WXDWORD dwStyle
,long lX ,const wxPoint& rPos
,long lY ,const wxSize& rSize
,long lWidth ,void* pCtlData
,long lHeight ,WXDWORD dwExStyle
,WXHWND hOwner ,bool bIsChild
,WXHWND hZOrder
,unsigned long lId
,void* pCtlData = NULL
,void* pPresParams = NULL
,WXDWORD dwExStyle = 0L
); );
virtual bool OS2Command( WXUINT uParam virtual bool OS2Command( WXUINT uParam
,WXWORD nId ,WXWORD nId