]> git.saurik.com Git - wxWidgets.git/commitdiff
no message
authorDavid Webster <Dave.Webster@bhmi.com>
Mon, 13 Mar 2000 05:43:53 +0000 (05:43 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Mon, 13 Mar 2000 05:43:53 +0000 (05:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6643 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/os2/colour.h
src/os2/app.cpp
src/os2/colour.cpp
src/os2/frame.cpp
src/os2/menu.cpp
src/os2/settings.cpp

index dc4b7fa4556a425b8e763bcd0db0005a7b72964e..a69fa86430adf563e1d518d23058455cf6adc5d1 100644 (file)
 class WXDLLEXPORT wxColour: public wxObject
 {
 public:
-  // ctors
-    // default
-  wxColour();
+    //
+    // Ctors
+    //
+
+    //
+    // Default
+    //
+    wxColour();
+
+    //
     // from RGB
-  wxColour( unsigned char red, unsigned char green, unsigned char blue );
-    // implicit conversion from the colour name
-  wxColour( const wxString &colourName ) { InitFromName(colourName); }
-  wxColour( const char *colourName ) { InitFromName(colourName); }
-
-    // copy ctors and assignment operators
-  wxColour( const wxColour& col );
-  wxColour( const wxColour* col );
-  wxColour& operator = ( const wxColour& col );
-
-    // dtor
-  ~wxColour();
-
-  // Set() functions
-  void Set( unsigned char red, unsigned char green, unsigned char blue );
-  void Set( unsigned long colRGB )
-  {
-    // we don't need to know sizeof(long) here because we assume that the three
-    // least significant bytes contain the R, G and B values
-    Set((unsigned char)colRGB,
-        (unsigned char)(colRGB >> 8),
-        (unsigned char)(colRGB >> 16));
-  }
-
-  // accessors
-  bool Ok() const {return m_isInit; }
-
-  // Let's remove this inelegant function
+    //
+    wxColour( unsigned char cRed
+             ,unsigned char cGreen
+             ,unsigned char cBlue
+            );
+
+    //
+    // Implicit conversion from the colour name
+    //
+    wxColour(const wxString& rColourName) { InitFromName(rColourName); }
+    wxColour(const char* zColourName) { InitFromName(zColourName); }
+
+    //
+    // Copy ctors and assignment operators
+    //
+    wxColour(const wxColour& rCol);
+    wxColour(const wxColour* pCol);
+    wxColour&operator = (const wxColour& rCol);
+
+    //
+    // Dtor
+    //
+    ~wxColour();
+
+    //
+    // Set functions
+    //
+    void Set( unsigned char cRed
+             ,unsigned char cGreen
+             ,unsigned char cBlue
+            );
+    void Set(unsigned long lColRGB)
+    {
+        //
+        // We don't need to know sizeof(long) here because we assume that the three
+        // least significant bytes contain the R, G and B values
+        //
+        Set( (unsigned char)lColRGB
+            ,(unsigned char)(lColRGB >> 8)
+            ,(unsigned char)(lColRGB >> 16)
+           );
+    }
+
+    //
+    // Accessors
+    bool Ok(void) const {return m_bIsInit; }
+
+    //
+    // Let's remove this inelegant function
+    //
 #if WXWIN_COMPATIBILITY
-  void Get(unsigned char *r, unsigned char *g, unsigned char *b) const;
+    void Get( unsigned char* pRed
+             ,unsigned char* pGreen
+             ,unsigned char* pBlue
+            ) const;
 #endif
 
-  unsigned char Red() const { return m_red; }
-  unsigned char Green() const { return m_green; }
-  unsigned char Blue() const { return m_blue; }
-
-  // comparison
-  bool operator == (const wxColour& colour) const
-  {
-    return (m_red == colour.m_red &&
-            m_green == colour.m_green &&
-            m_blue == colour.m_blue);
-  }
-  bool operator != (const wxColour& colour) const { return !(*this == colour); }
+    unsigned char Red(void) const { return m_cRed; }
+    unsigned char Green(void) const { return m_cGreen; }
+    unsigned char Blue(void) const { return m_cBlue; }
 
-  void InitFromName(const wxString& col);
+    //
+    // Comparison
+    //
+    bool operator == (const wxColour& rColour) const
+    {
+        return (m_cRed   == rColour.m_cRed &&
+                m_cGreen == rColour.m_cGreen &&
+                m_cBlue  == rColour.m_cBlue
+               );
+    }
+    bool operator != (const wxColour& rColour) const { return !(*this == rColour); }
 
-/* TODO
-  WXCOLORREF GetPixel() const { return m_pixel; };
-*/
+    void       InitFromName(const wxString& rCol);
+    WXCOLORREF GetPixel(void) const { return m_vPixel; };
 
 private:
-  bool          m_isInit;
-  unsigned char m_red;
-  unsigned char m_blue;
-  unsigned char m_green;
+    bool                            m_bIsInit;
+    unsigned char                   m_cRed;
+    unsigned char                   m_cBlue;
+    unsigned char                   m_cGreen;
 
 public:
-     WXCOLORREF m_pixel ;
+    WXCOLORREF                      m_vPixel ;
 private:
   DECLARE_DYNAMIC_CLASS(wxColour)
-};
+}; // end of class wxColour
 
 #endif
   // _WX_COLOUR_H_
index 60bb29dcda24de8ae88b9f16f86688eb05e402a7..737de733cfca887bff142a9fa0f1d8a4bbdb5b78 100644 (file)
@@ -205,7 +205,7 @@ bool wxApp::RegisterWindowClasses(
                             ,wxFrameClassName
                             ,(PFNWP)wxWndProc
                             ,CS_SIZEREDRAW | CS_SYNCPAINT
-                            ,0
+                            ,sizeof(ULONG)
                            ))
     {
         vError = ::WinGetLastError(vHab);
@@ -321,19 +321,13 @@ void wxApp::CleanUp()
     wxLog::DontCreateOnDemand();
 
     // this will flush the old messages if any
-#if (!(defined(__VISAGECPP__) && __IBMCPP__ < 400))
-    // another VA 3.0 memory problem here
     delete wxLog::SetActiveTarget(new wxLogStderr);
-#endif
 #endif // wxUSE_LOG
 
     // One last chance for pending objects to be cleaned up
     wxTheApp->DeletePendingObjects();
 
-#if (!(defined(__VISAGECPP__) && __IBMCPP__ < 400))
-    // another VA 3.0 memory problem here
     wxModule::CleanUpModules();
-#endif
 
 #if wxUSE_WX_RESOURCES
     wxCleanUpResourceSystem();
@@ -345,10 +339,7 @@ void wxApp::CleanUp()
     // by deleting the bitmap list before g_globalCursor goes out of scope
     // (double deletion of the cursor).
     wxSetCursor(wxNullCursor);
-#if (!(defined(__VISAGECPP__) && __IBMCPP__ < 400))
-    // another VA 3.0 memory problem here
     delete g_globalCursor;
-#endif
     g_globalCursor = NULL;
 
     wxDeleteStockObjects();
@@ -364,7 +355,7 @@ void wxApp::CleanUp()
     delete[] wxBuffer;
     wxBuffer = NULL;
 
-    //// WINDOWS-SPECIFIC CLEANUP
+    //// PM-SPECIFIC CLEANUP
 
     // wxSetKeyboardHook(FALSE);
 
index fa7a6239700e0f0a9591cbf778389ae5e5e93a95..a5e9556dac285940a5a1f07a91bf98991b0c2ec5 100644 (file)
@@ -23,83 +23,100 @@ IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
 
 wxColour::wxColour ()
 {
-    m_isInit = FALSE;
-    m_pixel = 0;
-    m_red = m_blue = m_green = 0;
-}
+    m_bIsInit = FALSE;
+    m_vPixel = 0;
+    m_cRed = m_cBlue = m_cGreen = 0;
+} // end of wxColour::wxColour
 
-wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
+wxColour::wxColour (
+  unsigned char                     cRed
+, unsigned char                     cGreen
+, unsigned char                     cBlue
+)
 {
-    m_red = r;
-    m_green = g;
-    m_blue = b;
-    m_isInit = TRUE;
-//    m_pixel = PALETTERGB (m_red, m_green, m_blue);
-}
+    m_cRed    = cRed;
+    m_cGreen  = cGreen;
+    m_cBlue   = cBlue;
+    m_bIsInit = TRUE;
+    m_vPixel  = PALETTERGB (m_cRed, m_cGreen, m_cBlue);
+} // end of wxColour::wxColour
 
-wxColour::wxColour (const wxColour& col)
+wxColour::wxColour (
+  const wxColour&                   rCol
+)
 {
-    m_red = col.m_red;
-    m_green = col.m_green;
-    m_blue = col.m_blue;
-    m_isInit = col.m_isInit;
-    m_pixel = col.m_pixel;
-}
+    m_cRed    = rCol.m_cRed;
+    m_cGreen  = rCol.m_cGreen;
+    m_cBlue   = rCol.m_cBlue;
+    m_bIsInit = rCol.m_bIsInit;
+    m_vPixel  = rCol.m_vPixel;
+} // end of wxColour::wxColour
 
-wxColour& wxColour::operator =(const wxColour& col)
+wxColour& wxColour::operator =(
+  const wxColour&                   rCol
+)
 {
-  m_red = col.m_red;
-  m_green = col.m_green;
-  m_blue = col.m_blue;
-  m_isInit = col.m_isInit;
-  m_pixel = col.m_pixel;
-  return *this;
-}
+    m_cRed    = rCol.m_cRed;
+    m_cGreen  = rCol.m_cGreen;
+    m_cBlue   = rCol.m_cBlue;
+    m_bIsInit = rCol.m_bIsInit;
+    m_vPixel  = rCol.m_vPixel;
+    return *this;
+} // end of wxColour& wxColour::operator =
 
-void wxColour::InitFromName(const wxString& col)
+void wxColour::InitFromName(
+  const wxString&                   sCol
+)
 {
-    wxColour *the_colour = wxTheColourDatabase->FindColour (col);
-    if (the_colour)
+    wxColour*                       pTheColour = wxTheColourDatabase->FindColour(sCol);
+
+    if (pTheColour)
     {
-        m_red = the_colour->Red ();
-        m_green = the_colour->Green ();
-        m_blue = the_colour->Blue ();
-        m_isInit = TRUE;
+        m_cRed    = pTheColour->Red();
+        m_cGreen  = pTheColour->Green();
+        m_cBlue   = pTheColour->Blue();
+        m_bIsInit = TRUE;
     }
     else
     {
-        m_red = 0;
-        m_green = 0;
-        m_blue = 0;
-        m_isInit = FALSE;
+        m_cRed = 0;
+        m_cGreen = 0;
+        m_cBlue = 0;
+        m_bIsInit = FALSE;
     }
-/* TODO
-    m_pixel = PALETTERGB (m_red, m_green, m_blue);
-*/
-}
+    m_vPixel = PALETTERGB (m_cRed, m_cGreen, m_cBlue);
+} // end of wxColour::InitFromName
 
 wxColour::~wxColour ()
 {
-}
+} // end of wxColour::~wxColour
 
-void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
+void wxColour::Set (
+  unsigned char                     cRed
+, unsigned char                     cGreen
+, unsigned char                     cBlue
+)
 {
-    m_red = r;
-    m_green = g;
-    m_blue = b;
-    m_isInit = TRUE;
-/* TODO
-    m_pixel = PALETTERGB (m_red, m_green, m_blue);
-*/
-}
+    m_cRed    = cRed;
+    m_cGreen  = cGreen;
+    m_cBlue   = cBlue;
+    m_bIsInit = TRUE;
+    m_vPixel  = PALETTERGB (m_cRed, m_cGreen, m_cBlue);
+} // end of wxColour::Set
 
+//
 // Obsolete
+//
 #if WXWIN_COMPATIBILITY
-void wxColour::Get (unsigned char *r, unsigned char *g, unsigned char *b) const
+void wxColour::Get (
+  unsigned char*                   pRed
+, unsigned char*                   pGreen
+, unsigned char*                   pBlue
+) const
 {
-  *r = m_red;
-  *g = m_green;
-  *b = m_blue;
-}
+    *Red   = m_cRed;
+    *Green = m_cGreen;
+    *Blue  = m_cBlue;
+} // end of wxColour::Get
 #endif
 
index 50a4cea7f16a8502c71ddc6a791ceffd9036a824..0643f20c5bd8202de70e729fff0191030653b0c6 100644 (file)
@@ -343,16 +343,37 @@ void wxFrame::DoShowWindow(
 )
 {
     HWND                            hClient;
+    HWND                            hTitlebar = NULLHANDLE;
+    HWND                            hHScroll = NULLHANDLE;
+    HWND                            hVScroll = NULLHANDLE;
+    HWND                            hMenuBar = NULLHANDLE;
+    SWP                             vSwp;
+    SWP                             vSwpTitlebar;
+    SWP                             vSwpVScroll;
+    SWP                             vSwpHScroll;
+    SWP                             vSwpMenu;
 
     //
     // Send anything to initialize the frame
     //
-    ::WinSendMsg( GetHwnd()
-                 ,WM_UPDATEFRAME
-                 ,(MPARAM)FCF_MENU
-                 ,(MPARAM)0
-                );
-    hClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
+    WinQueryWindowPos(GetHwnd(), &vSwp);
+    hClient = WinWindowFromID(GetHwnd(), FID_CLIENT);
+    hTitlebar = WinWindowFromID(GetHwnd(), FID_TITLEBAR);
+    WinQueryWindowPos(hTitlebar, &vSwpTitlebar);
+    hHScroll = WinWindowFromID(GetHwnd(), FID_HORZSCROLL);
+    WinQueryWindowPos(hHScroll, &vSwpHScroll);
+    hVScroll = WinWindowFromID(GetHwnd(), FID_VERTSCROLL);
+    WinQueryWindowPos(hVScroll, &vSwpVScroll);
+    hMenuBar = WinWindowFromID(GetHwnd(), FID_MENU);
+    WinQueryWindowPos(hMenuBar, &vSwpMenu);
+    WinSetWindowPos( hClient
+                    ,HWND_TOP
+                    ,SV_CXSIZEBORDER
+                    ,(SV_CYSIZEBORDER - 1) + vSwpHScroll.cy
+                    ,vSwp.cx - ((SV_CXSIZEBORDER * 2) + vSwpVScroll.cx)
+                    ,vSwp.cy - ((SV_CYSIZEBORDER * 2) + 1 + vSwpTitlebar.cy + vSwpMenu.cy + vSwpHScroll.cy)
+                    ,SWP_SIZE | SWP_MOVE
+                   );
     ::WinShowWindow(GetHwnd(), (BOOL)bShowCmd);
     ::WinShowWindow(hClient, (BOOL)bShowCmd);
 } // end of wxFrame::DoShowWindow
@@ -371,14 +392,7 @@ bool wxFrame::Show(
 
         ::WinQueryWindowPos(GetHwnd(), &vSwp);
         m_bIconized = vSwp.fl & SWP_MINIMIZE;
-        ::WinSetWindowPos( (HWND) GetHWND()
-                          ,HWND_TOP
-                          ,vSwp.x
-                          ,vSwp.y
-                          ,vSwp.cx
-                          ,vSwp.cy
-                          ,SWP_ZORDER | SWP_ACTIVATE | SWP_SHOW | SWP_MOVE
-                         );
+        ::WinEnableWindow(GetHwnd(), TRUE);
         vEvent.SetEventObject(this);
         GetEventHandler()->ProcessEvent(vEvent);
     }
@@ -402,6 +416,7 @@ bool wxFrame::Show(
                                   ,vSwp.cy
                                   ,SWP_ZORDER | SWP_ACTIVATE | SWP_SHOW | SWP_MOVE
                                  );
+            ::WinEnableWindow(hWndParent, TRUE);
         }
     }
     return TRUE;
@@ -747,16 +762,23 @@ bool wxFrame::OS2Create(
     HWND                            hTitlebar = NULLHANDLE;
     HWND                            hHScroll = NULLHANDLE;
     HWND                            hVScroll = NULLHANDLE;
+    HWND                            hMenuBar = NULLHANDLE;
+    HWND                            hMenu1 = NULLHANDLE;
+    HWND                            hMenu2 = NULLHANDLE;
+    HWND                            hFrame = NULLHANDLE;
     SWP                             vSwp;
     SWP                             vSwpTitlebar;
     SWP                             vSwpVScroll;
     SWP                             vSwpHScroll;
+    SWP                             vSwpMenu;
+    RGB2                            vRgb;
 
     m_hDefaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON);
     memset(&vSwp, '\0', sizeof(SWP));
     memset(&vSwpTitlebar, '\0', sizeof(SWP));
     memset(&vSwpVScroll, '\0', sizeof(SWP));
     memset(&vSwpHScroll, '\0', sizeof(SWP));
+
     if (pParent)
         hParent = GetWinHwnd(pParent);
     else
@@ -844,8 +866,8 @@ bool wxFrame::OS2Create(
     // Create the client window.  We must call the API from here rather than
     // the static base class create because we need a separate handle
     //
-    if ((hClient = ::WinCreateWindow( GetHwnd()   // Frame is parent
-                                     ,zWclass     // Custom client class
+    if ((hClient = ::WinCreateWindow( hFrame   // Frame is parent
+                                     ,wxFrameClassName
                                      ,NULL        // Window title
                                      ,0           // No styles
                                      ,0, 0, 0, 0  // Window position
@@ -861,7 +883,7 @@ bool wxFrame::OS2Create(
     //
     // Send anything to initialize the frame
     //
-    ::WinSendMsg( GetHwnd()
+    ::WinSendMsg( hFrame
                  ,WM_UPDATEFRAME
                  ,(MPARAM)FCF_TASKLIST
                  ,(MPARAM)0
@@ -870,7 +892,7 @@ bool wxFrame::OS2Create(
     //
     // Now size everything.  If adding a menu the client will need to be resized.
     //
-    if (!::WinSetWindowPos( GetHwnd()
+    if (!::WinSetWindowPos( hFrame
                            ,HWND_TOP
                            ,nX
                            ,nY
@@ -880,21 +902,34 @@ bool wxFrame::OS2Create(
                           ))
         return FALSE;
 
-    WinQueryWindowPos(GetHwnd(), &vSwp);
+    WinQueryWindowPos(hFrame, &vSwp);
 
+    //
+    // Set the client window's background, otherwise it is transparent!
+    //
+    wxColour                        vColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
+
+    vRgb.bRed   = (BYTE)vColour.Red();
+    vRgb.bGreen = (BYTE)vColour.Green();
+    vRgb.bBlue  = (BYTE)vColour.Blue();
+    WinSetPresParam( hClient
+                    ,PP_BACKGROUNDCOLOR
+                    ,(ULONG)sizeof(RGB2)
+                    ,(PVOID)&vRgb
+                   );
     if (ulCreateFlags & FCF_TITLEBAR)
     {
-        hTitlebar = WinWindowFromID(GetHwnd(), FID_TITLEBAR);
+        hTitlebar = WinWindowFromID(hFrame, FID_TITLEBAR);
         WinQueryWindowPos(hTitlebar, &vSwpTitlebar);
     }
     if (ulCreateFlags & FCF_HORZSCROLL)
     {
-        hHScroll = WinWindowFromID(GetHwnd(), FID_HORZSCROLL);
+        hHScroll = WinWindowFromID(hFrame, FID_HORZSCROLL);
         WinQueryWindowPos(hHScroll, &vSwpHScroll);
     }
     if (ulCreateFlags & FCF_VERTSCROLL)
     {
-        hVScroll = WinWindowFromID(GetHwnd(), FID_VERTSCROLL);
+        hVScroll = WinWindowFromID(hFrame, FID_VERTSCROLL);
         WinQueryWindowPos(hVScroll, &vSwpVScroll);
     }
     if (!::WinSetWindowPos( hClient
@@ -907,6 +942,7 @@ bool wxFrame::OS2Create(
                           ))
         return FALSE;
     WinQueryWindowPos(hClient, &vSwp);
+    ::WinShowWindow(hClient, TRUE);
     return TRUE;
 } // end of wxFrame::OS2Create
 
index c90a5ebbdfead3b1b641b2d0fa050e0f6d54eade..a08ced90aabcdf072021ef778c21781cca29312d 100644 (file)
@@ -86,10 +86,16 @@ void wxMenu::Init()
                                       ,0L
                                       ,NULL
                                       ,NULL
-                                     )) != 0)
+                                     )) == 0)
     {
         wxLogLastError("WinLoadMenu");
     }
+    m_vMenuData.iPosition   = 0;
+    m_vMenuData.afStyle     = MIS_SUBMENU | MIS_TEXT;
+    m_vMenuData.afAttribute = (USHORT)0;
+    m_vMenuData.id          = (USHORT)0;
+    m_vMenuData.hwndSubMenu = m_hMenu;
+    m_vMenuData.hItem       = NULLHANDLE;
 
     //
     // If we have a title, insert it in the beginning of the menu
@@ -207,6 +213,9 @@ bool wxMenu::DoInsertOrAppend(
 , size_t                            nPos
 )
 {
+    ERRORID                         vError;
+    wxString                        sError;
+
 #if wxUSE_ACCEL
     UpdateAccel(pItem);
 #endif // wxUSE_ACCEL
@@ -270,47 +279,29 @@ bool wxMenu::DoInsertOrAppend(
         pData = (char*)pItem->GetText().c_str();
     }
 
-    BOOL                            bOk;
+    APIRET                          rc;
+
+    m_vMenuData.hwndSubMenu = NULLHANDLE;
+    m_vMenuData.hItem       = NULLHANDLE;
 
     //
-    // -1 means this is a sub menu not a menuitem.  We must create a window for it.
-    // Submenus are also attached to a menubar so its parent and owner should be the handle of the menubar.
+    // -1 means append at end
     //
     if (nPos == (size_t)-1)
     {
-        HWND                        hMenuBar;
-        if (m_menuBar)
-            hMenuBar = GetWinHwnd(m_menuBar);
-        else
-            hMenuBar = HWND_DESKTOP;
-        HWND                        hSubMenu = ::WinCreateWindow( hMenuBar              // parent
-                                                                 ,WC_MENU               // type
-                                                                 ,"Menu"                // a generic name
-                                                                 ,0L                    // no style flag
-                                                                 ,0L,0L,0L,0L           // no position
-                                                                 ,hMenuBar              // no owner
-                                                                 ,HWND_TOP              // always on top
-                                                                 ,0L                    // no ID needed for dynamic creation
-                                                                 ,NULL                  // no control data
-                                                                 ,NULL                  // no presentation params
-                                                                );
-
-        m_vMenuData.iPosition   = 0;
-        m_vMenuData.hwndSubMenu = hSubMenu;
-        m_vMenuData.hItem       = NULLHANDLE;
-
-        bOk = (bool)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&m_vMenuData, (MPARAM)pItem->GetText().c_str());
+        m_vMenuData.iPosition = MIT_END;
     }
     else
     {
         m_vMenuData.iPosition   = nPos;
-        m_vMenuData.hwndSubMenu = NULLHANDLE;
-        m_vMenuData.hItem       = NULLHANDLE;
-        bOk = (bool)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&m_vMenuData, (MPARAM)pItem->GetText().c_str());
     }
 
-    if (!bOk)
+    rc = (APIRET)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&m_vMenuData, (MPARAM)pData);
+    if (rc == MIT_MEMERROR || rc == MIT_ERROR)
     {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+        wxLogError("Error inserting or appending a menuitem. Error: %s\n", sError);
         wxLogLastError("Insert or AppendMenu");
         return FALSE;
     }
@@ -625,6 +616,7 @@ WXHMENU wxMenuBar::Create()
 {
     MENUITEM                        vItem;
     HWND                            hFrame;
+    HWND                            hMenuBar = NULLHANDLE;
 
     if (m_hMenu != 0 )
         return m_hMenu;
@@ -662,19 +654,13 @@ WXHMENU wxMenuBar::Create()
     {
         size_t                      nCount = GetMenuCount();
 
+        hMenuBar = GetHwnd();
         for (size_t i = 0; i < nCount; i++)
         {
-            vItem.iPosition   = 0;
-            vItem.afStyle     = MIS_SUBMENU | MIS_TEXT;
-            vItem.afAttribute = (USHORT)0;
-            vItem.id          = (USHORT)0;
-            vItem.hwndSubMenu = m_menus[i]->GetHMenu();
-            vItem.hItem       = NULLHANDLE;
-
-            ::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&vItem, (MPARAM)m_titles[i].c_str());
+            ::WinSendMsg(hMenuBar, MM_INSERTITEM, (MPARAM)&m_menus[i]->m_vMenuData, (MPARAM)m_titles[i].c_str());
         }
     }
-    return m_hMenu;
+    return hMenuBar;
 } // end of wxMenuBar::Create
 
 // ---------------------------------------------------------------------------
index 3dee795eca02fd34142122bbdf887bda35184b0d..55da0d4963455e60126a58af13f56ed96efc7206 100644 (file)
 #include "wx/window.h"
 #include "wx/os2/private.h"
 
-// TODO: see ::SystemParametersInfo for all sorts of Windows settings.
-// Different args are required depending on the id. How does this differ
-// from GetSystemMetric, and should it? Perhaps call it GetSystemParameter
-// and pass an optional void* arg to get further info.
-// Should also have SetSystemParameter.
-// Also implement WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
-wxColour wxSystemSettings::GetSystemColour(int index)
+wxColour wxSystemSettings::GetSystemColour(
+  int                               nIndex
+)
 {
-    // TODO
-    return wxColour();
-}
+    COLORREF                        vRef;
+    wxColour                        vCol;
+    switch (nIndex)
+    {
+        //
+        // PM actually has values for these
+        //
+        case wxSYS_COLOUR_WINDOW:
+            vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+                                             ,SYSCLR_WINDOW
+                                             ,0L
+                                            );
+            vCol.Set( GetRValue(vRef)
+                     ,GetGValue(vRef)
+                     ,GetBValue(vRef)
+                    );
+            return vCol;
+            break;
+
+        case wxSYS_COLOUR_WINDOWFRAME:
+            vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+                                             ,SYSCLR_WINDOWFRAME
+                                             ,0L
+                                            );
+            vCol.Set( GetRValue(vRef)
+                     ,GetGValue(vRef)
+                     ,GetBValue(vRef)
+                    );
+            return vCol;
+            break;
+
+        case wxSYS_COLOUR_MENUTEXT:
+            vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+                                             ,SYSCLR_MENUTEXT
+                                             ,0L
+                                            );
+            vCol.Set( GetRValue(vRef)
+                     ,GetGValue(vRef)
+                     ,GetBValue(vRef)
+                    );
+            break;
+
+        case wxSYS_COLOUR_BTNFACE:
+            vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+                                             ,SYSCLR_BUTTONDEFAULT
+                                             ,0L
+                                            );
+            vCol.Set( GetRValue(vRef)
+                     ,GetGValue(vRef)
+                     ,GetBValue(vRef)
+                    );
+            return vCol;
+            break;
+
+        case wxSYS_COLOUR_BTNSHADOW:
+            vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+                                             ,SYSCLR_BUTTONMIDDLE
+                                             ,0L
+                                            );
+            vCol.Set( GetRValue(vRef)
+                     ,GetGValue(vRef)
+                     ,GetBValue(vRef)
+                    );
+            return vCol;
+            break;
+
+        case wxSYS_COLOUR_BTNHIGHLIGHT:
+            vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+                                             ,SYSCLR_BUTTONLIGHT
+                                             ,0L
+                                            );
+            vCol.Set( GetRValue(vRef)
+                     ,GetGValue(vRef)
+                     ,GetBValue(vRef)
+                    );
+            return vCol;
+            break;
+
+        //
+        // We'll have to just give values to these
+        //
+        case wxSYS_COLOUR_LISTBOX:
+        case wxSYS_COLOUR_CAPTIONTEXT:
+            return(*wxWHITE);
+            break;
+
+        case wxSYS_COLOUR_WINDOWTEXT:
+        case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
+        case wxSYS_COLOUR_BTNTEXT:
+        case wxSYS_COLOUR_INFOTEXT:
+            return(*wxBLACK);
+            break;
+
+        //
+        // We should customize these to look like other ports
+        //
+
+        case wxSYS_COLOUR_ACTIVECAPTION:
+        case wxSYS_COLOUR_ACTIVEBORDER:
+        case wxSYS_COLOUR_HIGHLIGHT:
+            return(*wxBLUE);
+            break;
+
+        case wxSYS_COLOUR_SCROLLBAR:
+        case wxSYS_COLOUR_BACKGROUND:
+        case wxSYS_COLOUR_INACTIVECAPTION:
+        case wxSYS_COLOUR_MENU:
+        case wxSYS_COLOUR_INACTIVEBORDER:
+        case wxSYS_COLOUR_APPWORKSPACE:
+        case wxSYS_COLOUR_HIGHLIGHTTEXT:
+        case wxSYS_COLOUR_GRAYTEXT:
+        case wxSYS_COLOUR_3DDKSHADOW:
+        case wxSYS_COLOUR_3DLIGHT:
+        case wxSYS_COLOUR_INFOBK:
+            return(*wxLIGHT_GREY);
+            break;
+
+        default:
+            vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+                                             ,SYSCLR_WINDOW
+                                             ,0L
+                                            );
+            vCol.Set( GetRValue(vRef)
+                     ,GetGValue(vRef)
+                     ,GetBValue(vRef)
+                    );
+            return vCol;
+            break;
+    }
+    return(vCol);
+} // end of wxSystemSettings::GetSystemColour
 
 wxFont wxSystemSettings::GetSystemFont(int index)
 {