36#include <wx/dcclient.h>
39#include <wx/settings.h>
52#include "../widgets/AButton.h"
53#include "../widgets/Grabber.h"
80 void OnErase(wxEraseEvent & event);
81 void OnPaint(wxPaintEvent & event);
84 void OnEnter(wxMouseEvent & event);
85 void OnLeave(wxMouseEvent & event);
116: wxWindow(bar, wxID_ANY, wxDefaultPosition, wxSize(
RWIDTH, -1))
119 SetCursor( wxCURSOR_SIZEWE );
141 wxPaintDC dc( (wxWindow *) event.GetEventObject() );
147#if defined( __WXGTK__ )
153 wxSize sz = GetSize();
200 const auto text = GetToolTipText();
218 if( HasCapture() && event.Dragging() )
224 wxPoint pos = wxGetMousePosition();
226 wxRect r =
mBar->GetRect();
227 wxSize minsz =
mBar->GetMinSize();
228 wxSize maxsz =
mBar->GetMaxSize();
229 wxSize psz =
mBar->GetParent()->GetClientSize();
235 if( maxsz != wxDefaultSize )
237 if( r.width > maxsz.x )
241 if( r.height > maxsz.y )
248 if( r.width < minsz.x )
253 else if( r.GetRight() > psz.x - 3 )
260 r.SetRight( psz.x - 3 );
275 mBar->GetParent()->Refresh();
276 mBar->GetParent()->Update();
293 if (HasCapture() && WXK_ESCAPE == event.GetKeyCode()) {
338 mResizable = resizable;
359 for(
auto& child : GetChildren())
360 if(child->AcceptsFocusFromKeyboard())
386 return XO(
"Audacity %s Toolbar").Format(
GetLabel() );
475 wxWindow * pParent = GetParent();
478 pParent->CentreOnParent();
480 pParent->Move( pParent->GetPosition() +
481 wxSize{ mIndex * 10, mIndex * 10 });
483 pParent->Show( show );
502 wxNO_BORDER | wxTAB_TRAVERSAL,
523 wxSize sz = GetSize();
535 wxSize sz3 = GetSize();
546 SetLayoutDirection(wxLayout_LeftToRight);
551 GetParent()->Refresh();
556 auto ms = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
560 ms->Add(
mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1);
563 ms->Add((
mHSizer =
safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND);
573 ms->Add(
mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1);
574 mResizer->SetToolTip(
_(
"Click and drag to resize toolbar"));
582 SetSizerAndFit(ms.release());
587 wxSize sz = GetSize();
588 sz.y = ( ( ( sz.y + tbs -1) / tbs ) * tbs ) - 1;
634 mResizer->SetToolTip(
_(
"Click and drag to resize toolbar") );
636 GetParent()->GetEventHandler()->AddPendingEvent( e );
637 GetParent()->Refresh();
649 return dynamic_cast<ToolDock*
>(GetParent());
693 GetParent()->SetClientSize( GetSize() + wxSize( 2,2));
769 mHSizer->AddStretchSpacer( prop );
849 bool processdownevents,
853 int xoff = wxMax( 0, (
size.GetWidth() -
theTheme.
Image(eStandardUp).GetWidth())/2);
854 int yoff = wxMax( 0, (
size.GetHeight() -
theTheme.
Image(eStandardUp).GetHeight())/2);
856 typedef std::unique_ptr<wxImage> wxImagePtr;
857 wxImagePtr up2 (
OverlayImage(eUp, eStandardUp, xoff, yoff));
858 wxImagePtr hilite2 (
OverlayImage(eHilite, eStandardUp, xoff, yoff));
859 wxImagePtr down2 (
OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));
860 wxImagePtr downHi2 (
OverlayImage(eDownHi, eStandardDown, xoff + 1, yoff + 1));
861 wxImagePtr disable2 (
OverlayImage(eUp, eDisabled, xoff, yoff));
866 *disable2, processdownevents);
885 bool processdownevents,
889 bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredUpHiliteLarge, bmpRecoloredHiliteLarge,
890 eEnabledUp, eEnabledDown, eDisabled,
892 wxDefaultPosition, processdownevents,
903 r->
SetFocusRect( r->GetClientRect().Deflate( deflation, deflation ) );
920 int xoff = wxMax( 0, (
size.GetWidth() -
theTheme.
Image(eStandardUp).GetWidth())/2);
921 int yoff = wxMax( 0, (
size.GetHeight() -
theTheme.
Image(eStandardUp).GetHeight())/2);
923 typedef std::unique_ptr<wxImage> wxImagePtr;
924 wxImagePtr up (
OverlayImage(eUp, eStandardUp, xoff, yoff));
925 wxImagePtr hilite (
OverlayImage(eHilite, eStandardUp, xoff, yoff));
926 wxImagePtr down (
OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));
927 wxImagePtr downHi (
OverlayImage(eDownHi, eStandardDown, xoff + 1, yoff + 1));
928 wxImagePtr disable (
OverlayImage(eUp, eDisabled, xoff, yoff));
938 const auto project = &theProject;
939 const auto commandManager =
943 commandManager->DescribeCommandsAndShortcuts(commands, nCommands);
975 wxPaintDC dc(
this );
987 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)
An explicitly nonlocalized string, not meant for the user to see.
wxColour & Colour(int iIndex)
wxImage & Image(int iIndex)
void ReplaceImage(int iIndex, wxImage *pImage)
wxSize ImageSize(int iIndex)
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"))
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.
IMPORT_EXPORT_API ExportResult Show(ExportTask exportTask)