Add new api for appending a separator to the thumbnail toolbar.
Actually, when calling AppendSeparator we are appending a disable ThumbBarButton without background, which can simulate the behavior of appending a separator. Author: Chaobin Zhang git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4c08974648
commit
dd06fa3aa8
@ -35,6 +35,7 @@ public:
|
|||||||
virtual bool InsertThumbBarButton(size_t pos,
|
virtual bool InsertThumbBarButton(size_t pos,
|
||||||
wxThumbBarButton *button) wxOVERRIDE;
|
wxThumbBarButton *button) wxOVERRIDE;
|
||||||
virtual bool AppendThumbBarButton(wxThumbBarButton *button) wxOVERRIDE;
|
virtual bool AppendThumbBarButton(wxThumbBarButton *button) wxOVERRIDE;
|
||||||
|
virtual bool AppendSeparatorInThumbBar() wxOVERRIDE;
|
||||||
virtual wxThumbBarButton* RemoveThumbBarButton(
|
virtual wxThumbBarButton* RemoveThumbBarButton(
|
||||||
wxThumbBarButton *button) wxOVERRIDE;
|
wxThumbBarButton *button) wxOVERRIDE;
|
||||||
virtual wxThumbBarButton* RemoveThumbBarButton(int id) wxOVERRIDE;
|
virtual wxThumbBarButton* RemoveThumbBarButton(int id) wxOVERRIDE;
|
||||||
|
@ -116,6 +116,7 @@ public:
|
|||||||
virtual void SetThumbnailContents(const wxWindow *child) = 0;
|
virtual void SetThumbnailContents(const wxWindow *child) = 0;
|
||||||
virtual bool InsertThumbBarButton(size_t pos, wxThumbBarButton *button) = 0;
|
virtual bool InsertThumbBarButton(size_t pos, wxThumbBarButton *button) = 0;
|
||||||
virtual bool AppendThumbBarButton(wxThumbBarButton *button) = 0;
|
virtual bool AppendThumbBarButton(wxThumbBarButton *button) = 0;
|
||||||
|
virtual bool AppendSeparatorInThumbBar() = 0;
|
||||||
virtual wxThumbBarButton* RemoveThumbBarButton(wxThumbBarButton *button) = 0;
|
virtual wxThumbBarButton* RemoveThumbBarButton(wxThumbBarButton *button) = 0;
|
||||||
virtual wxThumbBarButton* RemoveThumbBarButton(int id) = 0;
|
virtual wxThumbBarButton* RemoveThumbBarButton(int id) = 0;
|
||||||
|
|
||||||
|
@ -279,21 +279,30 @@ public:
|
|||||||
Inserts the given button before the position pos to the taskbar
|
Inserts the given button before the position pos to the taskbar
|
||||||
thumbnail toolbar.
|
thumbnail toolbar.
|
||||||
|
|
||||||
@note The number of buttons is limited to 7.
|
@note The number of buttons and separators is limited to 7.
|
||||||
|
|
||||||
@see AppendThumbBarButton()
|
@see AppendThumbBarButton(), AppendSeparatorInThumbBar()
|
||||||
*/
|
*/
|
||||||
virtual bool InsertThumbBarButton(size_t pos, wxThumbBarButton *button);
|
virtual bool InsertThumbBarButton(size_t pos, wxThumbBarButton *button);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Adds a button to the taskbar thumbnail toolbar.
|
Appends a button to the taskbar thumbnail toolbar.
|
||||||
|
|
||||||
@note The number of buttons is limited to 7.
|
@note The number of buttons and separators is limited to 7.
|
||||||
|
|
||||||
@see InsertThumbBarButton()
|
@see InsertThumbBarButton(), AppendSeparatorInThumbBar()
|
||||||
*/
|
*/
|
||||||
virtual bool AppendThumbBarButton(wxThumbBarButton *button);
|
virtual bool AppendThumbBarButton(wxThumbBarButton *button);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Appends a separator to the taskbar thumbnail toolbar.
|
||||||
|
|
||||||
|
@note The number of buttons and separators is limited to 7.
|
||||||
|
|
||||||
|
@see AppendThumbBarButton(), InsertThumbBarButton()
|
||||||
|
*/
|
||||||
|
virtual bool AppendSeparatorInThumbBar();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Removes the thumbnail toolbar button from the taskbar button but doesn't
|
Removes the thumbnail toolbar button from the taskbar button but doesn't
|
||||||
delete the associated c++ object.
|
delete the associated c++ object.
|
||||||
|
@ -346,7 +346,6 @@ void MyFrame::OnSetOrRestoreThumbnailClip(wxCommandEvent& event)
|
|||||||
MSWGetTaskBarButton()->SetThumbnailClip(rect);
|
MSWGetTaskBarButton()->SetThumbnailClip(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MyFrame::OnAddThubmBarButton(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnAddThubmBarButton(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if ( m_thumbBarButtons.size() >= 7 )
|
if ( m_thumbBarButtons.size() >= 7 )
|
||||||
|
@ -253,18 +253,35 @@ void wxTaskBarButtonImpl::SetThumbnailContents(const wxWindow *child)
|
|||||||
bool wxTaskBarButtonImpl::AppendThumbBarButton(wxThumbBarButton *button)
|
bool wxTaskBarButtonImpl::AppendThumbBarButton(wxThumbBarButton *button)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT,
|
wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT,
|
||||||
"Number of thumb buttons is limited to 7" );
|
"Number of ThumbBarButtons and separators is limited to 7" );
|
||||||
|
|
||||||
button->SetParent(this);
|
button->SetParent(this);
|
||||||
m_thumbBarButtons.push_back(button);
|
m_thumbBarButtons.push_back(button);
|
||||||
return InitOrUpdateThumbBarButtons();
|
return InitOrUpdateThumbBarButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxTaskBarButtonImpl::AppendSeparatorInThumbBar()
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT,
|
||||||
|
"Number of ThumbBarButtons and separators is limited to 7" );
|
||||||
|
|
||||||
|
// Append a disable ThumbBarButton without background can simulate the
|
||||||
|
// behavior of appending a separator.
|
||||||
|
wxThumbBarButton *separator = new wxThumbBarButton(wxID_ANY,
|
||||||
|
wxNullIcon,
|
||||||
|
wxEmptyString,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false);
|
||||||
|
m_thumbBarButtons.push_back(separator);
|
||||||
|
return InitOrUpdateThumbBarButtons();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxTaskBarButtonImpl::InsertThumbBarButton(size_t pos,
|
bool wxTaskBarButtonImpl::InsertThumbBarButton(size_t pos,
|
||||||
wxThumbBarButton *button)
|
wxThumbBarButton *button)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT,
|
wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT,
|
||||||
"Number of thumb buttons is limited to 7" );
|
"Number of ThumbBarButtons and separators is limited to 7" );
|
||||||
wxASSERT_MSG( pos <= m_thumbBarButtons.size(),
|
wxASSERT_MSG( pos <= m_thumbBarButtons.size(),
|
||||||
"Invalid index when inserting the button" );
|
"Invalid index when inserting the button" );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user