]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/frame.cpp
wxMutex changes (explicitly specify the type), return values for all wxMutex/wxSemaph...
[wxWidgets.git] / src / msw / frame.cpp
index 920e95879b136dd8ea26c392002e366a230d8288..98c8c7eacdcd5523ef33754120cad4d4fa68711e 100644 (file)
 // globals
 // ----------------------------------------------------------------------------
 
-extern const wxChar *wxFrameClassName;
-
 #if wxUSE_MENUS_NATIVE
-extern wxMenu *wxCurrentPopupMenu;
+    extern wxMenu *wxCurrentPopupMenu;
 #endif // wxUSE_MENUS_NATIVE
 
 // ----------------------------------------------------------------------------
@@ -495,6 +493,8 @@ void wxFrame::PositionToolBar()
         else
         {
             tw = width;
+            if ( toolbar->GetWindowStyleFlag() & wxTB_FLAT )
+                th -= 3;
         }
 
         // use the 'real' MSW position here, don't offset relativly to the
@@ -602,8 +602,9 @@ bool wxFrame::HandlePaint()
 #ifndef __WXMICROWIN__
         if ( m_iconized )
         {
-            HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
-                                      : (HICON)GetDefaultIcon();
+            const wxIcon& icon = GetIcon();
+            HICON hIcon = icon.Ok() ? GetHiconOf(icon)
+                                    : (HICON)GetDefaultIcon();
 
             // Hold a pointer to the dc so long as the OnPaint() message
             // is being processed
@@ -691,9 +692,7 @@ bool wxFrame::HandleSize(int x, int y, WXUINT id)
         PositionToolBar();
 #endif // wxUSE_TOOLBAR
 
-        wxSizeEvent event(wxSize(x, y), m_windowId);
-        event.SetEventObject( this );
-        processed = GetEventHandler()->ProcessEvent(event);
+        processed = wxWindow::HandleSize(x, y, id);
     }
 
     return processed;
@@ -747,23 +746,27 @@ bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
 #endif
     else
     {
-#if wxUSE_STATUSBAR
         // don't give hints for separators (doesn't make sense) nor for the
         // items opening popup menus (they don't have them anyhow) but do clear
         // the status line - otherwise, we would be left with the help message
         // for the previous item which doesn't apply any more
-        wxStatusBar *statbar = GetStatusBar();
-        if ( statbar )
-        {
-            statbar->SetStatusText(wxEmptyString);
-        }
-#endif // wxUSE_STATUSBAR
+        DoGiveHelp(wxEmptyString, FALSE);
 
         return FALSE;
     }
 
     wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
-    event.SetEventObject( this );
+    event.SetEventObject(this);
+
+    return GetEventHandler()->ProcessEvent(event);
+}
+
+bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup)
+{
+    // we don't have the menu id here, so we use the id to specify if the event
+    // was from a popup menu or a normal one
+    wxMenuEvent event(evtType, isPopup ? -1 : 0);
+    event.SetEventObject(this);
 
     return GetEventHandler()->ProcessEvent(event);
 }
@@ -785,6 +788,10 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
             processed = !Close();
             break;
 
+        case WM_SIZE:
+            processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
+            break;
+
         case WM_COMMAND:
             {
                 WORD id, cmd;
@@ -796,6 +803,10 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
             }
             break;
 
+        case WM_PAINT:
+            processed = HandlePaint();
+            break;
+
 #ifndef __WXMICROWIN__
         case WM_MENUSELECT:
             {
@@ -806,30 +817,31 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
                 processed = HandleMenuSelect(item, flags, hmenu);
             }
             break;
-#endif
 
-        case WM_PAINT:
-            processed = HandlePaint();
+#ifndef __WIN16__
+        case WM_ENTERMENULOOP:
+            processed = HandleMenuLoop(wxEVT_MENU_OPEN, wParam);
             break;
 
-#ifndef __WXMICROWIN__
+        case WM_EXITMENULOOP:
+            processed = HandleMenuLoop(wxEVT_MENU_CLOSE, wParam);
+            break;
+#endif // __WIN16__
+
         case WM_QUERYDRAGICON:
             {
-                HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
-                                          : (HICON)GetDefaultIcon();
+                const wxIcon& icon = GetIcon();
+                HICON hIcon = icon.Ok() ? GetHiconOf(icon)
+                                        : (HICON)GetDefaultIcon();
                 rc = (long)hIcon;
                 processed = rc != 0;
             }
             break;
-#endif
-
-        case WM_SIZE:
-            processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
-            break;
+#endif // !__WXMICROWIN__
     }
 
     if ( !processed )
-        rc = wxWindow::MSWWindowProc(message, wParam, lParam);
+        rc = wxFrameBase::MSWWindowProc(message, wParam, lParam);
 
     return rc;
 }