]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/window.cpp
Parameter "small" renamed. Defined in a header file
[wxWidgets.git] / src / os2 / window.cpp
index f46f05ddda43568b51a85ff84a1d2a174ff1fa59..1ef7d38f2acfd46571cdd3fcbc8bc08847f23a28 100644 (file)
@@ -173,8 +173,8 @@ wxWindow::~wxWindow()
     DestroyChildren();
     if (m_hWnd)
     {
-        if(!WinDestroyWindow(GetHwnd()))
-            wxLogLastError("DestroyWindow");
+        if(!WinDestroyWindow(GetHWND()))
+            wxLogLastError(_T("DestroyWindow"));
         // remove hWnd <-> wxWindow association
         wxRemoveHandleAssociation(this);
     }
@@ -214,7 +214,7 @@ void wxWindow::ReleaseMouse()
     // TODO:
 }
 
-void wxWindow::Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL)
+void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
 {
     // TODO:
 }
@@ -245,9 +245,9 @@ int  wxWindow::GetCharWidth() const
 void wxWindow::GetTextExtent( const wxString& string
                              ,int*            x
                              ,int*            y
-                             ,int*            descent = NULL
-                             ,int*            externalLeading = NULL
-                             ,const wxFont*   theFont = NULL
+                             ,int*            descent
+                             ,int*            externalLeading
+                             ,const wxFont*   theFont
                             ) const
 {
     // TODO:
@@ -257,7 +257,7 @@ void wxWindow::SetScrollbar( int  orient
                             ,int  pos
                             ,int  thumbVisible
                             ,int  range
-                            ,bool refresh = TRUE
+                            ,bool refresh
                            )
 {
     // TODO:
@@ -265,7 +265,7 @@ void wxWindow::SetScrollbar( int  orient
 
 void wxWindow::SetScrollPos( int  orient
                             ,int  pos
-                            ,bool refresh = TRUE
+                            ,bool refresh
                            )
 {
     // TODO:
@@ -291,7 +291,7 @@ int  wxWindow::GetScrollThumb(int orient) const
 
 void wxWindow::ScrollWindow( int           dx
                             ,int           dy
-                            ,const wxRect* rect = NULL
+                            ,const wxRect* rect
                            )
 {
     // TODO:
@@ -331,7 +331,7 @@ void wxWindow::DoGetClientSize( int *width, int *height ) const
 
 void wxWindow::DoSetSize(int x, int y,
                          int width, int height,
-                         int sizeFlags = wxSIZE_AUTO)
+                         int sizeFlags)
 {
     // TODO:
 }
@@ -378,8 +378,9 @@ bool wxWindow::Validate()
 
 wxWindow* wxWindow::FindFocus()
 {
+    wxWindow*                       window = NULL;
     // TODO:
-    return(this);
+    return(window);
 }
 
 void wxWindow::DragAcceptFiles(bool accept)
@@ -491,7 +492,7 @@ void wxWindow::UnsetConstraints(wxLayoutConstraints *c)
 wxObject* wxWindow::GetChild(int number) const
 {
     // TODO:
-    return(this);
+    return((wxObject*)this);
 }
 
 void wxWindow::PMDetachWindowMenu()
@@ -500,12 +501,12 @@ void wxWindow::PMDetachWindowMenu()
     {
         HMENU hMenu = (HMENU)m_hMenu;
 
-        int N = ::GetMenuItemCount(hMenu);
+        int N = (int)WinSendMsg(hMenu, MM_QUERYITEMCOUNT, 0, 0);
         int i;
         for (i = 0; i < N; i++)
         {
             wxChar buf[100];
-            int chars = GetMenuString(hMenu, i, buf, 100, MF_BYPOSITION);
+            int chars = (int)WinSendMsg(hMenu, MM_QUERYITEMTEXT, MPFROM2SHORT(i, N), buf);
             if ( !chars )
             {
                 wxLogLastError(_T("GetMenuString"));
@@ -515,13 +516,13 @@ void wxWindow::PMDetachWindowMenu()
 
             if ( wxStrcmp(buf, _T("&Window")) == 0 )
             {
-                RemoveMenu(hMenu, i, MF_BYPOSITION);
-
+                WinSendMsg(hMenu, MM_DELETEITEM, MPFROM2SHORT(i, TRUE), 0);
                 break;
             }
         }
     }
 }
+
 void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win)
 {
     // adding NULL hWnd is (first) surely a result of an error and
@@ -546,3 +547,103 @@ void wxRemoveHandleAssociation(wxWindow *win)
     wxWinHandleList->DeleteObject(win);
 }
 
+void wxWindow::SubclassWin(WXHWND hWnd)
+{
+    wxASSERT_MSG( !m_oldWndProc, _T("subclassing window twice?") );
+
+    HWND hwnd = (HWND)hWnd;
+/*
+* TODO: implement something like this:
+*   wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in SubclassWin") );
+*
+*   wxAssociateWinWithHandle(hwnd, this);
+*
+*   m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
+*   SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
+*/
+}
+
+void wxWindow::UnsubclassWin()
+{
+/*
+* TODO:
+
+    wxRemoveHandleAssociation(this);
+
+    // Restore old Window proc
+    HWND hwnd = GetHwnd();
+    if ( hwnd )
+    {
+        m_hWnd = 0;
+
+        wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in UnsubclassWin") );
+
+        FARPROC farProc = (FARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
+        if ( (m_oldWndProc != 0) && (farProc != (FARPROC) m_oldWndProc) )
+        {
+            SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc);
+            m_oldWndProc = 0;
+        }
+    }
+*/
+}
+
+WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle,
+                                     bool *want3D) const
+{
+   DWORD exStyle; // remove after implementation doe
+/* TODO:  this ought to be fun
+*
+    // If matches certain criteria, then assume no 3D effects
+    // unless specifically requested (dealt with in MakeExtendedStyle)
+    if ( !GetParent() || !IsKindOf(CLASSINFO(wxControl)) || (m_windowStyle & wxNO_BORDER) )
+    {
+        *want3D = FALSE;
+        return MakeExtendedStyle(m_windowStyle, FALSE);
+    }
+
+    // Determine whether we should be using 3D effects or not.
+    bool nativeBorder = FALSE; // by default, we don't want a Win95 effect
+
+    // 1) App can specify global 3D effects
+    *want3D = wxTheApp->GetAuto3D();
+
+    // 2) If the parent is being drawn with user colours, or simple border specified,
+    // switch effects off. TODO: replace wxUSER_COLOURS with wxNO_3D
+    if ( GetParent() && (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) || (m_windowStyle & wxSIMPLE_BORDER) )
+        *want3D = FALSE;
+
+    // 3) Control can override this global setting by defining
+    // a border style, e.g. wxSUNKEN_BORDER
+    if ( m_windowStyle & wxSUNKEN_BORDER  )
+        *want3D = TRUE;
+
+    // 4) If it's a special border, CTL3D can't cope so we want a native border
+    if ( (m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
+        (m_windowStyle & wxSTATIC_BORDER) )
+    {
+        *want3D = TRUE;
+        nativeBorder = TRUE;
+    }
+
+    // 5) If this isn't a Win95 app, and we are using CTL3D, remove border
+    // effects from extended style
+#if wxUSE_CTL3D
+    if ( *want3D )
+        nativeBorder = FALSE;
+#endif
+
+    DWORD exStyle = MakeExtendedStyle(m_windowStyle, !nativeBorder);
+
+    // If we want 3D, but haven't specified a border here,
+    // apply the default border style specified.
+    // TODO what about non-Win95 WIN32? Does it have borders?
+#if defined(__WIN95__) && !wxUSE_CTL3D
+    if ( defaultBorderStyle && (*want3D) && ! ((m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) ||
+        (m_windowStyle & wxSTATIC_BORDER) || (m_windowStyle & wxSIMPLE_BORDER) ))
+        exStyle |= defaultBorderStyle; // WS_EX_CLIENTEDGE;
+#endif
+*/
+    return exStyle;
+}
+