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:
parent
844cdba9d9
commit
156599ce56
@ -11,6 +11,10 @@
|
||||
#ifndef _WX_FRAME_H_
|
||||
#define _WX_FRAME_H_
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
class WXDLLIMPEXP_FWD_ADV wxTaskBarButton;
|
||||
#endif
|
||||
|
||||
class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
|
||||
{
|
||||
public:
|
||||
@ -109,6 +113,15 @@ 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();
|
||||
@ -165,6 +178,10 @@ 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)
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
virtual void ShowThumbnailToolbar() wxOVERRIDE;
|
||||
|
||||
private:
|
||||
friend class wxTopLevelWindowMSW;
|
||||
friend class wxFrame;
|
||||
wxTaskBarButtonImpl(WXWidget parent);
|
||||
|
||||
WXWidget m_hwnd;
|
||||
|
@ -11,8 +11,6 @@
|
||||
#ifndef _WX_MSW_TOPLEVEL_H_
|
||||
#define _WX_MSW_TOPLEVEL_H_
|
||||
|
||||
class WXDLLIMPEXP_FWD_ADV wxTaskBarButton;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTopLevelWindowMSW
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -139,17 +137,6 @@ public:
|
||||
virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu);
|
||||
#endif // wxUSE_MENUS && !__WXUNIVERSAL__
|
||||
|
||||
#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();
|
||||
|
||||
bool HandleTHBNClickedCommand(WXWORD id);
|
||||
#endif // wxUSE_TASKBARBUTTON
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
@ -268,10 +255,6 @@ private:
|
||||
// menu is opened, 2 when its submenu is opened and so on.
|
||||
int m_menuDepth;
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
wxTaskBarButton *m_taskBarButton;
|
||||
#endif
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW);
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -55,10 +55,6 @@
|
||||
|
||||
#include "wx/display.h"
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
#include "wx/taskbarbutton.h"
|
||||
#endif
|
||||
|
||||
#ifndef ICON_BIG
|
||||
#define ICON_BIG 1
|
||||
#endif
|
||||
@ -75,9 +71,6 @@
|
||||
extern wxMenu *wxCurrentPopupMenu;
|
||||
#endif // wxUSE_MENUS || wxUSE_MENUS_NATIVE
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
static WXUINT gs_msgTaskbarButtonCreated = 0;
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// stubs for missing functions under MicroWindows
|
||||
@ -431,13 +424,6 @@ WXLRESULT wxTopLevelWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WX
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
if ( message == gs_msgTaskbarButtonCreated )
|
||||
{
|
||||
m_taskBarButton = new wxTaskBarButtonImpl(GetHandle());
|
||||
processed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !processed )
|
||||
rc = wxTopLevelWindowBase::MSWWindowProc(message, wParam, lParam);
|
||||
@ -655,12 +641,6 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
|
||||
SetRightMenu(); // to nothing for initialization
|
||||
#endif
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
m_taskBarButton = NULL;
|
||||
gs_msgTaskbarButtonCreated =
|
||||
::RegisterWindowMessage(wxT("TaskbarButtonCreated"));
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -688,10 +668,6 @@ wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
|
||||
::BringWindowToTop(GetHwndOf(parent));
|
||||
}
|
||||
}
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
if ( m_taskBarButton )
|
||||
delete m_taskBarButton;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1576,19 +1552,6 @@ wxMenu* wxTopLevelWindowMSW::MSWFindMenuFromHMENU(WXHMENU WXUNUSED(hMenu))
|
||||
|
||||
#endif // wxUSE_MENUS && !__WXUNIVERSAL__
|
||||
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
wxTaskBarButton* wxTopLevelWindowMSW::MSWGetTaskBarButton()
|
||||
{
|
||||
return m_taskBarButton;
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMSW::HandleTHBNClickedCommand(WXWORD id)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_BUTTON, id);
|
||||
event.SetEventObject(this);
|
||||
return ProcessEvent(event);
|
||||
}
|
||||
#endif // wxUSE_TASKBARBUTTON
|
||||
|
||||
|
||||
// the DialogProc for all wxWidgets dialogs
|
||||
|
Loading…
Reference in New Issue
Block a user