diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index fc424557b7..d38fd1c674 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -12,7 +12,7 @@ #define _WX_FRAME_H_ #if wxUSE_TASKBARBUTTON -class WXDLLIMPEXP_FWD_ADV wxTaskBarButton; +class WXDLLIMPEXP_FWD_CORE wxTaskBarButton; #endif class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase @@ -40,6 +40,9 @@ public: const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); +#if wxUSE_TASKBARBUTTON + virtual ~wxFrame(); +#endif // implement base class pure virtuals virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); @@ -179,7 +182,7 @@ private: bool m_wasMinimized; #if wxUSE_TASKBARBUTTON - wxTaskBarButton *m_taskBarButton; + wxTaskBarButton* m_taskBarButton; #endif DECLARE_EVENT_TABLE() diff --git a/include/wx/msw/taskbarbutton.h b/include/wx/msw/taskbarbutton.h index d3cd7194ea..9c91aea189 100644 --- a/include/wx/msw/taskbarbutton.h +++ b/include/wx/msw/taskbarbutton.h @@ -14,6 +14,7 @@ #include "wx/defs.h" #include "wx/vector.h" +#include "wx/taskbarbutton.h" namespace { class ITaskbarList3; diff --git a/include/wx/msw/toplevel.h b/include/wx/msw/toplevel.h index 5692a86383..93427a7a45 100644 --- a/include/wx/msw/toplevel.h +++ b/include/wx/msw/toplevel.h @@ -121,22 +121,6 @@ public: // returns true if the platform should explicitly apply a theme border virtual bool CanApplyThemeBorder() const { return false; } -#if wxUSE_MENUS && !defined(__WXUNIVERSAL__) - bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); - - // handle WM_EXITMENULOOP message for Win95 only - bool HandleExitMenuLoop(WXWORD isPopup); - - // handle WM_(UN)INITMENUPOPUP message to generate wxEVT_MENU_OPEN/CLOSE - bool HandleMenuPopup(wxEventType evtType, WXHMENU hMenu); - - // Command part of HandleMenuPopup() and HandleExitMenuLoop(). - bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool popup); - - // Find the menu corresponding to the given handle. - virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu); -#endif // wxUSE_MENUS && !__WXUNIVERSAL__ - protected: // common part of all ctors void Init(); @@ -251,10 +235,6 @@ private: // MSWGetSystemMenu(). Owned by this window. wxMenu *m_menuSystem; - // The number of currently opened menus: 0 initially, 1 when a top level - // menu is opened, 2 when its submenu is opened and so on. - int m_menuDepth; - DECLARE_EVENT_TABLE() wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW); }; diff --git a/include/wx/taskbarbutton.h b/include/wx/taskbarbutton.h index 986c39b399..0dbeeb5f66 100644 --- a/include/wx/taskbarbutton.h +++ b/include/wx/taskbarbutton.h @@ -27,7 +27,6 @@ class WXDLLIMPEXP_FWD_CORE ICustomDestinationList; class WXDLLIMPEXP_FWD_CORE IApplicationDocumentLists; } - /** State of the task bar button. */ @@ -255,10 +254,6 @@ private: bool m_frequent_visible; }; -#if defined(__WXMSW__) - #include "wx/msw/taskbarbutton.h" -#endif - #endif // wxUSE_TASKBARBUTTON #endif // _WX_TASKBARBUTTON_H_ diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 16255bb537..3e6f864027 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -57,7 +57,7 @@ #endif // __WXUNIVERSAL__ #if wxUSE_TASKBARBUTTON - #include "wx/taskbarbutton.h" + #include "wx/msw/taskbarbutton.h" #include "wx/dynlib.h" WXUINT wxMsgTaskbarButtonCreated = 0; @@ -182,17 +182,13 @@ bool wxFrame::Create(wxWindow *parent, return true; } +#if wxUSE_TASKBARBUTTON wxFrame::~wxFrame() { - SendDestroyEvent(); - - DeleteAllBars(); - -#if wxUSE_TASKBARBUTTON if ( m_taskBarButton ) delete m_taskBarButton; -#endif } +#endif // ---------------------------------------------------------------------------- // wxFrame client size calculations diff --git a/src/msw/taskbarbutton.cpp b/src/msw/taskbarbutton.cpp index 50b67369b9..fb739f01d0 100644 --- a/src/msw/taskbarbutton.cpp +++ b/src/msw/taskbarbutton.cpp @@ -22,7 +22,7 @@ #if wxUSE_TASKBARBUTTON #include "wx/msw/private.h" -#include "wx/taskbarbutton.h" +#include "wx/msw/taskbarbutton.h" #include #include @@ -209,14 +209,16 @@ public: }; #ifdef wxUSE_UNICODE -#define IShellLink IShellLinkW +#define IShellLink ::IShellLinkW + DEFINE_GUID(wxIID_IShellLink, 0x000214F9, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); #else -#define IShellLink IShellLinkA +#define IShellLink ::IShellLinkA + DEFINE_GUID(wxIID_IShellLink, 0x000214EE, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); -#endif +#endif // wxUSE_UNICODE typedef enum _SIGDN diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 2da64c471e..028660b1f6 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -63,15 +63,6 @@ #define ICON_SMALL 0 #endif -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -#if wxUSE_MENUS || wxUSE_MENUS_NATIVE - extern wxMenu *wxCurrentPopupMenu; -#endif // wxUSE_MENUS || wxUSE_MENUS_NATIVE - - // ---------------------------------------------------------------------------- // stubs for missing functions under MicroWindows // ---------------------------------------------------------------------------- @@ -1443,117 +1434,6 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event) } } -#if wxUSE_MENUS && !defined(__WXUNIVERSAL__) - -bool -wxTopLevelWindowMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) -{ - // Ignore the special messages generated when the menu is closed (this is - // the only case when the flags are set to -1), in particular don't clear - // the help string in the status bar when this happens as it had just been - // restored by the base class code. - if ( !hMenu && flags == 0xffff ) - return false; - - // Unfortunately we also need to ignore another message which is sent after - // closing the currently active submenu of the menu bar by pressing Escape: - // in this case we get WM_UNINITMENUPOPUP, from which we generate - // wxEVT_MENU_CLOSE, and _then_ we get WM_MENUSELECT for the top level menu - // from which we overwrite the help string just restored by OnMenuClose() - // handler in wxFrameBase. To prevent this from happening we discard these - // messages but only in the case it's really the top level menu as we still - // need to clear the help string when a submenu is selected in a menu. - if ( flags == (MF_POPUP | MF_HILITE) && !m_menuDepth ) - return false; - - // sign extend to int from unsigned short we get from Windows - int item = (signed short)nItem; - - // WM_MENUSELECT is generated for both normal items and menus, including - // the top level menus of the menu bar, which can't be represented using - // any valid identifier in wxMenuEvent so use an otherwise unused value for - // them - if ( flags & (MF_POPUP | MF_SEPARATOR) ) - item = wxID_NONE; - - wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item); - event.SetEventObject(this); - - if ( HandleWindowEvent(event) ) - return true; - - // by default, i.e. if the event wasn't handled above, clear the status bar - // text when an item which can't have any associated help string in wx API - // is selected - if ( item == wxID_NONE ) - DoGiveHelp(wxEmptyString, true); - - return false; -} - -bool -wxTopLevelWindowMSW::DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool popup) -{ - // Update the menu depth when dealing with the top level menus. - if ( !popup ) - { - if ( evtType == wxEVT_MENU_OPEN ) - { - m_menuDepth++; - } - else if ( evtType == wxEVT_MENU_CLOSE ) - { - wxASSERT_MSG( m_menuDepth > 0, wxS("No open menus?") ); - - m_menuDepth--; - } - else - { - wxFAIL_MSG( wxS("Unexpected menu event type") ); - } - } - - wxMenuEvent event(evtType, popup ? wxID_ANY : 0, menu); - event.SetEventObject(menu); - - return HandleWindowEvent(event); -} - -bool wxTopLevelWindowMSW::HandleExitMenuLoop(WXWORD isPopup) -{ - return DoSendMenuOpenCloseEvent(wxEVT_MENU_CLOSE, - isPopup ? wxCurrentPopupMenu : NULL, - isPopup != 0); -} - -bool wxTopLevelWindowMSW::HandleMenuPopup(wxEventType evtType, WXHMENU hMenu) -{ - bool isPopup = false; - wxMenu* menu = NULL; - if ( wxCurrentPopupMenu && wxCurrentPopupMenu->GetHMenu() == hMenu ) - { - menu = wxCurrentPopupMenu; - isPopup = true; - } - else - { - menu = MSWFindMenuFromHMENU(hMenu); - } - - - return DoSendMenuOpenCloseEvent(evtType, menu, isPopup); -} - -wxMenu* wxTopLevelWindowMSW::MSWFindMenuFromHMENU(WXHMENU WXUNUSED(hMenu)) -{ - // We don't have any menus at this level. - return NULL; -} - -#endif // wxUSE_MENUS && !__WXUNIVERSAL__ - - - // the DialogProc for all wxWidgets dialogs LONG APIENTRY _EXPORT wxDlgProc(HWND hDlg,