Move taskbar button from wxTopLevelWindowMSW to wxFrame.
Since there are two sub-classes of wxTopLevelWindowMSW: one is wxFrame, the other is wxDialog. However, wxDialog have no button shown in taskbar on windows, so the taskbar button feature should be only avaiable in wxFrame. Author: Chaobin Zhang git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,6 +56,11 @@
|
||||
#include "wx/univ/colschem.h"
|
||||
#endif // __WXUNIVERSAL__
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
#include "wx/taskbarbutton.h"
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -65,6 +70,7 @@
|
||||
#endif // wxUSE_MENUS || wxUSE_MENUS_NATIVE
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
static WXUINT gs_msgTaskbarButtonCreated = 0;
|
||||
#define wxTHBN_CLICKED 0x1800
|
||||
#endif // wxUSE_TASKBARBUTTON
|
||||
|
||||
@@ -136,9 +142,27 @@ bool wxFrame::Create(wxWindow *parent,
|
||||
SetAcceleratorTable(accel);
|
||||
#endif // wxUSE_ACCEL && __POCKETPC__
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
m_taskBarButton = NULL;
|
||||
gs_msgTaskbarButtonCreated =
|
||||
::RegisterWindowMessage(wxT("TaskbarButtonCreated"));
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxFrame::~wxFrame()
|
||||
{
|
||||
SendDestroyEvent();
|
||||
|
||||
DeleteAllBars();
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
if ( m_taskBarButton )
|
||||
delete m_taskBarButton;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFrame client size calculations
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -474,6 +498,13 @@ 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)
|
||||
{
|
||||
@@ -867,9 +898,11 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
if ( cmd == wxTHBN_CLICKED && MSWGetTaskBarButton() )
|
||||
if ( cmd == wxTHBN_CLICKED && m_taskBarButton )
|
||||
{
|
||||
return wxTopLevelWindowMSW::HandleTHBNClickedCommand(id);
|
||||
wxCommandEvent event(wxEVT_BUTTON, id);
|
||||
event.SetEventObject(this);
|
||||
return ProcessEvent(event);
|
||||
}
|
||||
#endif // wxUSE_TASKBARBUTTON
|
||||
|
||||
@@ -927,6 +960,13 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user