]> git.saurik.com Git - wxWidgets.git/commitdiff
Added some extended styles to OS/2
authorDavid Webster <Dave.Webster@bhmi.com>
Fri, 25 May 2001 21:12:00 +0000 (21:12 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Fri, 25 May 2001 21:12:00 +0000 (21:12 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10330 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/os2/private.h
include/wx/os2/window.h
src/os2/utils.cpp
src/os2/window.cpp
src/os2/wx23.def

index 3b943d032996775903a70ad768df9dd2515dc970..067a3ee8ddee745a493a652bc2f65f7b2af161b3 100644 (file)
@@ -117,7 +117,7 @@ extern LONG APIENTRY wxSubclassedGenericControlProc(WXHWND hWnd, WXDWORD message
 // ---------------------------------------------------------------------------
 
 #if !defined(WS_EX_CLIENTEDGE)
 // ---------------------------------------------------------------------------
 
 #if !defined(WS_EX_CLIENTEDGE)
-    #define WS_EX_CLIENTEDGE 0
+    #define WS_EX_CLIENTEDGE 0x00000200L
 #endif
 
 #ifndef ENDSESSION_LOGOFF
 #endif
 
 #ifndef ENDSESSION_LOGOFF
@@ -183,6 +183,11 @@ extern "C"
 WXDLLEXPORT HINSTANCE wxGetInstance();
 }
 
 WXDLLEXPORT HINSTANCE wxGetInstance();
 }
 
+WXDLLEXPORT void wxDrawBorder( HPS     hPS
+                              ,RECTL&  rRect
+                              ,WXDWORD dwStyle
+                             );
+
 WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
 
 WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd);
 WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
 
 WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd);
@@ -227,5 +232,6 @@ inline bool wxStyleHasBorder(long style)
                    wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
 }
 
                    wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
 }
 
+
 #endif
     // _WX_PRIVATE_H_
 #endif
     // _WX_PRIVATE_H_
index 323fa4570a547b98166afbb21f80b0fd5dbed62c..358c0e849a158cfe0f283f481d25cab333a0d45c 100644 (file)
@@ -260,6 +260,7 @@ public:
                    ,unsigned long lId
                    ,void*         pCtlData = NULL
                    ,void*         pPresParams = NULL
                    ,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
@@ -463,12 +464,13 @@ protected:
     // the old window proc (we subclass all windows)
     WXFARPROC                       m_fnOldWndProc;
 
     // 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;
index 94a7823eebfe91e39dcf9cea616fe7f555d96963..5b5dc109cf97e1052aec2ec46c44b3f923ae3031 100644 (file)
@@ -950,4 +950,82 @@ wxString WXDLLEXPORT wxPMErrorToStr(
     return(sError);
 } // end of wxPMErrorToStr
 
     return(sError);
 } // end of wxPMErrorToStr
 
+void wxDrawBorder(
+  HPS                               hPS
+, RECTL&                            rRect
+, WXDWORD                           dwStyle
+)
+{
+    POINTL                          vPoint[2];
+
+    vPoint[0].x = rRect.xLeft;
+    vPoint[0].y = rRect.yBottom;
+    ::GpiMove(hPS, &vPoint[0]);
+    if (dwStyle & wxSIMPLE_BORDER ||
+        dwStyle & wxSTATIC_BORDER)
+    {
+        vPoint[1].x = rRect.xRight;
+        vPoint[1].y = rRect.yTop;
+        ::GpiBox( hPS
+                 ,DRO_OUTLINE
+                 ,&vPoint[1]
+                 ,0L
+                 ,0L
+                );
+    }
+    if (dwStyle & wxSUNKEN_BORDER)
+    {
+        LINEBUNDLE                      vLineBundle;
+
+        vLineBundle.lColor     = 0x00FFFFFF; // White
+        vLineBundle.usMixMode  = FM_OVERPAINT;
+        vLineBundle.fxWidth    = 2;
+        vLineBundle.lGeomWidth = 2;
+        vLineBundle.usType     = LINETYPE_SOLID;
+        vLineBundle.usEnd      = 0;
+        vLineBundle.usJoin     = 0;
+        ::GpiSetAttrs( hPS
+                      ,PRIM_LINE
+                      ,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE
+                      ,0L
+                      ,&vLineBundle
+                     );
+        vPoint[1].x = rRect.xRight;
+        vPoint[1].y = rRect.yTop;
+        ::GpiBox( hPS
+                 ,DRO_OUTLINE
+                 ,&vPoint[1]
+                 ,0L
+                 ,0L
+                );
+        vLineBundle.lColor     = 0x00000000; // BLACK
+        vLineBundle.usMixMode  = FM_OVERPAINT;
+        vLineBundle.fxWidth    = 2;
+        vLineBundle.lGeomWidth = 2;
+        vLineBundle.usType     = LINETYPE_SOLID;
+        vLineBundle.usEnd      = 0;
+        vLineBundle.usJoin     = 0;
+        ::GpiSetAttrs( hPS
+                      ,PRIM_LINE
+                      ,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE
+                      ,0L
+                      ,&vLineBundle
+                     );
+        vPoint[0].x = rRect.xLeft + 2;
+        vPoint[0].y = rRect.yBottom + 2;
+        ::GpiMove(hPS, &vPoint[0]);
+        vPoint[1].x = rRect.xLeft + 2;
+        vPoint[1].y = rRect.yTop - 2;
+        ::GpiLine(hPS, &vPoint[1]);
+        vPoint[1].x = rRect.xRight - 2;
+        vPoint[1].y = rRect.yTop - 2;
+        ::GpiLine(hPS, &vPoint[1]);
+    }
+    if (dwStyle & wxDOUBLE_BORDER)
+    {
+    }
+    if (dwStyle & wxRAISED_BORDER)
+    {
+    }
+} // end of wxDrawBorder
 
 
index 2aef2aaeffc9c47a94658318ce47d7e5c116d42d..14abb69cd1ded9545938f0053f9af5bc38a3878a 100644 (file)
@@ -399,11 +399,18 @@ bool wxWindow::Create(
         ulCreateFlags |= WS_CLIPCHILDREN;
 
     //
         ulCreateFlags |= WS_CLIPCHILDREN;
 
     //
-    // Empty stuff for now since PM has no custome 3D effects
-    // Doesn't mean someone cannot make some up though
+    //
     //
     bool                            bWant3D;
     //
     bool                            bWant3D;
-    WXDWORD                         dwExStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &bWant3D);
+    WXDWORD                         dwExStyle = Determine3DEffects( WS_EX_CLIENTEDGE
+                                                                   ,&bWant3D
+                                                                  );
+
+    //
+    // Add the simple border style as we'll use this to draw borders
+    //
+    if (lStyle & wxSIMPLE_BORDER)
+        dwExStyle |= wxSIMPLE_BORDER;
 
     //
     // Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
 
     //
     // Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
@@ -420,6 +427,9 @@ bool wxWindow::Create(
               ,NULLHANDLE
               ,NULLHANDLE
               ,m_windowId
               ,NULLHANDLE
               ,NULLHANDLE
               ,m_windowId
+              ,NULL
+              ,NULL
+              ,dwExStyle
              );
 
     return(TRUE);
              );
 
     return(TRUE);
@@ -992,16 +1002,32 @@ WXDWORD wxWindow::MakeExtendedStyle(
 )
 {
    //
 )
 {
    //
-   // PM does not support extended style
+   // Simply fill out with wxWindow extended styles.  We'll conjure
+   // something up in OS2Create and all window redrawing pieces later
    //
    //
-    WXDWORD                         exStyle = 0;
-    return exStyle;
+    WXDWORD                         dwStyle = 0;
+
+    if (lStyle & wxTRANSPARENT_WINDOW )
+        dwStyle |= wxTRANSPARENT_WINDOW;
+
+    if (!bEliminateBorders)
+    {
+        if (lStyle & wxSUNKEN_BORDER)
+            dwStyle |= wxSUNKEN_BORDER;
+        if (lStyle & wxDOUBLE_BORDER)
+            dwStyle |= wxDOUBLE_BORDER;
+        if (lStyle & wxRAISED_BORDER )
+            dwStyle |= wxRAISED_BORDER;
+        if (lStyle & wxSTATIC_BORDER)
+            dwStyle |= wxSTATIC_BORDER;
+    }
+    return dwStyle;
 } // end of wxWindow::MakeExtendedStyle
 
 //
 } // end of wxWindow::MakeExtendedStyle
 
 //
-// Determines whether native 3D effects or CTL3D should be used,
+// Determines whether simulated 3D effects or CTL3D should be used,
 // applying a default border style if required, and returning an extended
 // applying a default border style if required, and returning an extended
-// style to pass to CreateWindowEx.
+// style to pass to OS2Create.
 //
 WXDWORD wxWindow::Determine3DEffects(
   WXDWORD                           dwDefaultBorderStyle
 //
 WXDWORD wxWindow::Determine3DEffects(
   WXDWORD                           dwDefaultBorderStyle
@@ -1011,9 +1037,65 @@ WXDWORD wxWindow::Determine3DEffects(
     WXDWORD                         dwStyle = 0L;
 
     //
     WXDWORD                         dwStyle = 0L;
 
     //
-    // Native PM does not have any specialize 3D effects like WIN32 does
+    // Native PM does not have any specialize 3D effects like WIN32 does,
+    // so we have to try and invent them.
+    //
+
+    //
+    // 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)
+       )
+    {
+        *pbWant3D = FALSE;
+        return MakeExtendedStyle(m_windowStyle, FALSE);
+    }
+
+    //
+    // 1) App can specify global 3D effects
     //
     //
-    *pbWant3D = FALSE;
+    *pbWant3D = wxTheApp->GetAuto3D();
+
+    //
+    // 2) If the parent is being drawn with user colours, or simple border
+    //    specified, switch effects off.
+    //
+    if (GetParent() &&
+        (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) ||
+        (m_windowStyle & wxSIMPLE_BORDER)
+       )
+        *pbWant3D = FALSE;
+
+    //
+    // 3) Control can override this global setting by defining
+    //    a border style, e.g. wxSUNKEN_BORDER
+    //
+    if ((m_windowStyle & wxDOUBLE_BORDER) ||
+        (m_windowStyle & wxRAISED_BORDER) ||
+        (m_windowStyle & wxSTATIC_BORDER) ||
+        (m_windowStyle & wxSUNKEN_BORDER)
+       )
+        *pbWant3D = TRUE;
+
+    dwStyle = MakeExtendedStyle( m_windowStyle
+                                ,FALSE
+                               );
+
+    //
+    // If we want 3D, but haven't specified a border here,
+    // apply the default border style specified.
+    //
+    if (dwDefaultBorderStyle && (*pbWant3D) &&
+        !((m_windowStyle & wxDOUBLE_BORDER) ||
+          (m_windowStyle & wxRAISED_BORDER) ||
+          (m_windowStyle & wxSTATIC_BORDER) ||
+          (m_windowStyle & wxSIMPLE_BORDER)
+         )
+        )
+        dwStyle |= dwDefaultBorderStyle;
     return dwStyle;
 } // end of wxWindow::Determine3DEffects
 
     return dwStyle;
 } // end of wxWindow::Determine3DEffects
 
@@ -2581,6 +2663,7 @@ bool wxWindow::OS2Create(
 , unsigned long                     ulId
 , void*                             pCtlData
 , void*                             pPresParams
 , unsigned long                     ulId
 , void*                             pCtlData
 , void*                             pPresParams
+, WXDWORD                           dwExStyle
 )
 {
     ERRORID                         vError;
 )
 {
     ERRORID                         vError;
@@ -2669,6 +2752,7 @@ bool wxWindow::OS2Create(
         wxLogError("Can't create window of class %s!. Error: %s\n", zClass, sError);
         return FALSE;
     }
         wxLogError("Can't create window of class %s!. Error: %s\n", zClass, sError);
         return FALSE;
     }
+    m_dwExStyle = dwExStyle;
     ::WinSetWindowULong(m_hWnd, QWL_USER, (ULONG) this);
     wxWndHook = NULL;
 
     ::WinSetWindowULong(m_hWnd, QWL_USER, (ULONG) this);
     wxWndHook = NULL;
 
@@ -3236,6 +3320,29 @@ bool wxWindow::HandlePaint()
                                     );
 
             ::WinFillRect(hPS, &vRect,  GetBackgroundColour().GetPixel());
                                     );
 
             ::WinFillRect(hPS, &vRect,  GetBackgroundColour().GetPixel());
+
+            if (m_dwExStyle)
+            {
+                LINEBUNDLE                      vLineBundle;
+
+                vLineBundle.lColor     = 0x00000000; // Black
+                vLineBundle.usMixMode  = FM_OVERPAINT;
+                vLineBundle.fxWidth    = 1;
+                vLineBundle.lGeomWidth = 1;
+                vLineBundle.usType     = LINETYPE_SOLID;
+                vLineBundle.usEnd      = 0;
+                vLineBundle.usJoin     = 0;
+                ::GpiSetAttrs( hPS
+                              ,PRIM_LINE
+                              ,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE
+                              ,0L
+                              ,&vLineBundle
+                             );
+                wxDrawBorder( hPS
+                             ,vRect
+                             ,m_dwExStyle
+                            );
+            }
             ::WinEndPaint(hPS);
         }
     }
             ::WinEndPaint(hPS);
         }
     }
index 88516a1957fbace04b2fd8d2ea25355fc98942fc..4767d69b28ad4e658c4ebcbe72af42790f5de6dc 100644 (file)
@@ -13469,6 +13469,8 @@ EXPORTS
       wxGetResource__FRC8wxStringT1PfT1
       ;wxGetMousePosition(int*,int*)
       wxGetMousePosition__FPiT1
       wxGetResource__FRC8wxStringT1PfT1
       ;wxGetMousePosition(int*,int*)
       wxGetMousePosition__FPiT1
+      ;wxDrawBorder(unsigned long,_RECTL&,unsigned long)
+      wxDrawBorder__FUlR6_RECTLT1
       ;wxPathExists(const wxString&)
       wxPathExists__FRC8wxString
       ;wxGetWindowText(unsigned long)
       ;wxPathExists(const wxString&)
       wxPathExists__FRC8wxString
       ;wxGetWindowText(unsigned long)
@@ -13786,8 +13788,8 @@ EXPORTS
       GetCharWidth__8wxWindowCFv
       ;wxWindowBase::FindFocus()
       FindFocus__12wxWindowBaseFv
       GetCharWidth__8wxWindowCFv
       ;wxWindowBase::FindFocus()
       FindFocus__12wxWindowBaseFv
-      ;wxWindow::OS2Create(unsigned long,char*,const char*,unsigned long,long,long,long,long,unsigned long,unsigned long,unsigned long,void*,void*)
-      OS2Create__8wxWindowFUlPcPCcT1lN35N31PvT12_
+      ;wxWindow::OS2Create(unsigned long,char*,const char*,unsigned long,long,long,long,long,unsigned long,unsigned long,unsigned long,void*,void*,unsigned long)
+      OS2Create__8wxWindowFUlPcPCcT1lN35N31PvT12_T1
       ;wxWindow::sm_eventTableEntries
       sm_eventTableEntries__8wxWindow
       ;wxWindow::SetTitle(const wxString&)
       ;wxWindow::sm_eventTableEntries
       sm_eventTableEntries__8wxWindow
       ;wxWindow::SetTitle(const wxString&)