]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/os2/window.h
fixed bug with the caret positioning after SetValue() introduced by the last commit
[wxWidgets.git] / include / wx / os2 / window.h
index 3688662527630fb67d9dec7e6ec385414b665511..a230da8ad271b05d4ac08244a71f40a0a91c149b 100644 (file)
@@ -44,20 +44,21 @@ enum
 // wxWindow declaration for OS/2 PM
 // ---------------------------------------------------------------------------
 
 // wxWindow declaration for OS/2 PM
 // ---------------------------------------------------------------------------
 
-class WXDLLEXPORT wxWindow : public wxWindowBase
+class WXDLLEXPORT wxWindowOS2 : public wxWindowBase
 {
 {
-    DECLARE_DYNAMIC_CLASS(wxWindow);
-
 public:
 public:
-    wxWindow() { Init(); }
-
-    wxWindow( wxWindow*       pParent
-             ,wxWindowID      vId
-             ,const wxPoint&  rPos = wxDefaultPosition
-             ,const wxSize&   rSize = wxDefaultSize
-             ,long            lStyle = 0
-             ,const wxString& rName = wxPanelNameStr
-            )
+    wxWindowOS2()
+    {
+        Init();
+    }
+
+    wxWindowOS2( wxWindow*       pParent
+                ,wxWindowID      vId
+                ,const wxPoint&  rPos = wxDefaultPosition
+                ,const wxSize&   rSize = wxDefaultSize
+                ,long            lStyle = 0
+                ,const wxString& rName = wxPanelNameStr
+               )
     {
         Init();
         Create( pParent
     {
         Init();
         Create( pParent
@@ -69,7 +70,7 @@ public:
               );
     }
 
               );
     }
 
-    virtual ~wxWindow();
+    virtual ~wxWindowOS2();
 
     bool Create( wxWindow*       pParent
                 ,wxWindowID      vId
 
     bool Create( wxWindow*       pParent
                 ,wxWindowID      vId
@@ -108,10 +109,12 @@ public:
                                    ,int*            pExternalLeading = (int *)NULL
                                    ,const wxFont*   pTheFont = (const wxFont *)NULL
                                   ) const;
                                    ,int*            pExternalLeading = (int *)NULL
                                    ,const wxFont*   pTheFont = (const wxFont *)NULL
                                   ) const;
+#if wxUSE_MENUS_NATIVE
     virtual bool     DoPopupMenu( wxMenu* pMenu
                                  ,int     nX
                                  ,int     nY
                                 );
     virtual bool     DoPopupMenu( wxMenu* pMenu
                                  ,int     nX
                                  ,int     nY
                                 );
+#endif // wxUSE_MENUS_NATIVE
 
     virtual void     SetScrollbar( int  nOrient
                                   ,int  nPos
 
     virtual void     SetScrollbar( int  nOrient
                                   ,int  nPos
@@ -179,6 +182,7 @@ public:
                     ) const;
 #endif // wxUSE_CARET
 
                     ) const;
 #endif // wxUSE_CARET
 
+#ifndef __WXUNIVERSAL__
     // Native resource loading (implemented in src/os2/nativdlg.cpp)
     // FIXME: should they really be all virtual?
     virtual bool LoadNativeDialog( wxWindow*   pParent
     // Native resource loading (implemented in src/os2/nativdlg.cpp)
     // FIXME: should they really be all virtual?
     virtual bool LoadNativeDialog( wxWindow*   pParent
@@ -189,6 +193,7 @@ public:
                                  );
     wxWindow*    GetWindowChild1(wxWindowID vId);
     wxWindow*    GetWindowChild(wxWindowID vId);
                                  );
     wxWindow*    GetWindowChild1(wxWindowID vId);
     wxWindow*    GetWindowChild(wxWindowID vId);
+#endif //__WXUNIVERSAL__
 
     // implementation from now on
     // --------------------------
 
     // implementation from now on
     // --------------------------
@@ -205,6 +210,7 @@ public:
 
     // event handlers
     // --------------
 
     // event handlers
     // --------------
+    void OnSetFocus(wxFocusEvent& rEvent);
     void OnEraseBackground(wxEraseEvent& rEvent);
     void OnIdle(wxIdleEvent& rEvent);
 
     void OnEraseBackground(wxEraseEvent& rEvent);
     void OnIdle(wxIdleEvent& rEvent);
 
@@ -213,13 +219,6 @@ public:
     // smaller
     virtual wxPoint GetClientAreaOrigin(void) const;
 
     // smaller
     virtual wxPoint GetClientAreaOrigin(void) const;
 
-    // Makes an adjustment to the window position (for example, a frame that has
-    // a toolbar that it manages itself).
-    virtual void AdjustForParentClientOrigin( int& rX
-                                             ,int& rY
-                                             ,int  nSizeFlags
-                                            );
-
     // Windows subclassing
     void SubclassWin(WXHWND hWnd);
     void UnsubclassWin(void);
     // Windows subclassing
     void SubclassWin(WXHWND hWnd);
     void UnsubclassWin(void);
@@ -245,18 +244,20 @@ public:
     virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
 
     // returns TRUE if the window has been created
     virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
 
     // returns TRUE if the window has been created
-    bool OS2Create( int           nId
-                   ,wxWindow*     pParent
-                   ,const wxChar* zWclass
-                   ,wxWindow*     pWxWin
+    bool OS2Create( WXHWND        hParent
+                   ,PSZ           zClass
                    ,const wxChar* zTitle
                    ,const wxChar* zTitle
-                   ,int           nX
-                   ,int           nY
-                   ,int           nWidth
-                   ,int           nHeight
                    ,WXDWORD       dwStyle
                    ,WXDWORD       dwStyle
-                   ,const wxChar* zDialogTemplate = NULL
-                   ,WXDWORD       dwExendedStyle = 0
+                   ,long          lX
+                   ,long          lY
+                   ,long          lWidth
+                   ,long          lHeight
+                   ,WXHWND        hOwner
+                   ,WXHWND        hZOrder
+                   ,unsigned long lId
+                   ,void*         pCtlData = NULL
+                   ,void*         pPresParams = NULL
+                   ,WXDWORD       dwExStyle = 0L
                   );
     virtual bool OS2Command( WXUINT uParam
                             ,WXWORD nId
                   );
     virtual bool OS2Command( WXUINT uParam
                             ,WXWORD nId
@@ -269,6 +270,7 @@ public:
                                    ) const;
 #endif // WXWIN_COMPATIBILITY
 
                                    ) const;
 #endif // WXWIN_COMPATIBILITY
 
+#ifndef __WXUNIVERSAL__
     // Create an appropriate wxWindow from a HWND
     virtual wxWindow* CreateWindowFromHWND( wxWindow* pParent
                                            ,WXHWND    hWnd
     // Create an appropriate wxWindow from a HWND
     virtual wxWindow* CreateWindowFromHWND( wxWindow* pParent
                                            ,WXHWND    hWnd
@@ -276,6 +278,7 @@ public:
 
     // Make sure the window style reflects the HWND style (roughly)
     virtual void AdoptAttributesFromHWND(void);
 
     // Make sure the window style reflects the HWND style (roughly)
     virtual void AdoptAttributesFromHWND(void);
+#endif
 
     // Setup background and foreground colours correctly
     virtual void SetupColours(void);
 
     // Setup background and foreground colours correctly
     virtual void SetupColours(void);
@@ -295,7 +298,6 @@ public:
     void UnpackActivate( WXWPARAM wParam
                         ,WXLPARAM lParam
                         ,WXWORD*  pState
     void UnpackActivate( WXWPARAM wParam
                         ,WXLPARAM lParam
                         ,WXWORD*  pState
-                        ,WXWORD*  pMinimized
                         ,WXHWND*  pHwnd
                        );
     void UnpackScroll( WXWPARAM wParam
                         ,WXHWND*  pHwnd
                        );
     void UnpackScroll( WXWPARAM wParam
@@ -304,12 +306,6 @@ public:
                       ,WXWORD*  pPos
                       ,WXHWND*  pHwnd
                      );
                       ,WXWORD*  pPos
                       ,WXHWND*  pHwnd
                      );
-    void UnpackCtlColor( WXWPARAM wParam
-                        ,WXLPARAM lParam
-                        ,WXWORD*  pCtlColor
-                        ,WXHDC*   pHdc
-                        ,WXHWND*  pHwnd
-                       );
     void UnpackMenuSelect( WXWPARAM wParam
                           ,WXLPARAM lParam
                           ,WXWORD*  pTtem
     void UnpackMenuSelect( WXWPARAM wParam
                           ,WXLPARAM lParam
                           ,WXWORD*  pTtem
@@ -336,11 +332,6 @@ public:
                              ,WXHWND control
                             );
 
                              ,WXHWND control
                             );
 
-    virtual bool OS2OnNotify( int       nIdCtrl
-                             ,WXLPARAM  lParam
-                             ,WXLPARAM* pResult
-                            );
-
     // owner-drawn controls need to process these messages
     virtual bool OS2OnDrawItem( int               nId
                                ,WXDRAWITEMSTRUCT* pItem
     // owner-drawn controls need to process these messages
     virtual bool OS2OnDrawItem( int               nId
                                ,WXDRAWITEMSTRUCT* pItem
@@ -363,12 +354,11 @@ public:
                     ,int    nY
                     ,WXUINT uFlag
                    );
                     ,int    nY
                     ,WXUINT uFlag
                    );
-    bool HandleGetMinMaxInfo(void* pMmInfo);
+    bool HandleGetMinMaxInfo(PSWP pMmInfo);
     bool HandleShow( bool bShow
                     ,int  nStatus
                    );
     bool HandleActivate( int    nFlag
     bool HandleShow( bool bShow
                     ,int  nStatus
                    );
     bool HandleActivate( int    nFlag
-                        ,bool   bMinimized
                         ,WXHWND hActivate
                        );
     bool HandleCommand( WXWORD nId
                         ,WXHWND hActivate
                        );
     bool HandleCommand( WXWORD nId
@@ -378,26 +368,12 @@ public:
     bool HandleSysCommand( WXWPARAM wParam
                           ,WXLPARAM lParam
                          );
     bool HandleSysCommand( WXWPARAM wParam
                           ,WXLPARAM lParam
                          );
-    bool HandleCtlColor( WXHBRUSH* phBrush
-                        ,WXHDC     hDc
-                        ,WXHWND    hWnd
-                        ,WXUINT    uCtlColor
-                        ,WXUINT    uMessage
-                        ,WXWPARAM  wParam
-                        ,WXLPARAM  lParam
-                       );
-    bool HandlePaletteChanged(WXHWND hWndPalChange);
-    bool HandleQueryNewPalette(void);
+    bool HandlePaletteChanged();
     bool HandleSysColorChange(void);
     bool HandleSysColorChange(void);
-    bool HandleQueryEndSession( long  lLogOff
-                               ,bool* pbMayEnd
-                              );
-    bool HandleEndSession( bool bEndSession
-                          ,long lLogOff
-                         );
+    bool HandleCtlColor(WXHBRUSH* hBrush);
     bool HandleSetFocus(WXHWND hWnd);
     bool HandleKillFocus(WXHWND hWnd);
     bool HandleSetFocus(WXHWND hWnd);
     bool HandleKillFocus(WXHWND hWnd);
-    bool HandleDropFiles(WXWPARAM wParam);
+    bool HandleEndDrag(WXWPARAM wParam);
     bool HandleMouseEvent( WXUINT uMsg
                           ,int    nX
                           ,int    nY
     bool HandleMouseEvent( WXUINT uMsg
                           ,int    nX
                           ,int    nY
@@ -407,32 +383,29 @@ public:
                          ,int    nY
                          ,WXUINT uFlags
                         );
                          ,int    nY
                          ,WXUINT uFlags
                         );
-    bool HandleChar( WXWORD   wParam
+    bool HandleChar( WXDWORD  wParam
                     ,WXLPARAM lParam
                     ,bool     bIsASCII = FALSE
                    );
     bool HandleKeyDown( WXWORD   wParam
                        ,WXLPARAM lParam
                       );
                     ,WXLPARAM lParam
                     ,bool     bIsASCII = FALSE
                    );
     bool HandleKeyDown( WXWORD   wParam
                        ,WXLPARAM lParam
                       );
-    bool HandleKeyUp( WXWORD   wParam
+    bool HandleKeyUp( WXDWORD  wParam
                      ,WXLPARAM lParam
                     );
     bool HandleQueryDragIcon(WXHICON* phIcon);
                      ,WXLPARAM lParam
                     );
     bool HandleQueryDragIcon(WXHICON* phIcon);
-    bool HandleSetCursor( WXHWND hWnd
-                         ,short  nHitTest
-                         ,int    nMouseMsg
+    bool HandleSetCursor( USHORT vId
+                         ,WXHWND hWnd
                         );
 
     // Window procedure
                         );
 
     // Window procedure
-    virtual MRESULT OS2WindowProc( HWND     hwnd
-                                  ,WXUINT   uMsg
+    virtual MRESULT OS2WindowProc( WXUINT   uMsg
                                   ,WXWPARAM wParam
                                   ,WXLPARAM lParam
                                  );
 
     // Calls an appropriate default window procedure
                                   ,WXWPARAM wParam
                                   ,WXLPARAM lParam
                                  );
 
     // Calls an appropriate default window procedure
-    virtual MRESULT OS2DefWindowProc( HWND     hwnd
-                                     ,WXUINT   uMsg
+    virtual MRESULT OS2DefWindowProc( WXUINT   uMsg
                                      ,WXWPARAM wParam
                                      ,WXLPARAM lParam
                                     );
                                      ,WXWPARAM wParam
                                      ,WXLPARAM lParam
                                     );
@@ -469,18 +442,30 @@ public:
                        );
 
 protected:
                        );
 
 protected:
+    // PM can't create some MSW styles natively but can perform these after
+    // creation by sending messages
+    typedef enum extra_flags { kFrameToolWindow = 0x0001
+                              ,kVertCaption     = 0x0002
+                              ,kHorzCaption     = 0x0004
+                             } EExtraFlags;
+    // Some internal sizeing id's to make it easy for event handlers
+    typedef enum size_types { kSizeNormal
+                             ,kSizeMax
+                             ,kSizeMin
+                            } ESizeTypes;
     // the window handle
     WXHWND                          m_hWnd;
 
     // the old window proc (we subclass all windows)
     WXFARPROC                       m_fnOldWndProc;
 
     // the window handle
     WXHWND                          m_hWnd;
 
     // the old window proc (we subclass all windows)
     WXFARPROC                       m_fnOldWndProc;
 
-    // additional (MSW specific) flags
+    // additional (OS2 specific) flags
     bool                            m_bUseCtl3D:1; // Using CTL3D for this control
     bool                            m_bBackgroundTransparent:1;
     bool                            m_bMouseInWindow:1;
     bool                            m_bDoubleClickAllowed:1;
     bool                            m_bWinCaptured:1;
     bool                            m_bUseCtl3D:1; // Using CTL3D for this control
     bool                            m_bBackgroundTransparent:1;
     bool                            m_bMouseInWindow:1;
     bool                            m_bDoubleClickAllowed:1;
     bool                            m_bWinCaptured:1;
+    WXDWORD                         m_dwExStyle;
 
     // the size of one page for scrolling
     int                             m_nXThumbSize;
 
     // the size of one page for scrolling
     int                             m_nXThumbSize;
@@ -494,6 +479,7 @@ protected:
 #endif // wxUSE_MOUSEEVENT_HACK
 
     WXHMENU                         m_hMenu; // Menu, if any
 #endif // wxUSE_MOUSEEVENT_HACK
 
     WXHMENU                         m_hMenu; // Menu, if any
+    unsigned long                   m_ulMenubarId; // it's Id, if any
 
     // the return value of WM_GETDLGCODE handler
     long                            m_lDlgCode;
 
     // the return value of WM_GETDLGCODE handler
     long                            m_lDlgCode;
@@ -526,7 +512,7 @@ protected:
 
     // move the window to the specified location and resize it: this is called
     // from both DoSetSize() and DoSetClientSize() and would usually just call
 
     // move the window to the specified location and resize it: this is called
     // from both DoSetSize() and DoSetClientSize() and would usually just call
-    // ::MoveWindow() except for composite controls which will want to arrange
+    // ::WinSetWindowPos() except for composite controls which will want to arrange
     // themselves inside the given rectangle
     virtual void DoMoveWindow( int nX
                               ,int nY
     // themselves inside the given rectangle
     virtual void DoMoveWindow( int nX
                               ,int nY
@@ -556,13 +542,20 @@ private:
                       ,WXLPARAM  lParam
                       ,WXLPARAM* pResult
                      );
                       ,WXLPARAM  lParam
                       ,WXLPARAM* pResult
                      );
-    DECLARE_NO_COPY_CLASS(wxWindow);
+    // the helper functions used by HandleChar/KeyXXX methods
+    wxKeyEvent CreateKeyEvent(wxEventType evType, int id, WXLPARAM lp) const;
+
+    DECLARE_DYNAMIC_CLASS(wxWindowOS2);
+    DECLARE_NO_COPY_CLASS(wxWindowOS2)
     DECLARE_EVENT_TABLE()
 private:
     DECLARE_EVENT_TABLE()
 private:
+    HWND                            m_hWndScrollBarHorz;
+    HWND                            m_hWndScrollBarVert;
+
     // Virtual function hiding supression
     inline virtual bool Reparent(wxWindowBase* pNewParent)
     { return(wxWindowBase::Reparent(pNewParent));};
     // Virtual function hiding supression
     inline virtual bool Reparent(wxWindowBase* pNewParent)
     { return(wxWindowBase::Reparent(pNewParent));};
-};
+}; // end of wxWindow
 
 // ---------------------------------------------------------------------------
 // global functions
 
 // ---------------------------------------------------------------------------
 // global functions