diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index f66828d1f2..b4d6b3718e 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -1204,7 +1204,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/xpmdecod.h wx/xpmhand.h wx/xrc/xmlreshandler.h - wx/taskbarbutton.h @@ -2002,7 +2001,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/msw/textentry.cpp src/msw/tglbtn.cpp src/msw/treectrl.cpp - src/msw/taskbarbutton.cpp wx/generic/clrpickerg.h @@ -2098,7 +2096,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/msw/toplevel.h wx/msw/treectrl.h wx/msw/window.h - wx/msw/taskbarbutton.h diff --git a/build/files b/build/files index 0795577838..e4a601288d 100644 --- a/build/files +++ b/build/files @@ -757,7 +757,6 @@ GUI_CMN_HDR = wx/statbox.h wx/stattext.h wx/statusbr.h - wx/taskbarbutton.h wx/testing.h wx/textcompleter.h wx/textctrl.h @@ -1626,7 +1625,6 @@ MSW_SRC = src/msw/statusbar.cpp src/msw/statline.cpp src/msw/stattext.cpp - src/msw/taskbarbutton.cpp src/msw/toolbar.cpp src/msw/textctrl.cpp src/msw/textentry.cpp @@ -1718,7 +1716,6 @@ MSW_HDR = wx/msw/statusbar.h wx/msw/statline.h wx/msw/stattext.h - wx/msw/taskbarbutton.h wx/msw/toolbar.h wx/msw/textctrl.h wx/msw/textentry.h diff --git a/build/msw/wx_core.vcxproj b/build/msw/wx_core.vcxproj index 88a15226c1..1b69afb0f2 100644 --- a/build/msw/wx_core.vcxproj +++ b/build/msw/wx_core.vcxproj @@ -1002,7 +1002,6 @@ - @@ -1123,7 +1122,6 @@ - @@ -1329,7 +1327,6 @@ - @@ -1373,4 +1370,4 @@ - + \ No newline at end of file diff --git a/build/msw/wx_core.vcxproj.filters b/build/msw/wx_core.vcxproj.filters index 7eacd606e5..4aa3c32166 100644 --- a/build/msw/wx_core.vcxproj.filters +++ b/build/msw/wx_core.vcxproj.filters @@ -837,9 +837,6 @@ MSW Sources - - MSW Sources - MSW Sources @@ -1615,9 +1612,6 @@ MSW Headers - - MSW Headers - MSW Headers @@ -1798,9 +1792,6 @@ Common Headers - - Common Headers - Common Headers @@ -1912,4 +1903,4 @@ MSW Headers - + \ No newline at end of file diff --git a/include/wx/gtk/setup0.h b/include/wx/gtk/setup0.h index 29351a6891..1ee8f50321 100644 --- a/include/wx/gtk/setup0.h +++ b/include/wx/gtk/setup0.h @@ -1565,15 +1565,6 @@ // Recommended setting: 1, set to 0 for a tiny library size reduction #define wxUSE_TASKBARICON_BALLOONS 1 -// Set this to 1 to enable following functionality added in Windows 7: thumbnail -// representations, thumbnail toolbars, notification and status overlays, -// progress indicators and jump lists. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a tiny library size reduction -#define wxUSE_TASKBARBUTTON 1 - // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 diff --git a/include/wx/msw/chkconf.h b/include/wx/msw/chkconf.h index 1450460f0a..d1bebed82b 100644 --- a/include/wx/msw/chkconf.h +++ b/include/wx/msw/chkconf.h @@ -86,14 +86,6 @@ # endif #endif /* wxUSE_TASKBARICON_BALLOONS */ -#ifndef wxUSE_TASKBARBUTTON -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_TASKBARBUTTON must be defined." -# else -# define wxUSE_TASKBARBUTTON 0 -# endif -#endif /* wxUSE_TASKBARBUTTON */ - #ifndef wxUSE_UXTHEME # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_UXTHEME must be defined." diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index fc424557b7..a2ba91f760 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -11,10 +11,6 @@ #ifndef _WX_FRAME_H_ #define _WX_FRAME_H_ -#if wxUSE_TASKBARBUTTON -class WXDLLIMPEXP_FWD_ADV wxTaskBarButton; -#endif - class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase { public: @@ -113,15 +109,6 @@ public: virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu); #endif // wxUSE_MENUS -#if wxUSE_TASKBARBUTTON - // Return the taskbar button of the window. - // - // The pointer returned by this method belongs to the window and will be - // deleted when the window itself is, do not delete it yourself. May return - // NULL if the initialization of taskbar button failed. - wxTaskBarButton* MSWGetTaskBarButton(); -#endif // wxUSE_TASKBARBUTTON - protected: // common part of all ctors void Init(); @@ -178,10 +165,6 @@ private: // used by IconizeChildFrames(), see comments there bool m_wasMinimized; -#if wxUSE_TASKBARBUTTON - wxTaskBarButton *m_taskBarButton; -#endif - DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) }; diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 2705a44f29..f968ecdbdb 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -1608,15 +1608,6 @@ // Recommended setting: 1, set to 0 for a tiny library size reduction #define wxUSE_TASKBARICON_BALLOONS 1 -// Set this to 1 to enable following functionality added in Windows 7: thumbnail -// representations, thumbnail toolbars, notification and status overlays, -// progress indicators and jump lists. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a tiny library size reduction -#define wxUSE_TASKBARBUTTON 1 - // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 diff --git a/include/wx/msw/setup_inc.h b/include/wx/msw/setup_inc.h index ea53b075cb..59bcb1aef0 100644 --- a/include/wx/msw/setup_inc.h +++ b/include/wx/msw/setup_inc.h @@ -100,15 +100,6 @@ // Recommended setting: 1, set to 0 for a tiny library size reduction #define wxUSE_TASKBARICON_BALLOONS 1 -// Set this to 1 to enable following functionality added in Windows 7: thumbnail -// representations, thumbnail toolbars, notification and status overlays, -// progress indicators and jump lists. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 for a tiny library size reduction -#define wxUSE_TASKBARBUTTON 1 - // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 diff --git a/include/wx/msw/taskbarbutton.h b/include/wx/msw/taskbarbutton.h deleted file mode 100644 index 1f6317a116..0000000000 --- a/include/wx/msw/taskbarbutton.h +++ /dev/null @@ -1,61 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/msw/taskbarbutton.h -// Purpose: Defines wxTaskBarButtonImpl class. -// Author: Chaobin Zhang -// Created: 2014-06-01 -// Copyright: (c) 2014 wxWidgets development team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_TASKBARBUTTON_H_ -#define _WX_MSW_TASKBARBUTTON_H_ - -#if wxUSE_TASKBARBUTTON - -#include "wx/defs.h" -#include "wx/vector.h" - -struct ITaskbarList3; - -class WXDLLIMPEXP_CORE wxTaskBarButtonImpl : public wxTaskBarButton { -public: - virtual ~wxTaskBarButtonImpl(); - - virtual void SetProgressRange(int range) wxOVERRIDE; - virtual void SetProgressValue(int value) wxOVERRIDE; - virtual void PulseProgress() wxOVERRIDE; - virtual void Show(bool show = true) wxOVERRIDE; - virtual void Hide() wxOVERRIDE; - virtual void SetThumbnailTooltip(const wxString& tooltip) wxOVERRIDE; - virtual void SetProgressState(wxTaskBarButtonState state) wxOVERRIDE; - virtual void SetOverlayIcon(const wxIcon& icon, - const wxString& description = wxString()) wxOVERRIDE; - virtual void SetThumbnailClip(const wxRect& rect) wxOVERRIDE; - virtual void SetThumbnailContents(const wxWindow *child) wxOVERRIDE; - virtual bool InsertThumbBarButton(size_t pos, - wxThumbBarButton *button) wxOVERRIDE; - virtual bool AppendThumbBarButton(wxThumbBarButton *button) wxOVERRIDE; - virtual wxThumbBarButton* RemoveThumbBarButton( - wxThumbBarButton *button) wxOVERRIDE; - virtual wxThumbBarButton* RemoveThumbBarButton(int id) wxOVERRIDE; - -private: - friend class wxFrame; - wxTaskBarButtonImpl(WXWidget parent); - - bool InitOrUpdateThumbBarButtons(); - wxThumbBarButton* GetThumbBarButtonByIndex(size_t index); - - WXWidget m_hwnd; - ITaskbarList3 *m_taskbarList; - - typedef wxVector wxThumbBarButtons; - wxThumbBarButtons m_thumbBarButtons; - - int m_progressRange; - bool m_hasInitThumbnailToolbar; -}; - -#endif // wxUSE_TASKBARBUTTON - -#endif // _WX_MSW_TASKBARBUTTON_H_ 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/msw/wince/chkconf.h b/include/wx/msw/wince/chkconf.h index 2a7753ca36..e269b511be 100644 --- a/include/wx/msw/wince/chkconf.h +++ b/include/wx/msw/wince/chkconf.h @@ -110,10 +110,6 @@ #undef wxUSE_TASKBARICON_BALLOONS #define wxUSE_TASKBARICON_BALLOONS 0 -// there is no support for taskbar button -#undef wxUSE_TASKBARBUTTON -#define wxUSE_TASKBARBUTTON 1 - // not sure if this is supported by eVC but VC8 SDK lacks the tooltips control // related declarations #if wxCHECK_VISUALC_VERSION(8) diff --git a/include/wx/taskbarbutton.h b/include/wx/taskbarbutton.h deleted file mode 100644 index b562139152..0000000000 --- a/include/wx/taskbarbutton.h +++ /dev/null @@ -1,112 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/taskbarbutton.h -// Purpose: Defines wxTaskBarButton class for manipulating buttons on the -// windows taskbar. -// Author: Chaobin Zhang -// Created: 2014-04-30 -// Copyright: (c) 2014 wxWidgets development team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TASKBARBUTTON_H_ -#define _WX_TASKBARBUTTON_H_ - -#if wxUSE_TASKBARBUTTON - -#include "wx/defs.h" - -// ---------------------------------------------------------------------------- -// wxTaskBarButton: define wxTaskBarButton interface. -// ---------------------------------------------------------------------------- - -/** - State of the task bar button. -*/ -enum WXDLLIMPEXP_CORE wxTaskBarButtonState -{ - wxTASKBAR_BUTTON_NO_PROGRESS = 0, - wxTASKBAR_BUTTON_INDETERMINATE = 1, - wxTASKBAR_BUTTON_NORMAL = 2, - wxTASKBAR_BUTTON_ERROR = 4, - wxTASKBAR_BUTTON_PAUSED = 8 -}; - -class WXDLLIMPEXP_CORE wxThumbBarButton : public wxObject { -public: - wxThumbBarButton() { } - wxThumbBarButton(int id, - const wxIcon& icon, - const wxString& tooltip = wxString(), - bool enable = true, - bool dismissOnClick = false, - bool hasBackground = true, - bool shown = true, - bool interactive = true); - - virtual ~wxThumbBarButton() {} - - bool Create(int id, - const wxIcon& icon, - const wxString& tooltip = wxString(), - bool enable = true, - bool dismissOnClick = false, - bool hasBackground = true, - bool shown = true, - bool interactive = true); - int GetID() const { return m_id; } - const wxIcon& GetIcon() const { return m_icon; } - const wxString& GetTooltip() const { return m_tooltip; } - bool IsEnable() const { return m_enable; } - bool IsDismissOnClick() const { return m_dismissOnClick; } - bool HasBackground() const { return m_hasBackground; } - bool IsShown() const { return m_shown; } - bool IsInteractive() const { return m_interactive; } - -private: - int m_id; - wxIcon m_icon; - wxString m_tooltip; - bool m_enable; - bool m_dismissOnClick; - bool m_hasBackground; - bool m_shown; - bool m_interactive; - - DECLARE_DYNAMIC_CLASS(wxThumbBarButton) -}; - -class WXDLLIMPEXP_CORE wxTaskBarButton -{ -public: - wxTaskBarButton() { } - virtual ~wxTaskBarButton() { } - - // Operations: - virtual void SetProgressRange(int range) = 0; - virtual void SetProgressValue(int value) = 0; - virtual void PulseProgress() = 0; - virtual void Show(bool show = true) = 0; - virtual void Hide() = 0; - virtual void SetThumbnailTooltip(const wxString& tooltip) = 0; - virtual void SetProgressState(wxTaskBarButtonState state) = 0; - virtual void SetOverlayIcon(const wxIcon& icon, - const wxString& description = wxString()) = 0; - virtual void SetThumbnailClip(const wxRect& rect) = 0; - virtual void SetThumbnailContents(const wxWindow *child) = 0; - virtual bool InsertThumbBarButton(size_t pos, wxThumbBarButton *button) = 0; - virtual bool AppendThumbBarButton(wxThumbBarButton *button) = 0; - virtual wxThumbBarButton* RemoveThumbBarButton(wxThumbBarButton *button) = 0; - virtual wxThumbBarButton* RemoveThumbBarButton(int id) = 0; - -private: - wxDECLARE_NO_COPY_CLASS(wxTaskBarButton); -}; - - -#if defined(__WXMSW__) - #include "wx/msw/taskbarbutton.h" -#endif - -#endif // wxUSE_TASKBARBUTTON - -#endif // _WX_TASKBARBUTTON_H_ diff --git a/interface/wx/frame.h b/interface/wx/frame.h index 584c6eca01..ae4a9b0ff5 100644 --- a/interface/wx/frame.h +++ b/interface/wx/frame.h @@ -445,23 +445,6 @@ public: */ virtual void SetToolBar(wxToolBar* toolBar); - /** - MSW-specific function for accessing the taskbar button under Windows 7 or later. - - Returns a wxTaskBarButton pointer representing the taskbar button of the - window under Windows 7 or later. The returned wxTaskBarButton may be - used, if non-@c NULL, to access the functionality including thumbnail - representations, thumbnail toolbars, notification and status overlays, - and progress indicators. - - The returned pointer must @em not be deleted, it is owned by the frame - and will be only deleted when the frame itself is destroyed. - - This function is not available in the other ports by design, any - occurrences of it in the portable code must be guarded by - @code #ifdef __WXMSW__ @endcode preprocessor guards. - */ - wxTaskBarButton* MSWGetTaskBarButton(); void PushStatusText(const wxString &text, int number = 0); void PopStatusText(int number = 0); diff --git a/interface/wx/taskbarbutton.h b/interface/wx/taskbarbutton.h deleted file mode 100644 index c4b6a10c7e..0000000000 --- a/interface/wx/taskbarbutton.h +++ /dev/null @@ -1,277 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: taskbarbutton.h -// Purpose: interface of wxTaskBarButton -// Author: wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -/** - State of the taskbar button. -*/ -enum WXDLLIMPEXP_CORE wxTaskBarButtonState -{ - wxTASKBAR_BUTTON_NO_PROGRESS = 0, - wxTASKBAR_BUTTON_INDETERMINATE = 1, - wxTASKBAR_BUTTON_NORMAL = 2, - wxTASKBAR_BUTTON_ERROR = 4, - wxTASKBAR_BUTTON_PAUSED = 8 -}; - -/** - @class wxThumbBarButton - - A thumbnail toolbar button is a control that displayed in the thumbnail - image of a window in a taskbar button flyout. - - @library{wxcore} - @category{misc} - - @onlyfor{wxmsw} - - @see wxTaskBarButton -*/ -class WXDLLIMPEXP_CORE wxThumbBarButton { -public: - /** - Default constructor to allow 2-phase creation. - */ - wxThumbBarButton(); - - /** - Constructs the thumbnail toolbar button. - - @param id - The identifier for the control. - @param icon - The icon used as the button image. - @param tooltip - The text of the button's tooltip, displayed when the mouse pointer - hovers over the button. - @param enable - If @true (default), the button is active and available to the user. - If @false, the button is disabled. It is present, but has a visual - state that indicates that it will not respond to user action. - @param dismissOnClick - If @true, when the button is clicked, the taskbar button's flyout - closes immediately. @false by default. - @param hasBackground - If @false, the button border is not drawn. @true by default. - @param shown - If @false, the button is not shown to the user. @true by default. - @param interactive - If @false, the button is enabled but not interactive; no pressed - button state is drawn. This flag is intended for instances where - the button is used in a notification. @true by default. - */ - wxThumbBarButton(int id, - const wxIcon& icon, - const wxString& tooltip = wxString(), - bool enable = true, - bool dismissOnClick = false, - bool hasBackground = true, - bool shown = true, - bool interactive = true); - - bool Create(int id, - const wxIcon& icon, - const wxString& tooltip = wxString(), - bool enable = true, - bool dismissOnClick = false, - bool hasBackground = true, - bool shown = true, - bool interactive = true); - - virtual ~wxThumbBarButton(); - - /** - Returns the identifier associated with this control. - */ - int GetID() const; - - /** - Returns the icon associated with this control. - */ - const wxIcon& GetIcon() const; - - /** - Return the tooltip. - */ - const wxString& GetTooltip() const; - - /** - Return @true if the button is enabled, @false if it has been disabled. - */ - bool IsEnable() const; - - /** - Return @true if the button will dismiss on click. - */ - bool IsDismissOnClick() const; - - /** - Return @true if the button has button border. - */ - bool HasBackground() const; - - /** - Returns @true if the button is shown, @false if it has been hidden. - */ - bool IsShown() const; - - /** - Return @true if the button is interactive. - */ - bool IsInteractive() const; -}; - -/** - @class wxTaskBarButton - - A taskbar button that associated with the window under Windows 7 or later. - - It is used to access the functionality including thumbnail representations, - thumbnail toolbars, notification and status overlays, and progress - indicators. - - @note This class is only created and initialized in the internal implementation - of wxFrame by design. You can only get the pointer of the instance which - associated with the frame by calling wxFrame::MSWGetTaskBarButton(). - - @library{wxcore} - @category{misc} - - @nativeimpl{wxmsw} - @onlyfor{wxmsw} - - @see wxFrame::MSWGetTaskBarButton() -*/ -class WXDLLIMPEXP_CORE wxTaskBarButton -{ -public: - /** - Starts showing a determinate progress indicator. - - Call SetProgressValue() after this call to update the progress - indicator. - - If @a range is 0, the progress indicator is dismissed. - */ - virtual void SetProgressRange(int range); - - /** - Update the determinate progress indicator. - - @param value Must be in the range from 0 to the argument to the last - SetProgressRange() call. When it is equal to the range, the progress - bar is dismissed. - */ - virtual void SetProgressValue(int value); - - /** - Updates indeterminate progress indicator. - - The first call to this method starts showing the indeterminate progress - indicator if it hadn't been shown yet. - - Call SetProgressRange(0) to stop showing the progress indicator. - */ - virtual void PulseProgress(); - - /** - Show in the taskbar. - */ - virtual void Show(bool show = true); - - /** - Hide in the taskbar. - */ - virtual void Hide(); - - /** - Specifies or updates the text of the tooltip that is displayed - when the mouse pointer rests on an individual preview thumbnail - in a taskbar button flyout. - */ - virtual void SetThumbnailTooltip(const wxString& tooltip); - - /** - Set the state of the progress indicator displayed on a taskbar button. - - @see wxTaskBarButtonState - */ - virtual void SetProgressState(wxTaskBarButtonState state); - - /** - Set an overlay icon to indicate application status or a notification top - the user. - - @param icon - This should be a small icon, measuring 16x16 pixels at 96 dpi. If an - overlay icon is already applied to the taskbar button, that existing - overlay is replaced. Setting with wxNullIcon to remove. - @param description - The property holds the description of the overlay for accessibility - purposes. - */ - virtual void SetOverlayIcon(const wxIcon& icon, - const wxString& description = wxString()); - - /** - Selects a portion of a window's client area to display as that window's - thumbnail in the taskbar. - - @param rect - The portion inside of the window. Setting with an empty wxRect will - restore the default diaplay of the thumbnail. - */ - virtual void SetThumbnailClip(const wxRect& rect); - - /** - Selects the child window area to display as that window's thumbnail in - the taskbar. - */ - virtual void SetThumbnailContents(const wxWindow *child); - - /** - Inserts the given button before the position pos to the taskbar - thumbnail toolbar. - - @note The number of buttons is limited to 7. - - @see AppendThumbBarButton() - */ - virtual bool InsertThumbBarButton(size_t pos, wxThumbBarButton *button); - - /** - Adds a button to the taskbar thumbnail toolbar. - - @note The number of buttons is limited to 7. - - @see InsertThumbBarButton() - */ - virtual bool AppendThumbBarButton(wxThumbBarButton *button); - - /** - Removes the thumbnail toolbar button from the taskbar button but doesn't - delete the associated c++ object. - - @param button - The thumbnail toolbar button to remove. - - @return A pointer to the button which was detached from the taskbar - button. - */ - virtual wxThumbBarButton* RemoveThumbBarButton(wxThumbBarButton *button); - - /** - Removes the thumbnail toolbar button from the taskbar button but doesn't - delete the associated c++ object. - - @param id - The identifier of the thumbnail toolbar button to remove. - - @return A pointer to the button which was detached from the taskbar - button. - */ - virtual wxThumbBarButton* RemoveThumbBarButton(int id); -}; diff --git a/samples/taskbarbutton/taskbarbutton.bkl b/samples/taskbarbutton/taskbarbutton.bkl deleted file mode 100644 index c7c2d11203..0000000000 --- a/samples/taskbarbutton/taskbarbutton.bkl +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - taskbarbutton.cpp - adv - core - base - - - diff --git a/samples/taskbarbutton/taskbarbutton.cpp b/samples/taskbarbutton/taskbarbutton.cpp deleted file mode 100644 index 54387438ea..0000000000 --- a/samples/taskbarbutton/taskbarbutton.cpp +++ /dev/null @@ -1,375 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: taskbarbutton.cpp -// Purpose: wxTaskBarButton sample -// Author: Chaobin Zhang -// Created: 2014-04-30 -// Copyright: (c) 2014 wxWidgets development team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "wx/taskbarbutton.h" - -enum -{ - ProgressValueSlider = wxID_HIGHEST, - VisibilityRadio, - ThumbnailTooltipSetBtn, - ProgressStateChoice, - SetOverlayIconBtn, - ClearOverlayIconBtn, - SetThumbnailClipBtn, - RestoreThumbnailClipBtn, - AddThumbBarButtonBtn, - RemoveThumbBarButtonBtn, -}; - -enum -{ - ThumbnailToolbarBtn_0 = wxID_HIGHEST + 100, - ThumbnailToolbarBtn_1, - ThumbnailToolbarBtn_2, - ThumbnailToolbarBtn_3, - ThumbnailToolbarBtn_4, - ThumbnailToolbarBtn_5, - ThumbnailToolbarBtn_6 -}; - -namespace { - -wxBitmap CreateBitmap(const wxColour& colour, int w, int h) -{ - wxMemoryDC dc; - wxBitmap bmp(w, h); - dc.SelectObject(bmp); - - // Draw transparent background - wxColour magic(255, 0, 255); - wxBrush magicBrush(magic); - dc.SetBrush(magicBrush); - dc.SetPen(*wxTRANSPARENT_PEN); - dc.DrawRectangle(0, 0, w, h); - - // Draw image content - dc.SetBrush(wxBrush(colour)); - dc.DrawCircle(h / 2, h / 2 + 1, h / 2); - dc.SelectObject(wxNullBitmap); - - // Finalize transparency with a mask - wxMask *mask = new wxMask(bmp, magic); - bmp.SetMask(mask); - return bmp; -} - -wxIcon CreateRandomIcon() -{ - static int counter = 0; - static const wxColour* colours[] = - { - wxBLACK, - wxWHITE, - wxRED, - wxBLUE, - wxGREEN, - wxCYAN, - wxLIGHT_GREY - }; - - wxIcon icon; - icon.CopyFromBitmap(CreateBitmap(*(colours[counter]), 16, 16)); - counter += 1; - counter = counter % WXSIZEOF(colours); - return icon; -} - -} // namespace - -class MyApp : public wxApp -{ -public: - virtual bool OnInit(); -}; - -class MyFrame : public wxFrame -{ -public: - MyFrame(const wxString& title); - -private: - wxDECLARE_EVENT_TABLE(); - - void OnSetProgressValue(wxScrollEvent& WXUNUSED(event)); - void OnVisibilityChange(wxCommandEvent& WXUNUSED(event)); - void OnSetThumbnailTooltipBtn(wxCommandEvent& WXUNUSED(event)); - void OnChoice(wxCommandEvent& event); - void OnSetOverlayIcon(wxCommandEvent& WXUNUSED(event)); - void OnClearOverlayIcon(wxCommandEvent& WXUNUSED(event)); - void OnSetOrRestoreThumbnailClip(wxCommandEvent& event); - void OnAddThubmBarButton(wxCommandEvent& WXUNUSED(event)); - void OnRemoveThubmBarButton(wxCommandEvent& WXUNUSED(event)); - void OnThumbnailToolbarBtnClicked(wxCommandEvent& event); - - wxSlider *m_slider; - wxRadioBox *m_visibilityRadioBox; - wxTextCtrl *m_textCtrl; - wxChoice *m_stateChoice; - - typedef wxVector wxThumbBarButtons; - wxThumbBarButtons m_thumbBarButtons; -}; - -IMPLEMENT_APP(MyApp) - -bool MyApp::OnInit() -{ - if ( !wxApp::OnInit() ) - return false; - - MyFrame *frame = new MyFrame("wxTaskBarButton App"); - frame->Show(true); - - return true; -} - -MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) -{ - wxPanel *panel = new wxPanel(this); - wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); - wxFlexGridSizer *gs = new wxFlexGridSizer(4, 2, 10, 10); - - // SetProgressValue section. - wxStaticBoxSizer *spvSizer = - new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetProgressValue")); - int flags = wxSL_MIN_MAX_LABELS | wxSL_VALUE_LABEL | wxSL_AUTOTICKS; - m_slider = new wxSlider(spvSizer->GetStaticBox(), ProgressValueSlider, - 0, 0, 100, - wxDefaultPosition, wxSize(250, -1), - flags); - m_slider->SetTickFreq(10); - spvSizer->Add(m_slider); - - // Show/Hide in Taskbar section. - const wxString labels[] = - { - "&Show in Taskbar", - "&Hide in Taskbar" - }; - m_visibilityRadioBox = new wxRadioBox(panel, VisibilityRadio, "Visibility:", - wxDefaultPosition, wxDefaultSize, - WXSIZEOF(labels), labels, - 1, wxRA_SPECIFY_ROWS); - // SetThumbnailTooltip section. - wxStaticBoxSizer *sttSizer = - new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetThumbnailTooltip")); - m_textCtrl = new wxTextCtrl(panel, wxID_ANY); - wxButton *btn = new wxButton(panel, ThumbnailTooltipSetBtn, wxT("Set")); - sttSizer->Add(m_textCtrl, 1, wxEXPAND | wxALL, 2); - sttSizer->Add(btn, 1, wxEXPAND | wxALL, 2); - - // SetProgressState section. - wxStaticBoxSizer *spsSizer = - new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetProgressState")); - const wxString choices[] = - { - "wxNoProgress", - "wxIndeterminate", - "wxNormal", - "wxError", - "wxPaused" - }; - m_stateChoice = new wxChoice(panel, ProgressStateChoice, - wxDefaultPosition, wxDefaultSize, - WXSIZEOF(choices), choices); - spsSizer->Add(m_stateChoice, 0, wxALL | wxGROW, 5); - - // SetOverlayIcon section. - wxStaticBoxSizer *soiSizer = - new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetOverlayIcon")); - wxButton *setOverlayIconBtn = - new wxButton(panel, SetOverlayIconBtn, wxT("Set Overlay Icon")); - wxButton *clearOverlayIconBtn = - new wxButton(panel, ClearOverlayIconBtn, wxT("Clear Overlay Icon")); - soiSizer->Add(setOverlayIconBtn, 1, wxEXPAND | wxALL, 2); - soiSizer->Add(clearOverlayIconBtn, 1, wxEXPAND | wxALL, 2); - - // SetThumbnailClip section. - wxStaticBoxSizer *stcSizer = - new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetThumbnailClip")); - wxButton *setThumbnailClipBtn = - new wxButton(panel, SetThumbnailClipBtn, wxT("Set Thumbnail Clip")); - wxButton *restoreThumbnailClipBtn = - new wxButton(panel, RestoreThumbnailClipBtn, - wxT("Restore Thumbnail Clip")); - stcSizer->Add(setThumbnailClipBtn, 1, wxEXPAND | wxALL, 2); - stcSizer->Add(restoreThumbnailClipBtn, 1, wxEXPAND | wxALL, 2); - - // Thumbnail Toolbar Buttons section. - wxStaticBoxSizer *ttbSizer = - new wxStaticBoxSizer(wxVERTICAL, panel, wxT("ThumbBar Buttons")); - wxButton *addThumbBarButtonBtn = - new wxButton(panel, AddThumbBarButtonBtn, wxT("Add ThumbBar Button")); - wxButton *showThumbnailToolbarBtn = - new wxButton(panel, RemoveThumbBarButtonBtn, - wxT("Remove Last ThumbBar Button")); - ttbSizer->Add(addThumbBarButtonBtn, 1, wxEXPAND | wxALL, 2); - ttbSizer->Add(showThumbnailToolbarBtn, 1, wxEXPAND | wxALL, 2); - - gs->Add(spvSizer, 0, wxEXPAND); - gs->Add(m_visibilityRadioBox, 0, wxEXPAND); - gs->Add(sttSizer, 0, wxEXPAND); - gs->Add(spsSizer, 0, wxEXPAND); - gs->Add(soiSizer, 0, wxEXPAND); - gs->Add(stcSizer, 0, wxEXPAND); - gs->Add(ttbSizer, 0, wxEXPAND); - - wxStaticText *text = new wxStaticText( - panel, wxID_ANY, wxT("Welcome to wxTaskBarButton sample")); - mainSizer->Add(text, 0, wxALIGN_CENTRE_HORIZONTAL); - mainSizer->Add(gs); - - panel->SetSizer(mainSizer); - - SetIcon(wxICON(sample)); - SetSize(537, 420); - Centre(); -} - -wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_COMMAND_SCROLL_CHANGED(ProgressValueSlider, MyFrame::OnSetProgressValue) - EVT_RADIOBOX(VisibilityRadio, MyFrame::OnVisibilityChange) - EVT_BUTTON(ThumbnailTooltipSetBtn, MyFrame::OnSetThumbnailTooltipBtn) - EVT_CHOICE(ProgressStateChoice, MyFrame::OnChoice) - EVT_BUTTON(SetOverlayIconBtn, MyFrame::OnSetOverlayIcon) - EVT_BUTTON(ClearOverlayIconBtn, MyFrame::OnClearOverlayIcon) - EVT_BUTTON(SetThumbnailClipBtn, MyFrame::OnSetOrRestoreThumbnailClip) - EVT_BUTTON(RestoreThumbnailClipBtn, MyFrame::OnSetOrRestoreThumbnailClip) - EVT_BUTTON(AddThumbBarButtonBtn, MyFrame::OnAddThubmBarButton) - EVT_BUTTON(RemoveThumbBarButtonBtn, MyFrame::OnRemoveThubmBarButton) - EVT_BUTTON(ThumbnailToolbarBtn_0, MyFrame::OnThumbnailToolbarBtnClicked) - EVT_BUTTON(ThumbnailToolbarBtn_1, MyFrame::OnThumbnailToolbarBtnClicked) - EVT_BUTTON(ThumbnailToolbarBtn_2, MyFrame::OnThumbnailToolbarBtnClicked) - EVT_BUTTON(ThumbnailToolbarBtn_3, MyFrame::OnThumbnailToolbarBtnClicked) - EVT_BUTTON(ThumbnailToolbarBtn_4, MyFrame::OnThumbnailToolbarBtnClicked) - EVT_BUTTON(ThumbnailToolbarBtn_5, MyFrame::OnThumbnailToolbarBtnClicked) - EVT_BUTTON(ThumbnailToolbarBtn_6, MyFrame::OnThumbnailToolbarBtnClicked) -wxEND_EVENT_TABLE() - -void MyFrame::OnSetProgressValue(wxScrollEvent& WXUNUSED(event)) -{ - static bool s_hasRangeSet = false; - if ( !s_hasRangeSet ) - { - MSWGetTaskBarButton()->SetProgressRange(100); - s_hasRangeSet = true; - } - - MSWGetTaskBarButton()->SetProgressValue(m_slider->GetValue()); -} - -void MyFrame::OnVisibilityChange(wxCommandEvent& WXUNUSED(event)) -{ - if ( m_visibilityRadioBox->GetSelection() == 0 ) - MSWGetTaskBarButton()->Show(); - else - MSWGetTaskBarButton()->Hide(); -} - -void MyFrame::OnSetThumbnailTooltipBtn(wxCommandEvent& WXUNUSED(event)) -{ - MSWGetTaskBarButton()->SetThumbnailTooltip(m_textCtrl->GetLineText(0)); -} - -void MyFrame::OnChoice(wxCommandEvent& event) -{ - int sel = event.GetSelection(); - wxTaskBarButtonState state; - switch(sel) - { - case 0: - state = wxTASKBAR_BUTTON_NO_PROGRESS; - break; - case 1: - state = wxTASKBAR_BUTTON_INDETERMINATE; - break; - case 2: - state = wxTASKBAR_BUTTON_NORMAL; - break; - case 3: - state = wxTASKBAR_BUTTON_ERROR; - break; - case 4: - state = wxTASKBAR_BUTTON_PAUSED; - break; - default: - state = wxTASKBAR_BUTTON_NO_PROGRESS; - break; - } - - MSWGetTaskBarButton()->SetProgressValue(m_slider->GetValue()); - MSWGetTaskBarButton()->SetProgressState(state); -} - -void MyFrame::OnSetOverlayIcon(wxCommandEvent& WXUNUSED(event)) -{ - MSWGetTaskBarButton()->SetOverlayIcon(CreateRandomIcon()); -} - -void MyFrame::OnClearOverlayIcon(wxCommandEvent& WXUNUSED(event)) -{ - MSWGetTaskBarButton()->SetOverlayIcon(wxNullIcon); -} - -void MyFrame::OnSetOrRestoreThumbnailClip(wxCommandEvent& event) -{ - wxRect rect; - if ( event.GetId() == SetThumbnailClipBtn ) - { - static const int CLIP_LENGTH = 100; - int height, width; - GetClientSize(&width, &height); - rect.SetX((width - CLIP_LENGTH) / 2); - rect.SetY((height - CLIP_LENGTH) / 2); - rect.SetHeight(CLIP_LENGTH); - rect.SetWidth(CLIP_LENGTH); - } - - MSWGetTaskBarButton()->SetThumbnailClip(rect); -} - - -void MyFrame::OnAddThubmBarButton(wxCommandEvent& WXUNUSED(event)) -{ - if ( m_thumbBarButtons.size() >= 7 ) - return; - - wxThumbBarButton* button = - new wxThumbBarButton(m_thumbBarButtons.size() + ThumbnailToolbarBtn_0 , - CreateRandomIcon()); - MSWGetTaskBarButton()->AppendThumbBarButton(button); - m_thumbBarButtons.push_back(button); -} - -void MyFrame::OnRemoveThubmBarButton(wxCommandEvent& WXUNUSED(event)) -{ - if ( m_thumbBarButtons.empty() ) - return; - - wxThumbBarButton* button = m_thumbBarButtons.back(); - m_thumbBarButtons.pop_back(); - MSWGetTaskBarButton()->RemoveThumbBarButton(button); -} - -void MyFrame::OnThumbnailToolbarBtnClicked(wxCommandEvent& event) -{ - wxLogMessage("Thumbnail Toolbar Button %d is clicked.", event.GetId()); -} diff --git a/setup.h.in b/setup.h.in index ccad90f739..cb0bf414fb 100644 --- a/setup.h.in +++ b/setup.h.in @@ -658,8 +658,6 @@ #define wxUSE_TASKBARICON_BALLOONS 0 -#define wxUSE_TASKBARBUTTON 0 - #define wxUSE_UXTHEME 0 #define wxUSE_INKEDIT 0 diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index b5718d7bda..cfdca7e961 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -56,11 +56,6 @@ #include "wx/univ/colschem.h" #endif // __WXUNIVERSAL__ -#if wxUSE_TASKBARBUTTON - #include "wx/taskbarbutton.h" -#endif - - // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -69,11 +64,6 @@ extern wxMenu *wxCurrentPopupMenu; #endif // wxUSE_MENUS || wxUSE_MENUS_NATIVE -#if wxUSE_TASKBARBUTTON - static WXUINT gs_msgTaskbarButtonCreated = 0; - #define wxTHBN_CLICKED 0x1800 -#endif // wxUSE_TASKBARBUTTON - // ---------------------------------------------------------------------------- // event tables // ---------------------------------------------------------------------------- @@ -142,32 +132,9 @@ bool wxFrame::Create(wxWindow *parent, SetAcceleratorTable(accel); #endif // wxUSE_ACCEL && __POCKETPC__ -#if wxUSE_TASKBARBUTTON - m_taskBarButton = NULL; - static bool s_registered = false; - if ( !s_registered ) - { - gs_msgTaskbarButtonCreated = - ::RegisterWindowMessage(wxT("TaskbarButtonCreated")); - s_registered = true; - } -#endif - return true; } -wxFrame::~wxFrame() -{ - SendDestroyEvent(); - - DeleteAllBars(); - -#if wxUSE_TASKBARBUTTON - if ( m_taskBarButton ) - delete m_taskBarButton; -#endif -} - // ---------------------------------------------------------------------------- // wxFrame client size calculations // ---------------------------------------------------------------------------- @@ -503,13 +470,6 @@ wxMenu* wxFrame::MSWFindMenuFromHMENU(WXHMENU hMenu) } #endif // wxUSE_MENUS && !defined(__WXUNIVERSAL__) -#if wxUSE_TASKBARBUTTON -wxTaskBarButton* wxFrame::MSWGetTaskBarButton() -{ - return m_taskBarButton; -} -#endif // wxUSE_TASKBARBUTTON - // Responds to colour changes, and passes event on to children. void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) { @@ -902,20 +862,6 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) } #endif // wxUSE_MENUS -#if wxUSE_TASKBARBUTTON - if ( cmd == wxTHBN_CLICKED && m_taskBarButton ) - { - wxTaskBarButtonImpl * const - tbButton = reinterpret_cast(m_taskBarButton); - // we use the index as id when adding thumbnail toolbar button. - wxThumbBarButton * const - thumbBarButton = tbButton->GetThumbBarButtonByIndex(id); - wxCommandEvent event(wxEVT_BUTTON, thumbBarButton->GetID()); - event.SetEventObject(thumbBarButton); - return ProcessEvent(event); - } -#endif // wxUSE_TASKBARBUTTON - return wxFrameBase::HandleCommand(id, cmd, control);; } @@ -970,13 +916,6 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara break; #endif // !__WXMICROWIN__ } -#if wxUSE_TASKBARBUTTON - if ( message == gs_msgTaskbarButtonCreated ) - { - m_taskBarButton = new wxTaskBarButtonImpl(GetHandle()); - processed = true; - } -#endif if ( !processed ) rc = wxFrameBase::MSWWindowProc(message, wParam, lParam); diff --git a/src/msw/taskbarbutton.cpp b/src/msw/taskbarbutton.cpp deleted file mode 100644 index 4bfb3b8eb1..0000000000 --- a/src/msw/taskbarbutton.cpp +++ /dev/null @@ -1,316 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/taskbarbutton.cpp -// Purpose: Implements wxTaskBarButtonImpl class for manipulating buttons on -// the Windows taskbar. -// Author: Chaobin Zhang -// Created: 2014-06-01 -// Copyright: (c) 2014 wxWidgets development team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/icon.h" -#endif - -#if wxUSE_TASKBARBUTTON - -#include "wx/msw/wrapshl.h" -#include "wx/msw/private.h" -#include "wx/taskbarbutton.h" - -#include -#include - -namespace { - -// The maximum number of thumbnail toolbar buttons allowed on windows is 7. -static const int MAX_BUTTON_COUNT = 7; - -DEFINE_GUID(wxCLSID_TaskbarList, - 0x56fdf344, 0xfd6d, 0x11d0, 0x95, 0x8a, 0x0, 0x60, 0x97, 0xc9, 0xa0, 0x90); - -THUMBBUTTONFLAGS GetNativeThumbButtonFlags(const wxThumbBarButton& button) -{ - WXUINT flags = 0; - flags |= (button.IsEnable() ? THBF_ENABLED : THBF_DISABLED); - if ( button.IsDismissOnClick() ) - flags |= THBF_DISMISSONCLICK; - if ( !button.HasBackground() ) - flags |= THBF_NOBACKGROUND; - if ( !button.IsShown() ) - flags |= THBF_HIDDEN; - if ( !button.IsInteractive() ) - flags |= THBF_NONINTERACTIVE; - return static_cast(flags); -} - -} // namespace - -IMPLEMENT_DYNAMIC_CLASS(wxThumbBarButton, wxObject) - -wxThumbBarButton::wxThumbBarButton(int id, - const wxIcon& icon, - const wxString& tooltip, - bool enable, - bool dismissOnClick, - bool hasBackground, - bool shown, - bool interactive) - : m_id(id), - m_icon(icon), - m_tooltip(tooltip), - m_enable(enable), - m_dismissOnClick(dismissOnClick), - m_hasBackground(hasBackground), - m_shown(shown), - m_interactive(interactive) -{ -} - -bool wxThumbBarButton::Create(int id, - const wxIcon& icon, - const wxString& tooltip, - bool enable, - bool dismissOnClick, - bool hasBackground, - bool shown, - bool interactive) -{ - m_id = id; - m_icon = icon; - m_tooltip = tooltip; - m_enable = enable; - m_dismissOnClick = dismissOnClick; - m_hasBackground = hasBackground; - m_shown = shown; - m_interactive = interactive; - return true; -} - -wxTaskBarButtonImpl::wxTaskBarButtonImpl(WXWidget parent) - : m_hwnd(parent), - m_taskbarList(NULL), - m_progressRange(0), - m_hasInitThumbnailToolbar(false) -{ - HRESULT hr = CoCreateInstance - ( - wxCLSID_TaskbarList, - NULL, - CLSCTX_INPROC_SERVER, - IID_ITaskbarList3, - reinterpret_cast(&m_taskbarList) - ); - if ( FAILED(hr) ) - { - wxLogApiError(wxT("CoCreateInstance(CLSID_TaskbarList)"), hr); - return; - } - - hr = m_taskbarList->HrInit(); - if ( FAILED(hr) ) - { - wxLogApiError(wxT("ITaskbarList3::Init"), hr); - return; - } -} - -wxTaskBarButtonImpl::~wxTaskBarButtonImpl() -{ - if ( m_taskbarList ) - m_taskbarList->Release(); - - for ( wxThumbBarButtons::iterator iter = m_thumbBarButtons.begin(); - iter != m_thumbBarButtons.end(); - ++iter) - { - delete (*iter); - } - m_thumbBarButtons.clear(); -} - -void wxTaskBarButtonImpl::SetProgressRange(int range) -{ - m_progressRange = range; - if ( m_progressRange == 0 ) - SetProgressState(wxTASKBAR_BUTTON_NO_PROGRESS); -} - -void wxTaskBarButtonImpl::SetProgressValue(int value) -{ - m_taskbarList->SetProgressValue(m_hwnd, value, m_progressRange); -} - -void wxTaskBarButtonImpl::PulseProgress() -{ - SetProgressState(wxTASKBAR_BUTTON_INDETERMINATE); -} - -void wxTaskBarButtonImpl::Show(bool show) -{ - if ( show ) - m_taskbarList->AddTab(m_hwnd); - else - m_taskbarList->DeleteTab(m_hwnd); -} - -void wxTaskBarButtonImpl::Hide() -{ - Show(false); -} - -void wxTaskBarButtonImpl::SetThumbnailTooltip(const wxString& tooltip) -{ - m_taskbarList->SetThumbnailTooltip(m_hwnd, tooltip.wc_str()); -} - -void wxTaskBarButtonImpl::SetProgressState(wxTaskBarButtonState state) -{ - m_taskbarList->SetProgressState(m_hwnd, static_cast(state)); -} - -void wxTaskBarButtonImpl::SetOverlayIcon(const wxIcon& icon, - const wxString& description) -{ - m_taskbarList->SetOverlayIcon(m_hwnd, - GetHiconOf(icon), - description.wc_str()); -} - -void wxTaskBarButtonImpl::SetThumbnailClip(const wxRect& rect) -{ - RECT rc; - wxCopyRectToRECT(rect, rc); - m_taskbarList->SetThumbnailClip(m_hwnd, rect.IsEmpty() ? NULL : &rc); -} - -void wxTaskBarButtonImpl::SetThumbnailContents(const wxWindow *child) -{ - SetThumbnailClip(child->GetRect()); -} - -bool wxTaskBarButtonImpl::AppendThumbBarButton(wxThumbBarButton *button) -{ - wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT, - "Number of thumb buttons is limited to 7" ); - - m_thumbBarButtons.push_back(button); - return InitOrUpdateThumbBarButtons(); -} - -bool wxTaskBarButtonImpl::InsertThumbBarButton(size_t pos, - wxThumbBarButton *button) -{ - wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT, - "Number of thumb buttons is limited to 7" ); - wxASSERT_MSG( pos <= m_thumbBarButtons.size(), - "Invalid index when inserting the button" ); - - m_thumbBarButtons.insert(m_thumbBarButtons.begin() + pos, button); - return InitOrUpdateThumbBarButtons(); -} - -wxThumbBarButton* wxTaskBarButtonImpl::RemoveThumbBarButton(wxThumbBarButton *button) -{ - for ( wxThumbBarButtons::iterator iter = m_thumbBarButtons.begin(); - iter != m_thumbBarButtons.end(); - ++iter ) - { - if ( button == *iter ) - { - m_thumbBarButtons.erase(iter); - InitOrUpdateThumbBarButtons(); - return *iter; - } - } - - return NULL; -} - -wxThumbBarButton* wxTaskBarButtonImpl::RemoveThumbBarButton(int id) -{ - for ( wxThumbBarButtons::iterator iter = m_thumbBarButtons.begin(); - iter != m_thumbBarButtons.end(); - ++iter ) - { - if ( id == (*iter)->GetID() ) - { - m_thumbBarButtons.erase(iter); - InitOrUpdateThumbBarButtons(); - return *iter; - } - } - - return NULL; -} - -bool wxTaskBarButtonImpl::InitOrUpdateThumbBarButtons() -{ - THUMBBUTTON buttons[MAX_BUTTON_COUNT]; - HRESULT hr; - - for ( size_t i = 0; i < MAX_BUTTON_COUNT; ++i ) - { - memset(&buttons[i], 0, sizeof buttons[i]); - buttons[i].iId = i; - buttons[i].dwFlags = THBF_HIDDEN; - buttons[i].dwMask = static_cast(THB_FLAGS); - } - - for ( size_t i = 0; i < m_thumbBarButtons.size(); ++i ) - { - buttons[i].hIcon = GetHiconOf(m_thumbBarButtons[i]->GetIcon()); - buttons[i].dwFlags = GetNativeThumbButtonFlags(*m_thumbBarButtons[i]); - buttons[i].dwMask = static_cast(THB_ICON | THB_FLAGS); - wxString tooltip = m_thumbBarButtons[i]->GetTooltip(); - if ( tooltip.empty() ) - continue; - - // Truncate the tooltip if its length longer than szTip(THUMBBUTTON) - // allowed length (260). - tooltip.Truncate(260); - wxStrlcpy(buttons[i].szTip, tooltip.t_str(), tooltip.length()); - buttons[i].dwMask = - static_cast(buttons[i].dwMask | THB_TOOLTIP); - } - - if ( !m_hasInitThumbnailToolbar ) - { - hr = m_taskbarList->ThumbBarAddButtons(m_hwnd, - MAX_BUTTON_COUNT, - buttons); - if ( FAILED(hr) ) - { - wxLogApiError(wxT("ITaskbarList3::ThumbBarAddButtons"), hr); - } - m_hasInitThumbnailToolbar = true; - } - else - { - hr = m_taskbarList->ThumbBarUpdateButtons(m_hwnd, - MAX_BUTTON_COUNT, - buttons); - if ( FAILED(hr) ) - { - wxLogApiError(wxT("ITaskbarList3::ThumbBarUpdateButtons"), hr); - } - } - - return SUCCEEDED(hr); -} - -wxThumbBarButton* wxTaskBarButtonImpl::GetThumbBarButtonByIndex(size_t index) -{ - if ( index >= m_thumbBarButtons.size() ) - return NULL; - - return m_thumbBarButtons[index]; -} - -#endif // wxUSE_TASKBARBUTTON 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,