Added wxToolBar::SetTool[Normal|Disabled]Bitmap for wxMSW, wxGTK and wxMac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44317 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -99,6 +99,7 @@ All:
|
|||||||
- Made wxTextFile work with unseekable files again (David Hart)
|
- Made wxTextFile work with unseekable files again (David Hart)
|
||||||
- Added wxCONFIG_USE_SUBDIR flag to wxFileConfig (Giuseppe Bilotta)
|
- Added wxCONFIG_USE_SUBDIR flag to wxFileConfig (Giuseppe Bilotta)
|
||||||
- Added wxSearchCtrl::[Get|Set]DescriptiveText
|
- Added wxSearchCtrl::[Get|Set]DescriptiveText
|
||||||
|
- Added wxToolBar::SetTool[Normal|Disabled]Bitmap for wxMSW, wxGTK and wxMac
|
||||||
|
|
||||||
wxMSW
|
wxMSW
|
||||||
|
|
||||||
|
@@ -52,6 +52,12 @@ public:
|
|||||||
|
|
||||||
virtual void SetWindowStyleFlag( long style );
|
virtual void SetWindowStyleFlag( long style );
|
||||||
|
|
||||||
|
#if wxABI_VERSION >= 20802
|
||||||
|
// TODO: In 2.9 these should probably be virtual, and declared in the base class...
|
||||||
|
void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
|
||||||
|
void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
|
||||||
|
#endif
|
||||||
|
|
||||||
static wxVisualAttributes
|
static wxVisualAttributes
|
||||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||||
|
|
||||||
|
@@ -57,7 +57,13 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
|
|||||||
|
|
||||||
virtual void SetRows(int nRows);
|
virtual void SetRows(int nRows);
|
||||||
|
|
||||||
// Add all the buttons
|
#if wxABI_VERSION >= 20802
|
||||||
|
// TODO: In 2.9 these should probably be virtual, and declared in the base class...
|
||||||
|
void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
|
||||||
|
void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Add all the buttons
|
||||||
|
|
||||||
virtual wxString MacGetToolTipString( wxPoint &where ) ;
|
virtual wxString MacGetToolTipString( wxPoint &where ) ;
|
||||||
void OnPaint(wxPaintEvent& event) ;
|
void OnPaint(wxPaintEvent& event) ;
|
||||||
|
@@ -54,6 +54,12 @@ public:
|
|||||||
|
|
||||||
virtual void SetRows(int nRows);
|
virtual void SetRows(int nRows);
|
||||||
|
|
||||||
|
#if wxABI_VERSION >= 20802
|
||||||
|
// TODO: In 2.9 these should probably be virtual, and declared in the base class...
|
||||||
|
void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
|
||||||
|
void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
|
||||||
|
#endif
|
||||||
|
|
||||||
// implementation only from now on
|
// implementation only from now on
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
|
||||||
|
@@ -597,6 +597,30 @@ void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
|
||||||
|
{
|
||||||
|
wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id));
|
||||||
|
if ( tool )
|
||||||
|
{
|
||||||
|
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
|
||||||
|
|
||||||
|
tool->SetNormalBitmap(bitmap);
|
||||||
|
tool->SetImage(tool->GetBitmap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
|
||||||
|
{
|
||||||
|
wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id));
|
||||||
|
if ( tool )
|
||||||
|
{
|
||||||
|
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
|
||||||
|
|
||||||
|
tool->SetDisabledBitmap(bitmap);
|
||||||
|
tool->SetImage(tool->GetBitmap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxToolBar idle handling
|
// wxToolBar idle handling
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -168,10 +168,19 @@ public:
|
|||||||
m_toolbarItemRef = ref;
|
m_toolbarItemRef = ref;
|
||||||
if ( m_toolbarItemRef )
|
if ( m_toolbarItemRef )
|
||||||
{
|
{
|
||||||
|
wxFont f;
|
||||||
|
wxFontEncoding enc;
|
||||||
|
if ( GetToolBar() )
|
||||||
|
f = GetToolBar()->GetFont();
|
||||||
|
if ( f.IsOk() )
|
||||||
|
enc = f.GetEncoding();
|
||||||
|
else
|
||||||
|
enc = wxFont::GetDefaultEncoding();
|
||||||
|
|
||||||
HIToolbarItemSetHelpText(
|
HIToolbarItemSetHelpText(
|
||||||
m_toolbarItemRef,
|
m_toolbarItemRef,
|
||||||
wxMacCFStringHolder( GetShortHelp(), GetToolBar()->GetFont().GetEncoding() ),
|
wxMacCFStringHolder( GetShortHelp(), enc ),
|
||||||
wxMacCFStringHolder( GetLongHelp(), GetToolBar()->GetFont().GetEncoding() ) );
|
wxMacCFStringHolder( GetLongHelp(), enc ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1312,6 +1321,33 @@ void wxToolBar::MacSuperChangedPosition()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
|
||||||
|
{
|
||||||
|
wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id));
|
||||||
|
if ( tool )
|
||||||
|
{
|
||||||
|
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
|
||||||
|
|
||||||
|
tool->SetNormalBitmap(bitmap);
|
||||||
|
|
||||||
|
// a side-effect of the UpdateToggleImage function is that it always changes the bitmap used on the button.
|
||||||
|
tool->UpdateToggleImage( tool->CanBeToggled() && tool->IsToggled() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
|
||||||
|
{
|
||||||
|
wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id));
|
||||||
|
if ( tool )
|
||||||
|
{
|
||||||
|
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
|
||||||
|
|
||||||
|
tool->SetDisabledBitmap(bitmap);
|
||||||
|
|
||||||
|
// TODO: what to do for this one?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
|
wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool;
|
wxToolBarTool *tool;
|
||||||
@@ -1365,6 +1401,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
|
|||||||
Rect toolrect = { 0, 0, toolSize.y, toolSize.x };
|
Rect toolrect = { 0, 0, toolSize.y, toolSize.x };
|
||||||
ControlRef controlHandle = NULL;
|
ControlRef controlHandle = NULL;
|
||||||
OSStatus err = 0;
|
OSStatus err = 0;
|
||||||
|
tool->Attach( this );
|
||||||
|
|
||||||
switch (tool->GetStyle())
|
switch (tool->GetStyle())
|
||||||
{
|
{
|
||||||
@@ -1494,7 +1531,6 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
|
|||||||
tool->UpdateToggleImage( true );
|
tool->UpdateToggleImage( true );
|
||||||
|
|
||||||
// nothing special to do here - we relayout in Realize() later
|
// nothing special to do here - we relayout in Realize() later
|
||||||
tool->Attach( this );
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -1331,6 +1331,30 @@ void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(tog
|
|||||||
wxFAIL_MSG( _T("not implemented") );
|
wxFAIL_MSG( _T("not implemented") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
|
||||||
|
{
|
||||||
|
wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id));
|
||||||
|
if ( tool )
|
||||||
|
{
|
||||||
|
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
|
||||||
|
|
||||||
|
tool->SetNormalBitmap(bitmap);
|
||||||
|
Realize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
|
||||||
|
{
|
||||||
|
wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id));
|
||||||
|
if ( tool )
|
||||||
|
{
|
||||||
|
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
|
||||||
|
|
||||||
|
tool->SetDisabledBitmap(bitmap);
|
||||||
|
Realize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// event handlers
|
// event handlers
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -29,10 +29,12 @@
|
|||||||
global:
|
global:
|
||||||
# wxFileHistory::Set/GetBaseId()
|
# wxFileHistory::Set/GetBaseId()
|
||||||
*wxFileHistory*etBaseId*;
|
*wxFileHistory*etBaseId*;
|
||||||
|
*wxSearchCtrl*SetDescriptiveText*;
|
||||||
|
*wxSearchCtrl*GetDescriptiveText*;
|
||||||
*wxSizerFlags*Shaped*;
|
*wxSizerFlags*Shaped*;
|
||||||
*wxSizerFlags*FixedMinSize*;
|
*wxSizerFlags*FixedMinSize*;
|
||||||
*wxSearchCtrl*SetDescriptiveText*;
|
*wxToolBar*SetToolNormalBitmap;
|
||||||
*wxSearchCtrl*GetDescriptiveText*;
|
*wxToolBar*SetToolDisabledBitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
# public symbols added in 2.8.1 (please keep in alphabetical order):
|
# public symbols added in 2.8.1 (please keep in alphabetical order):
|
||||||
@@ -43,10 +45,10 @@
|
|||||||
*wxDirDialog*etStyle*;
|
*wxDirDialog*etStyle*;
|
||||||
# Mac OS X only, but it still must go in IIUC
|
# Mac OS X only, but it still must go in IIUC
|
||||||
*wxListCtrl*SetFocus*;
|
*wxListCtrl*SetFocus*;
|
||||||
*wxListCtrl*OnChar*;
|
*wxListCtrl*OnChar*;
|
||||||
*wxListCtrl*OnRightDown*;
|
*wxListCtrl*OnRightDown*;
|
||||||
*wxListCtrl*OnMiddleDown*;
|
*wxListCtrl*OnMiddleDown*;
|
||||||
*wxListCtrl*FireMouseEvent*;
|
*wxListCtrl*FireMouseEvent*;
|
||||||
# wxTreeCtrl::CollapseAll[Children]() and IsEmpty
|
# wxTreeCtrl::CollapseAll[Children]() and IsEmpty
|
||||||
*wxTreeCtrl*CollapseAll*;
|
*wxTreeCtrl*CollapseAll*;
|
||||||
*wxTreeCtrl*IsEmpty*;
|
*wxTreeCtrl*IsEmpty*;
|
||||||
|
@@ -5,6 +5,12 @@ Recent Changes for wxPython
|
|||||||
-------
|
-------
|
||||||
*
|
*
|
||||||
|
|
||||||
|
Added wx.ToolBar.SetToolNormalBitmap and SetToolDisabledBitmap
|
||||||
|
methods. (Keep in mind however that the disabled bitmap is currently
|
||||||
|
generated on the fly by most native toolbar widgets, so this
|
||||||
|
SetToolDisabledBitmap method won't have any affect on them...)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2.8.1.1
|
2.8.1.1
|
||||||
|
@@ -442,6 +442,10 @@ public:
|
|||||||
long style = wxNO_BORDER | wxTB_HORIZONTAL,
|
long style = wxNO_BORDER | wxTB_HORIZONTAL,
|
||||||
const wxString& name = wxPyToolBarNameStr);
|
const wxString& name = wxPyToolBarNameStr);
|
||||||
|
|
||||||
|
// TODO: In 2.9 move these to the base class...
|
||||||
|
void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
|
||||||
|
void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
|
||||||
|
|
||||||
static wxVisualAttributes
|
static wxVisualAttributes
|
||||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user