From 3011bf2bdce9f64a65f94ee741c9d1d163a29611 Mon Sep 17 00:00:00 2001 From: David Webster Date: Mon, 7 Jan 2002 00:44:31 +0000 Subject: [PATCH] Support for Toplevel window git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13428 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/checkbox.h | 125 ++++++++++++++++++++++++-------------- include/wx/os2/dialog.h | 45 ++++---------- include/wx/os2/frame.h | 39 ++---------- include/wx/os2/private.h | 12 ++++ include/wx/os2/window.h | 31 +++++----- 5 files changed, 125 insertions(+), 127 deletions(-) diff --git a/include/wx/os2/checkbox.h b/include/wx/os2/checkbox.h index 6079d5f80a..a8e7a2cb74 100644 --- a/include/wx/os2/checkbox.h +++ b/include/wx/os2/checkbox.h @@ -13,81 +13,116 @@ #define _WX_CHECKBOX_H_ #include "wx/control.h" - -WXDLLEXPORT_DATA(extern const char*) wxCheckBoxNameStr; + WXDLLEXPORT_DATA(extern const char*) wxCheckBoxNameStr; // Checkbox item (single checkbox) class WXDLLEXPORT wxBitmap; class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase { public: - inline wxCheckBox() { } - inline wxCheckBox(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, + inline wxCheckBox() { } + inline wxCheckBox( wxWindow* pParent + ,wxWindowID vId + ,const wxString& rsLabel + ,const wxPoint& rPos = wxDefaultPosition + ,const wxSize& rSize = wxDefaultSize + ,long lStyle = 0 +#if wxUSE_VALIDATORS + ,const wxValidator& rValidator = wxDefaultValidator +#endif + ,const wxString& rsName = wxCheckBoxNameStr + ) + { + Create( pParent + ,vId + ,rsLabel + ,rPos + ,rSize + ,lStyle #if wxUSE_VALIDATORS - const wxValidator& validator = wxDefaultValidator, + ,rValidator #endif - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } + ,rsName + ); + } - bool Create(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, + bool Create( wxWindow* pParent + ,wxWindowID vId + ,const wxString& rsLabel + ,const wxPoint& rPos = wxDefaultPosition + ,const wxSize& rSize = wxDefaultSize + ,long lStyle = 0 #if wxUSE_VALIDATORS - const wxValidator& validator = wxDefaultValidator, + ,const wxValidator& rValidator = wxDefaultValidator #endif - const wxString& name = wxCheckBoxNameStr); + ,const wxString& rsName = wxCheckBoxNameStr + ); - virtual void SetValue(bool); - virtual bool GetValue() const ; + virtual void SetValue(bool bValue); + virtual bool GetValue(void) const ; - virtual bool OS2Command(WXUINT param, WXWORD id); - virtual void SetLabel(const wxString& label); - virtual void Command(wxCommandEvent& event); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual bool OS2Command( WXUINT uParam + ,WXWORD wId + ); + virtual void SetLabel(const wxString& rsLabel); + virtual void Command(wxCommandEvent& rEvent); protected: - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize(void) const; private: DECLARE_DYNAMIC_CLASS(wxCheckBox) }; class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox { - DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) - public: - int checkWidth ; - int checkHeight ; - inline wxBitmapCheckBox() { checkWidth = -1; checkHeight = -1; } - inline wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, + inline wxBitmapCheckBox() { m_nCheckWidth = -1; m_nCheckHeight = -1; } + inline wxBitmapCheckBox( wxWindow* pParent + ,wxWindowID vId + ,const wxBitmap* pLabel + ,const wxPoint& rPos = wxDefaultPosition + ,const wxSize& rSize = wxDefaultSize + ,long lStyle = 0 #if wxUSE_VALIDATORS - const wxValidator& validator = wxDefaultValidator, + ,const wxValidator& rValidator = wxDefaultValidator #endif - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } + ,const wxString& rsName = wxCheckBoxNameStr + ) + { + Create( pParent + ,vId + ,pLabel + ,rPos + ,rSize + ,lStyle + ,rValidator + ,rsName + ); + } - bool Create(wxWindow *parent, wxWindowID id, const wxBitmap *bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, + bool Create( wxWindow* pParent + ,wxWindowID vId + ,const wxBitmap* pLabel + ,const wxPoint& rPos = wxDefaultPosition + ,const wxSize& rSize = wxDefaultSize + ,long lStyle = 0 #if wxUSE_VALIDATORS - const wxValidator& validator = wxDefaultValidator, + ,const wxValidator& rValidator = wxDefaultValidator #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: - virtual void SetLabel(const wxString& string) - { wxCheckBox::SetLabel(string); }; + + virtual void SetLabel(const wxString& rsString) + { wxCheckBox::SetLabel(rsString); }; + DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) }; #endif // _WX_CHECKBOX_H_ diff --git a/include/wx/os2/dialog.h b/include/wx/os2/dialog.h index 260a335ef1..0198cd9bfa 100644 --- a/include/wx/os2/dialog.h +++ b/include/wx/os2/dialog.h @@ -41,7 +41,6 @@ public: { long lModalStyle = lStyle ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; - bModal = FALSE; Create( pParent ,-1 ,rsTitle @@ -84,36 +83,30 @@ public: ); ~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; - // // For now, same as Show(TRUE) but returns return code - // - virtual int ShowModal(void); - virtual void EndModal(int nRetCode); + virtual int ShowModal(); + + // 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 // - bool IsModalShowing() const; - -#if WXWIN_COMPATIBILITY - bool Iconized() const { return IsIconized(); }; -#endif + bool IsModalShowing() const; // // Implementation only from now on // ------------------------------- // + // + // Override some base class virtuals + // + virtual bool Show(bool bShow); + // // Event handlers // @@ -121,10 +114,6 @@ public: void OnCharHook(wxKeyEvent& rEvent); void OnCloseWindow(wxCloseEvent& rEvent); - // - // May be called to terminate the dialog with the given return code - // - // // Standard buttons // @@ -144,17 +133,9 @@ public: ,WXWPARAM wParam ,WXLPARAM lParam ); + 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 // void DoShowModal(void); @@ -162,7 +143,7 @@ protected: // // Common part of all ctors // - void Init(); + void Init(void); private: wxWindow* m_pOldFocus; diff --git a/include/wx/os2/frame.h b/include/wx/os2/frame.h index 6f85949b97..13d290e76c 100644 --- a/include/wx/os2/frame.h +++ b/include/wx/os2/frame.h @@ -48,27 +48,18 @@ public: virtual ~wxFrame(); // 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 virtual void SetMenuBar(wxMenuBar* pMenubar); #endif - virtual void SetIcon(const wxIcon& rIcon); virtual bool ShowFullScreen( bool bShow ,long lStyle = wxFULLSCREEN_ALL ); - virtual bool IsFullScreen(void) const { return m_bFsIsShowing; }; // implementation only from now on // ------------------------------- - void AlterChildPos(void); - // override some more virtuals - virtual bool Show(bool bShow = TRUE); + virtual void Raise(void); // event handlers void OnActivate(wxActivateEvent& rEvent); @@ -125,18 +116,7 @@ public: ,WXHMENU hMenu ); - bool OS2Create( int nId - ,wxWindow* pParent - ,const wxChar* zWclass - ,wxWindow* pWxWin - ,const wxChar* zTitle - ,int nX - ,int nY - ,int nWidth - ,int nHeight - ,long nStyle - ); - + void SendSizeEvent(void); // tooltip management #if wxUSE_TOOLTIPS WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; } @@ -152,7 +132,6 @@ public: void SetClient(WXHWND c_Hwnd); void SetClient(wxWindow* c_Window); wxWindow *GetClient(); - HWND GetFrame(void) const { return m_hFrame; } friend MRESULT EXPENTRY wxFrameWndProc(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 void Init(void); - // common part of Iconize(), Maximize() and Restore() - void DoShowWindow(int nShowCmd); - + virtual WXHICON GetDefaultIcon(void) const; // override base class virtuals virtual void DoGetClientSize( int* pWidth ,int* pHeight ) const; - virtual void DoGetSize( int* pWidth - ,int* pHeight - ) const; - virtual void DoGetPosition( int* pX - ,int* pY - ) const; virtual void DoSetClientSize( int nWidth ,int nWeight ); + inline virtual bool IsMDIChild(void) const { return FALSE; } #if wxUSE_MENUS_NATIVE // helper @@ -229,7 +201,6 @@ private: // that we don't have child objects for (m_hWnd in wxWindow is the // handle of the Frame's client window! // - WXHWND m_hFrame; WXHWND m_hTitleBar; WXHWND m_hHScroll; WXHWND m_hVScroll; @@ -238,8 +209,6 @@ private: // Swp structures for various client data // DW: Better off in attached RefData? // - SWP m_vSwp; - SWP m_vSwpClient; SWP m_vSwpTitleBar; SWP m_vSwpMenuBar; SWP m_vSwpHScroll; diff --git a/include/wx/os2/private.h b/include/wx/os2/private.h index 17badf421f..5b29f6849f 100644 --- a/include/wx/os2/private.h +++ b/include/wx/os2/private.h @@ -232,10 +232,22 @@ inline bool wxStyleHasBorder(long style) 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 ,const wxFont& rFont ); +WXDLLEXPORT extern bool wxCheckWindowWndProc( WXHWND hWnd + ,WXFARPROC fnWndProc + ); + #endif // _WX_PRIVATE_H_ diff --git a/include/wx/os2/window.h b/include/wx/os2/window.h index 6508c25f6e..15267db307 100644 --- a/include/wx/os2/window.h +++ b/include/wx/os2/window.h @@ -23,6 +23,13 @@ #include +// --------------------------------------------------------------------------- +// forward declarations +// --------------------------------------------------------------------------- +#ifndef CW_USEDEFAULT +# define CW_USEDEFAULT ((int)0x80000000) +#endif + // --------------------------------------------------------------------------- // forward declarations // --------------------------------------------------------------------------- @@ -247,21 +254,15 @@ public: virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; // returns TRUE if the window has been created - bool OS2Create( WXHWND hParent - ,PSZ zClass - ,const wxChar* zTitle - ,WXDWORD dwStyle - ,long lX - ,long lY - ,long lWidth - ,long lHeight - ,WXHWND hOwner - ,WXHWND hZOrder - ,unsigned long lId - ,void* pCtlData = NULL - ,void* pPresParams = NULL - ,WXDWORD dwExStyle = 0L - ); + bool OS2Create( PSZ zClass + ,const char* zTitle + ,WXDWORD dwStyle + ,const wxPoint& rPos + ,const wxSize& rSize + ,void* pCtlData + ,WXDWORD dwExStyle + ,bool bIsChild + ); virtual bool OS2Command( WXUINT uParam ,WXWORD nId ); -- 2.45.2