Reverting failed mering of SOC2014_TASKBAR.
Command: git svn dcommit is aborted, and the two branches is diverged. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
||||
</set>
|
||||
|
||||
<!-- ====================================================================== -->
|
||||
@@ -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
|
||||
</set>
|
||||
<set var="MSW_HDR" hints="files">
|
||||
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
|
||||
</set>
|
||||
<set var="MSW_RSC" hints="files">
|
||||
<!-- Resources must be installed together with headers: -->
|
||||
|
@@ -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
|
||||
|
@@ -1002,7 +1002,6 @@
|
||||
<ClCompile Include="..\..\src\generic\vlbox.cpp" />
|
||||
<ClCompile Include="..\..\src\generic\vscroll.cpp" />
|
||||
<ClCompile Include="..\..\src\xrc\xmlreshandler.cpp" />
|
||||
<ClCompile Include="..\..\src\msw\taskbarbutton.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\src\msw\version.rc">
|
||||
@@ -1123,7 +1122,6 @@
|
||||
<ClInclude Include="..\..\include\wx\msw\statline.h" />
|
||||
<ClInclude Include="..\..\include\wx\msw\stattext.h" />
|
||||
<ClInclude Include="..\..\include\wx\msw\statusbar.h" />
|
||||
<ClInclude Include="..\..\include\wx\msw\taskbarbutton.h" />
|
||||
<ClInclude Include="..\..\include\wx\msw\textctrl.h" />
|
||||
<ClInclude Include="..\..\include\wx\msw\textentry.h" />
|
||||
<ClInclude Include="..\..\include\wx\msw\tglbtn.h" />
|
||||
@@ -1329,7 +1327,6 @@
|
||||
<ClInclude Include="..\..\include\wx\statline.h" />
|
||||
<ClInclude Include="..\..\include\wx\stattext.h" />
|
||||
<ClInclude Include="..\..\include\wx\statusbr.h" />
|
||||
<ClInclude Include="..\..\include\wx\taskbarbutton.h" />
|
||||
<ClInclude Include="..\..\include\wx\tbarbase.h" />
|
||||
<ClInclude Include="..\..\include\wx\textcompleter.h" />
|
||||
<ClInclude Include="..\..\include\wx\textctrl.h" />
|
||||
|
@@ -837,9 +837,6 @@
|
||||
<ClCompile Include="..\..\src\msw\statusbar.cpp">
|
||||
<Filter>MSW Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\msw\taskbarbutton.cpp">
|
||||
<Filter>MSW Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\msw\textctrl.cpp">
|
||||
<Filter>MSW Sources</Filter>
|
||||
</ClCompile>
|
||||
@@ -1615,9 +1612,6 @@
|
||||
<ClInclude Include="..\..\include\wx\msw\statusbar.h">
|
||||
<Filter>MSW Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\wx\msw\taskbarbutton.h">
|
||||
<Filter>MSW Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\wx\msw\textctrl.h">
|
||||
<Filter>MSW Headers</Filter>
|
||||
</ClInclude>
|
||||
@@ -1798,9 +1792,6 @@
|
||||
<ClInclude Include="..\..\include\wx\statusbr.h">
|
||||
<Filter>Common Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\wx\taskbarbutton.h">
|
||||
<Filter>Common Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\wx\tbarbase.h">
|
||||
<Filter>Common Headers</Filter>
|
||||
</ClInclude>
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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."
|
||||
|
@@ -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)
|
||||
};
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: include/wx/msw/taskbarbutton.h
|
||||
// Purpose: Defines wxTaskBarButtonImpl class.
|
||||
// Author: Chaobin Zhang <zhchbin@gmail.com>
|
||||
// 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<wxThumbBarButton*> wxThumbBarButtons;
|
||||
wxThumbBarButtons m_thumbBarButtons;
|
||||
|
||||
int m_progressRange;
|
||||
bool m_hasInitThumbnailToolbar;
|
||||
};
|
||||
|
||||
#endif // wxUSE_TASKBARBUTTON
|
||||
|
||||
#endif // _WX_MSW_TASKBARBUTTON_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);
|
||||
};
|
||||
|
@@ -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)
|
||||
|
@@ -1,112 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: include/taskbarbutton.h
|
||||
// Purpose: Defines wxTaskBarButton class for manipulating buttons on the
|
||||
// windows taskbar.
|
||||
// Author: Chaobin Zhang <zhchbin@gmail.com>
|
||||
// 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_
|
@@ -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);
|
||||
|
@@ -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);
|
||||
};
|
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<makefile>
|
||||
|
||||
<include file="../../build/bakefiles/common_samples.bkl"/>
|
||||
|
||||
<exe id="taskbarbutton" template="wx_sample" template_append="wx_append">
|
||||
<sources>taskbarbutton.cpp</sources>
|
||||
<wx-lib>adv</wx-lib>
|
||||
<wx-lib>core</wx-lib>
|
||||
<wx-lib>base</wx-lib>
|
||||
</exe>
|
||||
|
||||
</makefile>
|
@@ -1,375 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: taskbarbutton.cpp
|
||||
// Purpose: wxTaskBarButton sample
|
||||
// Author: Chaobin Zhang <zhchbin@gmail.com>
|
||||
// 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<wxThumbBarButton*> 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());
|
||||
}
|
@@ -658,8 +658,6 @@
|
||||
|
||||
#define wxUSE_TASKBARICON_BALLOONS 0
|
||||
|
||||
#define wxUSE_TASKBARBUTTON 0
|
||||
|
||||
#define wxUSE_UXTHEME 0
|
||||
|
||||
#define wxUSE_INKEDIT 0
|
||||
|
@@ -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<wxTaskBarButtonImpl*>(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);
|
||||
|
@@ -1,316 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/msw/taskbarbutton.cpp
|
||||
// Purpose: Implements wxTaskBarButtonImpl class for manipulating buttons on
|
||||
// the Windows taskbar.
|
||||
// Author: Chaobin Zhang <zhchbin@gmail.com>
|
||||
// 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 <Shobjidl.h>
|
||||
#include <initguid.h>
|
||||
|
||||
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<THUMBBUTTONFLAGS>(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<void **>(&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<TBPFLAG>(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<THUMBBUTTONMASK>(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<THUMBBUTTONMASK>(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<THUMBBUTTONMASK>(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
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user