36#include <wx/dcclient.h>
41#include <wx/settings.h>
53#include "../commands/CommandManager.h"
54#include "../widgets/AButton.h"
55#include "../widgets/Grabber.h"
82 void OnErase(wxEraseEvent & event);
83 void OnPaint(wxPaintEvent & event);
86 void OnEnter(wxMouseEvent & event);
87 void OnLeave(wxMouseEvent & event);
118: wxWindow(bar, wxID_ANY, wxDefaultPosition, wxSize(
RWIDTH, -1))
121 SetCursor( wxCURSOR_SIZEWE );
143 wxPaintDC dc( (wxWindow *) event.GetEventObject() );
149#if defined( __WXGTK__ )
155 wxSize sz = GetSize();
202 const auto text = GetToolTipText();
220 if( HasCapture() && event.Dragging() )
226 wxPoint pos = wxGetMousePosition();
228 wxRect r =
mBar->GetRect();
229 wxSize minsz =
mBar->GetMinSize();
230 wxSize maxsz =
mBar->GetMaxSize();
231 wxSize psz =
mBar->GetParent()->GetClientSize();
237 if( maxsz != wxDefaultSize )
239 if( r.width > maxsz.x )
243 if( r.height > maxsz.y )
250 if( r.width < minsz.x )
255 else if( r.GetRight() > psz.x - 3 )
262 r.SetRight( psz.x - 3 );
277 mBar->GetParent()->Refresh();
278 mBar->GetParent()->Update();
295 if (HasCapture() && WXK_ESCAPE == event.GetKeyCode()) {
333 const wxString §ion,
342 mResizable = resizable;
368 return XO(
"Audacity %s Toolbar").Format(
GetLabel() );
460 wxWindow * pParent = GetParent();
463 pParent->CentreOnParent();
464 pParent->Move( pParent->GetPosition() + wxSize(
mType*10,
mType*10 ));
466 pParent->Show( show );
485 wxNO_BORDER | wxTAB_TRAVERSAL,
506 wxSize sz = GetSize();
518 wxSize sz3 = GetSize();
529 SetLayoutDirection(wxLayout_LeftToRight);
534 GetParent()->Refresh();
539 auto ms = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
543 ms->Add(
mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1);
546 ms->Add((
mHSizer =
safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND);
556 ms->Add(
mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1);
557 mResizer->SetToolTip(
_(
"Click and drag to resize toolbar"));
565 SetSizerAndFit(ms.release());
570 wxSize sz = GetSize();
571 sz.y = ( ( ( sz.y + tbs -1) / tbs ) * tbs ) - 1;
617 mResizer->SetToolTip(
_(
"Click and drag to resize toolbar") );
619 GetParent()->GetEventHandler()->AddPendingEvent( e );
620 GetParent()->Refresh();
632 return dynamic_cast<ToolDock*
>(GetParent());
670 GetParent()->SetClientSize( GetSize() + wxSize( 2,2));
746 mHSizer->AddStretchSpacer( prop );
779 bool bUseAqua =
false;
781#ifdef EXPERIMENTAL_THEME_PREFS
782 gPrefs->Read( wxT(
"/GUI/ShowMac"), &bUseAqua,
false);
786 bUseAqua = !bUseAqua;
805 bool bUseAqua =
false;
807#ifdef EXPERIMENTAL_THEME_PREFS
808 gPrefs->Read( wxT(
"/GUI/ShowMac"), &bUseAqua,
false);
812 bUseAqua = !bUseAqua;
850 bool processdownevents,
854 int xoff = wxMax( 0, (
size.GetWidth() -
theTheme.
Image(eStandardUp).GetWidth())/2);
855 int yoff = wxMax( 0, (
size.GetHeight() -
theTheme.
Image(eStandardUp).GetHeight())/2);
857 typedef std::unique_ptr<wxImage> wxImagePtr;
858 wxImagePtr up2 (
OverlayImage(eUp, eStandardUp, xoff, yoff));
859 wxImagePtr hilite2 (
OverlayImage(eHilite, eStandardUp, xoff, yoff));
860 wxImagePtr down2 (
OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));
861 wxImagePtr downHi2 (
OverlayImage(eDownHi, eStandardDown, xoff + 1, yoff + 1));
862 wxImagePtr disable2 (
OverlayImage(eUp, eDisabled, xoff, yoff));
867 *disable2, processdownevents);
884 int xoff = wxMax( 0, (
size.GetWidth() -
theTheme.
Image(eStandardUp).GetWidth())/2);
885 int yoff = wxMax( 0, (
size.GetHeight() -
theTheme.
Image(eStandardUp).GetHeight())/2);
887 typedef std::unique_ptr<wxImage> wxImagePtr;
888 wxImagePtr up (
OverlayImage(eUp, eStandardUp, xoff, yoff));
889 wxImagePtr hilite (
OverlayImage(eHilite, eStandardUp, xoff, yoff));
890 wxImagePtr down (
OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));
891 wxImagePtr downHi (
OverlayImage(eDownHi, eStandardDown, xoff + 1, yoff + 1));
892 wxImagePtr disable (
OverlayImage(eUp, eDisabled, xoff, yoff));
902 const auto project = &theProject;
903 const auto commandManager =
907 commandManager->DescribeCommandsAndShortcuts(commands, nCommands);
939 wxPaintDC dc(
this );
951 event.ResumePropagation(wxEVENT_PROPAGATE_MAX);
DEFINE_EVENT_TYPE(EVT_FREQWINDOW_RECALC)
std::unique_ptr< wxImage > OverlayImage(wxImage *background, wxImage *foreground, wxImage *mask, int xoff, int yoff)
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
static void Dark(wxDC *dc, bool selected, bool highlight=false)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
static CommandManager & Get(AudacityProject &project)
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
The widget to the left of a ToolBar that allows it to be dragged around to NEW positions.
void SetToolTip(const TranslatableString &toolTip)
void PushButton(bool state)
wxColour & Colour(int iIndex)
wxImage & Image(int iIndex)
void ReplaceImage(int iIndex, wxImage *pImage)
Holds a msgid for the translation catalog; may also bind format arguments.
void SetLabel(const TranslatableString &label)
bool Create(wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))