// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "toolbar.h"
#endif
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#ifdef __VMS
#define XtDisplay XTDISPLAY
#endif
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
#endif
// ----------------------------------------------------------------------------
{
if( !wxControl::CreateControl( parent, id, pos, size, style,
wxDefaultValidator, name ) )
- return FALSE;
+ return false;
m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
m_mainWidget = (WXWidget) toolbar;
- ChangeFont(FALSE);
+ ChangeFont(false);
wxPoint rPos = pos;
wxSize rSize = size;
if( rSize.x == -1 && GetParent() )
rSize.x = GetParent()->GetSize().x;
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
rPos.x, rPos.y, rSize.x, rSize.y);
ChangeBackgroundColour();
- return TRUE;
+ return true;
}
wxToolBar::~wxToolBar()
if ( m_tools.GetCount() == 0 )
{
// nothing to do
- return TRUE;
+ return true;
}
bool isVertical = GetWindowStyle() & wxTB_VERTICAL;
Pixmap pixmap, insensPixmap;
wxBitmap bmp, insensBmp;
- wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node )
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
if( !tool->GetButtonWidget() )
{
- DoChangeBackgroundColour((WXWidget) button,
- m_backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) button,
+ m_backgroundColour, true);
tool->SetWidget(button);
}
wxColour col;
col.SetPixel(backgroundPixel);
- if( bmp.GetMask() )
+ if( bmp.Ok() && bmp.GetMask() )
{
bmp = wxCreateMaskedBitmap(bmp, col);
tool->SetNormalBitmap(bmp);
}
- if( insensBmp.GetMask() )
+ if( insensBmp.Ok() && insensBmp.GetMask() )
{
insensBmp = wxCreateMaskedBitmap(insensBmp, col);
tool->SetDisabledBitmap(insensBmp);
wxColour col;
col.SetPixel(backgroundPixel);
- pixmap = (Pixmap) bmp.GetPixmap();
+ pixmap = (Pixmap) bmp.GetDrawable();
{
wxBitmap tmp = tool->GetDisabledBitmap();
insensPixmap = tmp.Ok() ?
- (Pixmap)tmp.GetPixmap() :
+ (Pixmap)tmp.GetDrawable() :
tool->GetInsensPixmap();
}
isVertical ? buttonWidth + 2 * marginX : -1,
isVertical ? -1 : buttonHeight + 2*marginY );
- return TRUE;
+ return true;
}
wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
{
tool->Attach(this);
- return TRUE;
+ return true;
}
bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
int packing = GetToolPacking();
int offset = 0;
- for( wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ for( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node; node = node->GetNext() )
{
wxToolBarTool *t = (wxToolBarTool*)node->GetData();
}
}
- return TRUE;
+ return true;
}
void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable)
{
wxToolBarTool *tool = (wxToolBarTool *)toolBase;
-
- XtSetSensitive(tool->GetButtonWidget(), (Boolean) enable);
+ if (tool->GetButtonWidget()){
+ XtSetSensitive(tool->GetButtonWidget(), (Boolean) enable);
+ } else if (wxTOOL_STYLE_CONTROL == tool->GetStyle()){
+ // Controls (such as wxChoice) do not have button widgets
+ tool->GetControl()->Enable(enable);
+ }
}
void wxToolBar::DoToggleTool(wxToolBarToolBase *toolBase, bool toggle)
wxToolBarToolBase *wxToolBar::FindToolByWidget(WXWidget w) const
{
- wxToolBarToolsList::Node* node = m_tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node )
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
wxToolBarTimer::help_popup = (Widget) 0;
// One shot
- wxTheToolBarTimer->Start(delayMilli, TRUE);
+ wxTheToolBarTimer->Start(delayMilli, true);
}
/************************************************************/