/////////////////////////////////////////////////////////////////////////////
-// Name: motif/toolbar.cpp
+// Name: src/motif/toolbar.cpp
// Purpose: wxToolBar
// Author: Julian Smart
// Modified by: 13.12.99 by VZ during toolbar classes reorganization
// headers
// ----------------------------------------------------------------------------
-#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
-
-#include "wx/settings.h"
-#include "wx/app.h"
-#include "wx/timer.h"
#include "wx/toolbar.h"
-#include "wx/frame.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/frame.h"
+ #include "wx/timer.h"
+ #include "wx/settings.h"
+#endif
#ifdef __VMS__
#pragma message disable nosimpint
Init();
}
- wxToolBarTool(wxToolBar *tbar, wxControl *control)
- : wxToolBarToolBase(tbar, control)
+ wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label)
+ : wxToolBarToolBase(tbar, control, label)
{
Init();
}
// globals
// ----------------------------------------------------------------------------
-static wxToolBarTimer* wxTheToolBarTimer = (wxToolBarTimer*) NULL;
+static wxToolBarTimer* wxTheToolBarTimer = NULL;
Widget wxToolBarTimer::help_popup = (Widget) 0;
Widget wxToolBarTimer::buttonWidget = (Widget) 0;
}
-wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
+wxToolBarToolBase *
+wxToolBar::CreateTool(wxControl *control, const wxString& label)
{
- return new wxToolBarTool(this, control);
+ return new wxToolBarTool(this, control, label);
}
void wxToolBarTool::Init()
if( !wxControl::CreateControl( parent, id, pos, size, style,
wxDefaultValidator, name ) )
return false;
+ PreCreation();
- m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
+ FixupStyle();
Widget parentWidget = (Widget) parent->GetClientWidget();
m_mainWidget = (WXWidget) toolbar;
- ChangeFont(false);
-
wxPoint rPos = pos;
wxSize rSize = size;
if( rSize.x == -1 && GetParent() )
rSize.x = GetParent()->GetSize().x;
+ PostCreation();
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
rPos.x, rPos.y, rSize.x, rSize.y);
- ChangeBackgroundColour();
-
return true;
}
insensBmp = tool->GetDisabledBitmap();
if ( bmp.GetMask() || insensBmp.GetMask() )
{
- int backgroundPixel;
+ WXPixel backgroundPixel;
XtVaGetValues(button, XmNbackground, &backgroundPixel,
NULL);
// Create a selected/toggled bitmap. If there isn't a 2nd
// bitmap, we need to create it (with a darker, selected
// background)
- int backgroundPixel;
+ WXPixel backgroundPixel;
if ( tool->CanBeToggled() )
XtVaGetValues(button, XmNselectColor, &backgroundPixel,
NULL);
(Pixmap)tmp.GetDrawable() :
tool->GetInsensPixmap();
}
-
+
if (tool->CanBeToggled())
{
// Toggle button
{
wxFAIL_MSG( _T("TODO") );
- return (wxToolBarToolBase *)NULL;
+ return NULL;
}
bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
return true;
}
-bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
+bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
{
tool->Detach();
offset = isVertical ? size.y : size.x;
offset += packing;
break;
- }
+ }
case wxTOOL_STYLE_SEPARATOR:
offset = isVertical ? 0 : separatorSize;
break;
{
case wxTOOL_STYLE_CONTROL:
{
- wxPoint pos = t->GetControl()->GetPosition();
+ wxPoint location = t->GetControl()->GetPosition();
if( isVertical )
- pos.y -= offset;
+ location.y -= offset;
else
- pos.x -= offset;
+ location.x -= offset;
- t->GetControl()->Move( pos );
+ t->GetControl()->Move( location );
break;
}
case wxTOOL_STYLE_SEPARATOR:
NULL );
if( isVertical )
- y -= offset;
+ y = (Dimension)(y - offset);
else
- x -= offset;
+ x = (Dimension)(x - offset);
XtVaSetValues( t->GetButtonWidget(),
XmNx, x,
}
wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
-
+
// We must refresh the frame size when the toolbar changes size
// otherwise the toolbar can be shown incorrectly
if ( old_width != width || old_height != height )
{
- // But before we send the size event check it
+ // But before we send the size event check it
// we have a frame that is not being deleted.
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
if ( frame && !frame->IsBeingDeleted() )
node = node->GetNext();
}
- return (wxToolBarToolBase *)NULL;
+ return NULL;
}
static void wxToolButtonCallback(Widget w,
// Move the tooltip more or less above the button
int yOffset = 20; // TODO: What should be really?
- y -= yOffset;
+ y = (Position)(y - yOffset);
if (y < yOffset) y = 0;
/************************************************************/
/************************************************************/
XtPopup (help_popup, XtGrabNone);
}
-