]> git.saurik.com Git - wxWidgets.git/commitdiff
no message
authorDavid Webster <Dave.Webster@bhmi.com>
Fri, 18 Feb 2000 23:35:39 +0000 (23:35 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Fri, 18 Feb 2000 23:35:39 +0000 (23:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/os2/menu.h
include/wx/os2/window.h
src/os2/frame.cpp

index 6719c9e563143170a8cc3c45ac763804184bf7f3..1dd6a5cef8d5bff8e1f0e485c78fb29b65bc0751 100644 (file)
@@ -165,7 +165,8 @@ public:
 #endif // wxUSE_ACCEL
 
         // get the menu handle
-    WXHMENU GetHMenu() const { return m_hMenu; }
+    WXHMENU       GetHMenu() const { return m_hMenu; }
+    unsigned long GetMenubarId() const { return m_ulMenubarId; }
 
     // if the menubar is modified, the display is not updated automatically,
     // call this function to update it (m_menuBarFrame should be !NULL)
@@ -183,8 +184,9 @@ protected:
 
     wxArrayString m_titles;
 
-    wxFrame      *m_menuBarFrame;
-    WXHMENU       m_hMenu;
+    wxFrame*                        m_menuBarFrame;
+    WXHMENU                         m_hMenu;
+    unsigned long                   m_ulMenubarId;
 
 #if wxUSE_ACCEL
     // the accelerator table for all accelerators in all our menus
index 3688662527630fb67d9dec7e6ec385414b665511..735da9fa70552cdeb6340d3bde5c454a76f52038 100644 (file)
@@ -494,6 +494,7 @@ protected:
 #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;
index 5a91d2c6d1e309b168d8e8ec56528f7d92be0ce1..6041cc2b5a77b17f90af33f3eccedaf54dad709e 100644 (file)
@@ -438,51 +438,74 @@ bool wxFrame::IsMaximized() const
     return (vSwp.fl & SWP_MAXIMIZE);
 } // end of wxFrame::IsMaximized
 
-void wxFrame::SetIcon(const wxIcon& icon)
+void wxFrame::SetIcon(
+  const wxIcon&                     rIcon
+)
 {
-    wxFrameBase::SetIcon(icon);
+    wxFrameBase::SetIcon(rIcon);
 
-// TODO:
-/*
-    if ( m_icon.Ok() )
+    if (m_icon.Ok())
     {
-        SendMessage(GetHwnd(), WM_SETICON,
-                    (WPARAM)TRUE, (LPARAM)(HICON) m_icon.GetHICON());
+        WinSendMessage( GetHwnd()
+                       ,WM_SETICON
+                       ,(HICON) m_icon.GetHICON()
+                       ,NULL
+                      )
     }
-*/
-}
+} // end of wxFrame::SetIcon
 
 #if wxUSE_STATUSBAR
-wxStatusBar *wxFrame::OnCreateStatusBar(int number,
-                                        long style,
-                                        wxWindowID id,
-                                        const wxString& name)
+wxStatusBar* wxFrame::OnCreateStatusBar(
+  int                               nNumber
+, long                              lStyle
+, wxWindowID                        vId
+, const wxString&                   rName
+)
 {
-    wxStatusBar *statusBar = NULL;
+    wxStatusBar*                    pStatusBar = NULL;
 
-    statusBar = wxFrameBase::OnCreateStatusBar(number, style, id, name);
-
-    return statusBar;
-}
+    pStatusBar = wxFrameBase::OnCreateStatusBar( nNumber
+                                                ,lStyle
+                                                ,vId
+                                                ,rName
+                                               );
+    return pStatusBar;
+} // end of wxFrame::OnCreateStatusBar
 
 void wxFrame::PositionStatusBar()
 {
-// TODO:
-/*
-    // native status bar positions itself
-    if ( m_frameStatusBar )
+    //
+    // Native status bar positions itself
+    //
+    if (m_frameStatusBar)
     {
-        int w, h;
-        GetClientSize(&w, &h);
-        int sw, sh;
-        m_frameStatusBar->GetSize(&sw, &sh);
+        int                         nWidth
+        int                         nHeight;
+        int                         nStatbarWidth
+        int                         nStatbarHeight;
+        HWND                        hWndClient;
+        RECTL                       vRect;
+
+        hWndClient = ::WinWindowFromId(GetHwnd(), FID_CLIENT);
+        ::WinQueryWindowRect(hWndClient, &vRect);
+        nWidth = vRect.xRight - vRect.xLeft;
+        nHeight = vRect.xTop - vRect.xBottom;
+        
+        m_frameStatusBar->GetSize( &nStatbarWidth
+                                  ,&nStatbarHeight
+                                 );
 
+        //
         // Since we wish the status bar to be directly under the client area,
         // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
-        m_frameStatusBar->SetSize(0, h, w, sh);
+        //
+        m_frameStatusBar->SetSize( 0
+                                  ,nHeight
+                                  ,nWidth
+                                  ,nStatbarHeight
+                                 );
     }
-*/
-}
+} // end of wxFrame::PositionStatusBar
 #endif // wxUSE_STATUSBAR
 
 void wxFrame::DetachMenuBar()
@@ -492,42 +515,51 @@ void wxFrame::DetachMenuBar()
         m_frameMenuBar->Detach();
         m_frameMenuBar = NULL;
     }
-}
+} // end of wxFrame::DetachMenuBar
 
-void wxFrame::SetMenuBar(wxMenuBar *menu_bar)
+void wxFrame::SetMenuBar(
+  wxMenuBar*                        pMenuBbar
+)
 {
-    if (!menu_bar)
+    if (!pMenuBar)
     {
         DetachMenuBar();
         return;
     }
 
-    wxCHECK_RET( !menu_bar->GetFrame(), wxT("this menubar is already attached") );
+    wxCHECK_RET(!pMenuBar->GetFrame(), wxT("this menubar is already attached"));
 
     if (m_frameMenuBar)
         delete m_frameMenuBar;
 
-    m_hMenu = menu_bar->Create();
+    m_hMenu = pMenuBbar->Create();
+    m_ulMenubarId = pMenubar->GetMenubarId();
+    if (m_ulMenubarId != FID_MENU)
+    {
+        ::WinSetWIndowUShort( m_hMenu
+                             ,QWS_ID
+                             ,(unsigned short(m_ulMenubarId)
+                            );
+    }
 
-    if ( !m_hMenu )
+    if (!m_hMenu)
         return;
 
     InternalSetMenuBar();
 
     m_frameMenuBar = menu_bar;
     menu_bar->Attach(this);
-}
+} // end of wxFrame::SetMenuBar
 
 void wxFrame::InternalSetMenuBar()
 {
-// TODO:
-/*
-    if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
-    {
-        wxLogLastError("SetMenu");
-    }
-*/
-}
+        
+    ::WinPostMsg( GetHwnd()
+                 ,WM_UPDATEFRAME
+                 ,FCF_MENU
+                 ,NULL
+                );
+} // end of wxFrame::InternalSetMenuBar
 
 // Responds to colour changes, and passes event on to children.
 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)