Audacity 3.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
ExpandingToolBar Class Referencefinal

A smart ToolBar class that has a "MainPanel" which is always displayed, and an "ExtraPanel" that can be hidden to save space. More...

#include <ExpandingToolBar.h>

Inheritance diagram for ExpandingToolBar:
[legend]
Collaboration diagram for ExpandingToolBar:
[legend]

Public Member Functions

 ExpandingToolBar (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 
virtual ~ExpandingToolBar ()
 
wxPanel * GetMainPanel ()
 
wxPanel * GetExtraPanel ()
 
void SetAutoExpand (bool enabled)
 
bool GetAutoExpand ()
 
void Expand ()
 
void Collapse (bool now=false)
 
bool IsExpanded ()
 
void OnSize (wxSizeEvent &evt)
 
void OnToggle (wxCommandEvent &evt)
 
void OnTimer (wxTimerEvent &evt)
 
void StartMoving ()
 
void UpdateMoving ()
 
void FinishMoving ()
 
bool Layout () override
 
void Fit () override
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (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"))
 
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"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Protected Member Functions

void RecursivelyPushEventHandlers (wxWindow *win)
 
bool IsCursorInWindow ()
 
void ReparentExtraPanel ()
 
void MoveDrawer (wxSize prevSize)
 
wxBitmap GetToolbarBitmap ()
 
void TryAutoExpand ()
 
void TryAutoCollapse ()
 

Protected Attributes

wxPanel * mMainPanel
 
wxPanel * mExtraPanel
 
ToolBarGrabbermGrabber
 
AButtonmToggleButton
 
bool mIsAutoExpanded
 
bool mIsManualExpanded
 
bool mIsExpanded
 
bool mAutoExpand
 
bool mFirstTime
 
wxSize mMainSize
 
wxSize mExtraSize
 
wxSize mButtonSize
 
wxSize mGrabberSize
 
wxSize mCurrentDrawerSize
 
wxSize mTargetDrawerSize
 
wxSize mCurrentTotalSize
 
WindowHash mWindowHash
 
wxTimer mTimer
 
ToolBarFramemFrameParent
 
ToolBarDialogmDialogParent
 
ToolBarAreamAreaParent
 
std::unique_ptr< ToolBarArrangementmSavedArrangement
 
wxPanel * mTargetPanel
 
std::unique_ptr< wxDragImage > mDragImage
 
wxWindow * mTopLevelParent
 
std::vector< wxRect > mDropTargets
 
wxRect mDropTarget
 
std::vector< std::unique_ptr< ExpandingToolBarEvtHandler > > mHandlers
 

Static Protected Attributes

static int msNoAutoExpandStack = 0
 

Friends

class ExpandingToolBarEvtHandler
 

Detailed Description

A smart ToolBar class that has a "MainPanel" which is always displayed, and an "ExtraPanel" that can be hidden to save space.

Can be docked into a ToolBarArea or floated in an ToolBarFrame;

If auto-expanding is off, behavior is very simple: clicking the toggle button expands, clicking it again collapses.

If auto-expanding is on, behavior is a little more complicated. When the mouse movers over a toolbar and it is collapsed, it gets auto-expanded, and it gets auto-collapsed as soon as the mouse leaves. However, if they manually toggle it collapsed while it was auto-expanded, it will stay collapsed until you move the mouse completely away and then back again later. If you manually expand it, it will stay manually expanded until you manually collapse it.

Definition at line 45 of file ExpandingToolBar.h.

Constructor & Destructor Documentation

◆ ExpandingToolBar()

ExpandingToolBar::ExpandingToolBar ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize 
)
Todo:
check whether this is a memory leak (and check similar code)

Definition at line 114 of file ExpandingToolBar.cpp.

117 :
118 wxPanelWrapper(parent, id, pos, size),
119 mIsAutoExpanded(false),
120 mIsManualExpanded(false),
121 mIsExpanded(false),
122 mAutoExpand(true),
123 mFirstTime(true),
124 mFrameParent(NULL),
125 mDialogParent(NULL),
126 mAreaParent(NULL),
128 mTopLevelParent(NULL)
129{
131 wxDefaultPosition, wxSize(1, 1));
133 wxDefaultPosition, wxSize(1, 1));
134
135 mGrabber = NULL;
136
137 ToolBarArea *toolBarParent =
138 dynamic_cast<ToolBarArea *>(GetParent());
139 if (toolBarParent)
140 mGrabber = safenew ToolBarGrabber(this, -1, this);
141
143 //wxImage hbar = theTheme.Image(bmpToolBarToggle);
144 //wxColour magicColor = wxColour(0, 255, 255);
145 //ImageArray fourStates = ImageRoll::SplitV(hbar, magicColor);
146/*
147 mToggleButton = safenew AButton(this, kToggleButtonID,
148 wxDefaultPosition, wxDefaultSize,
149 ImageRoll(ImageRoll::HorizontalRoll,
150 fourStates[0], magicColor),
151 ImageRoll(ImageRoll::HorizontalRoll,
152 fourStates[1], magicColor),
153 ImageRoll(ImageRoll::HorizontalRoll,
154 fourStates[2], magicColor),
155 ImageRoll(ImageRoll::HorizontalRoll,
156 fourStates[3], magicColor),
157 true);
158 mToggleButton->UseDisabledAsDownHiliteImage(true);
159*/
160 SetAutoLayout(true);
161 mTimer.SetOwner(this, kTimerID);
162}
@ kTimerID
#define safenew
Definition: MemoryX.h:9
wxWindow * mTopLevelParent
ToolBarArea * mAreaParent
std::unique_ptr< ToolBarArrangement > mSavedArrangement
ToolBarGrabber * mGrabber
ToolBarFrame * mFrameParent
ToolBarDialog * mDialogParent
An alternative to ToolBarFrame which can contain an ExpandingToolBar. ToolBarArea is used for a 'dock...
Draws the grabber for an ExpandingToolBar.

◆ ~ExpandingToolBar()

ExpandingToolBar::~ExpandingToolBar ( )
virtual

Definition at line 164 of file ExpandingToolBar.cpp.

165{
166}

Member Function Documentation

◆ Collapse()

void ExpandingToolBar::Collapse ( bool  now = false)

Definition at line 230 of file ExpandingToolBar.cpp.

231{
232 // After being manually collapsed, we set mIsAutoExpanded back to
233 // true, which prevents it from being immediately auto-expanded
234 // again until after the mouse actually moves away and then
235 // back again later.
236
238 mIsManualExpanded = false;
239 mIsAutoExpanded = false;
240 Fit();
241 mIsAutoExpanded = true;
242
243 if (now) {
245
246 MoveDrawer(wxSize(0, 0));
247 }
248}
void PopUp()
Definition: AButton.cpp:585
void MoveDrawer(wxSize prevSize)
AButton * mToggleButton
void Fit() override

References Fit(), mCurrentDrawerSize, mIsAutoExpanded, mIsManualExpanded, MoveDrawer(), mTargetDrawerSize, mToggleButton, and AButton::PopUp().

Referenced by OnToggle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Expand()

void ExpandingToolBar::Expand ( )

Definition at line 216 of file ExpandingToolBar.cpp.

217{
218 // We set both mIsManualExpanded and mIsAutoExpanded to true;
219 // that way if the user manually collapses the toolbar we set
220 // mIsManualExpanded to false but keep mIsAutoExpanded to true
221 // to prevent it from being auto-expanded again until the user
222 // actually moves the mouse completely away and back again later.
223
225 mIsManualExpanded = true;
226 mIsAutoExpanded = true;
227 Fit();
228}
void PushDown()
Definition: AButton.cpp:577

References Fit(), mIsAutoExpanded, mIsManualExpanded, mToggleButton, and AButton::PushDown().

Referenced by OnToggle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FinishMoving()

void ExpandingToolBar::FinishMoving ( )

Definition at line 620 of file ExpandingToolBar.cpp.

621{
623 return;
624
625 // DELETE mTargetPanel; // I think this is not needed, but unreachable anyway -- PRL
626
628
629 mDragImage->Hide();
630 mDragImage->EndDrag();
631
633
634 if (mDropTarget == kDummyRect) {
636 }
637 else {
638 mSavedArrangement.reset();
640 }
641
642 // Keep all drawers closed until the user moves specifically to a
643 // different window
645
646 mTopLevelParent->Refresh(true);
647
649}
const int kMyTimerInterval
const wxRect kDummyRect
std::unique_ptr< wxDragImage > mDragImage
static int msNoAutoExpandStack
void SetCapturedChild(ExpandingToolBar *child)
void CollapseAll(bool now=false)
void MoveChild(ExpandingToolBar *child, wxRect dropTarget)
void RestoreArrangement(std::unique_ptr< ToolBarArrangement > &&arrangement)

References ToolBarArea::CollapseAll(), kDummyRect, kMyTimerInterval, mAreaParent, mDragImage, mDropTarget, ToolBarArea::MoveChild(), mSavedArrangement, msNoAutoExpandStack, mTimer, mTopLevelParent, ToolBarArea::RestoreArrangement(), and ToolBarArea::SetCapturedChild().

Referenced by ToolBarArea::OnMouse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fit()

void ExpandingToolBar::Fit ( )
override

Definition at line 351 of file ExpandingToolBar.cpp.

352{
353#ifdef EXPERIMENTAL_ROLL_UP_DIALOG
355#else
356 mIsExpanded = true;// JKC - Wedge it open at all times.
357#endif
358
359 int width = mButtonSize.x + mGrabberSize.x;
360
361 wxSize baseWindowSize = wxSize(width,
362 mMainSize.y + mButtonSize.y);
363
364 mTargetDrawerSize = wxSize(mButtonSize.x, 0);
365
366 if (mIsExpanded)
368
370
371 // The first time, we always update the size. Otherwise, we set
372 // a target size, and the actual size changes during a timer
373 // event.
374
375 if (mFirstTime) {
376 mFirstTime = false;
377 mCurrentDrawerSize = wxSize(mExtraSize.x, 0);
378 mCurrentTotalSize = baseWindowSize;
379
380 SetMinSize(mCurrentTotalSize);
381 SetMaxSize(mCurrentTotalSize);
382 SetSize(mCurrentTotalSize);
383 }
384
385 // wxTimers seem to be a little unreliable - sometimes they stop for
386 // no good reason, so this "primes" it every now and then...
387 mTimer.Stop();
389}

References kMyTimerInterval, mButtonSize, mCurrentDrawerSize, mCurrentTotalSize, mExtraSize, mFirstTime, mGrabberSize, mIsAutoExpanded, mIsExpanded, mIsManualExpanded, mMainSize, mTargetDrawerSize, and mTimer.

Referenced by Collapse(), Expand(), TryAutoCollapse(), and TryAutoExpand().

Here is the caller graph for this function:

◆ GetAutoExpand()

bool ExpandingToolBar::GetAutoExpand ( )
inline

Definition at line 60 of file ExpandingToolBar.h.

60{ return mAutoExpand; }

References mAutoExpand.

◆ GetExtraPanel()

wxPanel * ExpandingToolBar::GetExtraPanel ( )
inline

Definition at line 57 of file ExpandingToolBar.h.

57{ return mExtraPanel; }

References mExtraPanel.

◆ GetMainPanel()

wxPanel * ExpandingToolBar::GetMainPanel ( )
inline

Definition at line 56 of file ExpandingToolBar.h.

56{ return mMainPanel; }

References mMainPanel.

◆ GetToolbarBitmap()

wxBitmap ExpandingToolBar::GetToolbarBitmap ( )
protected

Definition at line 493 of file ExpandingToolBar.cpp.

494{
495 wxSize size = GetClientSize();
496 wxBitmap bitmap(size.x, size.y);
497 wxClientDC winDC(this);
498 wxMemoryDC memDC;
499 memDC.SelectObject(bitmap);
500 memDC.Blit(0, 0, size.x, size.y,
501 &winDC, 0, 0);
502 return bitmap;
503}

References size.

Referenced by StartMoving().

Here is the caller graph for this function:

◆ IsCursorInWindow()

bool ExpandingToolBar::IsCursorInWindow ( )
protected

Definition at line 391 of file ExpandingToolBar.cpp.

392{
393 wxPoint globalMouse = ::wxGetMousePosition();
394 wxPoint localMouse = ScreenToClient(globalMouse);
395
396 bool result = (localMouse.x >= 0 && localMouse.y >= 0 &&
397 localMouse.x < mCurrentTotalSize.x &&
398 localMouse.y < mCurrentTotalSize.y);
399
400 // The grabber doesn't count!
401 if (mGrabber && mGrabber->GetRect().Contains(localMouse))
402 result = false;
403
404 return result;
405}

References mCurrentTotalSize, and mGrabber.

Referenced by OnTimer().

Here is the caller graph for this function:

◆ IsExpanded()

bool ExpandingToolBar::IsExpanded ( )
inline

Definition at line 65 of file ExpandingToolBar.h.

65{ return mIsExpanded; }

References mIsExpanded.

◆ Layout()

bool ExpandingToolBar::Layout ( )
override

Definition at line 321 of file ExpandingToolBar.cpp.

322{
323 mMainSize = mMainPanel->GetBestSize();
324 mExtraSize = mExtraPanel->GetBestSize();
325 mButtonSize = wxSize(wxMax(mMainSize.x, mExtraSize.x),
327
328 int left = 0;
329
330 if (mGrabber) {
331 mGrabberSize = mGrabber->GetMinSize();
332 left += mGrabberSize.x;
333 }
334 else
335 mGrabberSize = wxSize(0, 0);
336
337 mMainPanel->SetSize(left, 0, mMainSize.x, mMainSize.y);
338 mToggleButton->SetSize(left, mMainSize.y, mButtonSize.x, mButtonSize.y);
339 mExtraPanel->SetSize(left, mMainSize.y + mButtonSize.y,
341
342 if (mGrabber)
343 mGrabber->SetSize(0, 0, left, mMainSize.y + mButtonSize.y);
344
345 // Add event handlers to all children
346 //RecursivelyPushEventHandlers(this);
347
348 return true;
349}
const int kToggleButtonHeight

References kToggleButtonHeight, mButtonSize, mExtraPanel, mExtraSize, mGrabber, mGrabberSize, mMainPanel, mMainSize, and mToggleButton.

◆ MoveDrawer()

void ExpandingToolBar::MoveDrawer ( wxSize  prevSize)
protected

Definition at line 425 of file ExpandingToolBar.cpp.

426{
428 mMainSize.y +
429 mButtonSize.y +
431
432 if (mFrameParent) {
433 // If we're in a tool window
434
435 SetMinSize(mCurrentTotalSize);
436 SetMaxSize(mCurrentTotalSize);
437 SetSize(mCurrentTotalSize);
438
439 GetParent()->Fit();
440 }
441
442 if (mDialogParent) {
443 // If we're in a dialog
444
445 SetMinSize(mCurrentTotalSize);
446 SetMaxSize(mCurrentTotalSize);
447 SetSize(mCurrentTotalSize);
448
449 GetParent()->Fit();
450 }
451
452 if (mAreaParent) {
453 // If we're in a tool area
454
455 if (mCurrentDrawerSize.y > 0 && prevSize.y == 0) {
457 mExtraPanel->Show();
458 }
459
460 mExtraPanel->SetMinSize(mCurrentDrawerSize);
461 mExtraPanel->SetMaxSize(mCurrentDrawerSize);
463
464 if (mCurrentDrawerSize.y == 0)
465 mExtraPanel->Hide();
466 }
467}

References mAreaParent, mButtonSize, mCurrentDrawerSize, mCurrentTotalSize, mDialogParent, mExtraPanel, mFrameParent, mMainSize, and ReparentExtraPanel().

Referenced by Collapse(), and OnTimer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSize()

void ExpandingToolBar::OnSize ( wxSizeEvent &  evt)

Definition at line 168 of file ExpandingToolBar.cpp.

169{
171 return;
172
173 // At the time of construction, it wasn't "safe" to tell
174 // our parent that we've just joined the window, so we check
175 // for it during our first OnSize event.
176
177 if (!mFrameParent) {
178 ToolBarFrame *toolBarParent =
179 dynamic_cast<ToolBarFrame *>(GetParent());
180 if (toolBarParent) {
181 // We were placed into a floating window
182 mFrameParent = toolBarParent;
183 toolBarParent->SetChild(this);
184 }
185 }
186
187 if (!mDialogParent) {
188 ToolBarDialog *toolBarParent =
189 dynamic_cast<ToolBarDialog *>(GetParent());
190 if (toolBarParent) {
191 // We were placed into a dialog
192 mDialogParent = toolBarParent;
193 toolBarParent->SetChild(this);
194 }
195 }
196
197 if (!mAreaParent) {
198 ToolBarArea *toolBarParent =
199 dynamic_cast<ToolBarArea *>(GetParent());
200 if (toolBarParent) {
201 // We were placed into an area full of other toolbars
202 mAreaParent = toolBarParent;
203 toolBarParent->AddChild(this);
204 }
205 }
206}
void AddChild(ExpandingToolBar *child)
A dialog based container for ExpandingToolBars providing modal based operations.
void SetChild(ExpandingToolBar *child)
A miniframe based container for ExpandingToolBars providing modeless presentation.
void SetChild(ExpandingToolBar *child)

References ToolBarArea::AddChild(), mAreaParent, mDialogParent, mFrameParent, ToolBarDialog::SetChild(), and ToolBarFrame::SetChild().

Here is the call graph for this function:

◆ OnTimer()

void ExpandingToolBar::OnTimer ( wxTimerEvent &  evt)

Definition at line 469 of file ExpandingToolBar.cpp.

470{
474 else if (!IsCursorInWindow())
476
478 return;
479
480 // This accelerates the current size towards the target size;
481 // it's a neat way for the window to roll open, but in such a
482 // way that it
483
484 wxSize prevSize = mCurrentDrawerSize;
486 if (abs((mCurrentDrawerSize-mTargetDrawerSize).x)<2 &&
489
490 MoveDrawer(prevSize);
491}

References IsCursorInWindow(), mAutoExpand, mCurrentDrawerSize, MoveDrawer(), msNoAutoExpandStack, mTargetDrawerSize, TryAutoCollapse(), and TryAutoExpand().

Here is the call graph for this function:

◆ OnToggle()

void ExpandingToolBar::OnToggle ( wxCommandEvent &  evt)

Definition at line 208 of file ExpandingToolBar.cpp.

209{
210 if (mIsExpanded)
211 Collapse();
212 else
213 Expand();
214}
void Collapse(bool now=false)

References Collapse(), Expand(), and mIsExpanded.

Here is the call graph for this function:

◆ RecursivelyPushEventHandlers()

void ExpandingToolBar::RecursivelyPushEventHandlers ( wxWindow *  win)
protected

Definition at line 308 of file ExpandingToolBar.cpp.

309{
310 if (!mWindowHash[win]) {
311 mHandlers.push_back(std::make_unique<ExpandingToolBarEvtHandler>
312 (this, win, win->GetEventHandler()));
313 mWindowHash[win] = 1;
314 }
315
316 wxWindowList children = win->GetChildren();
317 for(auto child : children)
319}
void RecursivelyPushEventHandlers(wxWindow *win)
WindowHash mWindowHash
std::vector< std::unique_ptr< ExpandingToolBarEvtHandler > > mHandlers

References mHandlers, mWindowHash, and RecursivelyPushEventHandlers().

Referenced by RecursivelyPushEventHandlers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReparentExtraPanel()

void ExpandingToolBar::ReparentExtraPanel ( )
protected

Definition at line 407 of file ExpandingToolBar.cpp.

408{
409 // This is how we make sure the extra panel, which slides out
410 // like a drawer, appears on top of everything else in the window...
411
412 wxPoint pos;
413 pos.x = mGrabberSize.x;
414 pos.y = mMainSize.y + mButtonSize.y;
415 wxWindow *frame = this;
416 while(!frame->IsTopLevel()) {
417 pos += frame->GetPosition();
418 frame = frame->GetParent();
419 }
420
421 mExtraPanel->Reparent(frame);
422 mExtraPanel->SetPosition(pos);
423}

References mButtonSize, mExtraPanel, mGrabberSize, and mMainSize.

Referenced by MoveDrawer().

Here is the caller graph for this function:

◆ SetAutoExpand()

void ExpandingToolBar::SetAutoExpand ( bool  enabled)
inline

Definition at line 59 of file ExpandingToolBar.h.

59{ mAutoExpand = enabled; }

References mAutoExpand.

◆ StartMoving()

void ExpandingToolBar::StartMoving ( )

Definition at line 505 of file ExpandingToolBar.cpp.

506{
507 if (!mAreaParent)
508 return;
509
510 int j;
511
513
514 mTimer.Stop();
515
516 // This gives time for wx to finish redrawing the window that way.
517 // HACK: why do we need to do it so many times???
518 for(j=0; j<500; j++)
519 ::wxSafeYield();
520
521 wxBitmap toolbarBitmap = GetToolbarBitmap();
522
526
527 mAreaParent->Refresh(true);
528
529 mTopLevelParent = this;
530 while(!mTopLevelParent->IsTopLevel())
531 mTopLevelParent = mTopLevelParent->GetParent();
532
533 wxPoint hotSpot = ScreenToClient(wxGetMousePosition());
534
535 hotSpot -= (ClientToScreen(wxPoint(0, 0)) -
536 mAreaParent->ClientToScreen(wxPoint(0, 0)));
537
540
541 wxColour magicColor = wxColour(0, 255, 255);
542// wxImage tgtImage = theTheme.Image(bmpToolBarTarget);
543// ImageRoll tgtImageRoll = ImageRoll(ImageRoll::VerticalRoll,
544// tgtImage,
545// magicColor);
546 mTargetPanel = safenew wxPanelWrapper(mAreaParent, -1, //tgtImageRoll,
547 wxDefaultPosition,
548 wxDefaultSize,
549 wxTRANSPARENT_WINDOW);
550 mTargetPanel->SetSize(mDropTarget);
551
552 // This gives time for wx to finish redrawing the window that way.
553 // HACK: why do we need to do it several times???
554 for(j=0; j<500; j++)
555 ::wxSafeYield();
556
558
559 mDragImage = std::make_unique<wxDragImage>(toolbarBitmap);
560 mDragImage->BeginDrag(hotSpot, mAreaParent, mTopLevelParent);
561 mDragImage->Show();
562 mDragImage->Move(ScreenToClient(wxGetMousePosition()));
563}
std::vector< wxRect > mDropTargets
wxBitmap GetToolbarBitmap()
std::unique_ptr< ToolBarArrangement > SaveArrangement()
std::vector< wxRect > GetDropTargets()
void RemoveChild(ExpandingToolBar *child)

References ToolBarArea::CollapseAll(), ToolBarArea::GetDropTargets(), GetToolbarBitmap(), kDummyRect, mAreaParent, mDragImage, mDropTarget, mDropTargets, mSavedArrangement, msNoAutoExpandStack, mTargetPanel, mTimer, mTopLevelParent, ToolBarArea::RemoveChild(), safenew, ToolBarArea::SaveArrangement(), ToolBarArea::SetCapturedChild(), and wxPanelWrapper::wxPanelWrapper().

Referenced by ToolBarGrabber::OnMouse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TryAutoCollapse()

void ExpandingToolBar::TryAutoCollapse ( )
protected

Definition at line 260 of file ExpandingToolBar.cpp.

261{
262#ifdef EXPERIMENTAL_ROLL_UP_DIALOG
263 if (mIsAutoExpanded == true && mIsManualExpanded == false) {
265 mIsAutoExpanded = false;
266 Fit();
267 }
268#endif
269}

References Fit(), mIsAutoExpanded, mIsManualExpanded, mToggleButton, and AButton::PopUp().

Referenced by OnTimer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TryAutoExpand()

void ExpandingToolBar::TryAutoExpand ( )
protected

Definition at line 250 of file ExpandingToolBar.cpp.

251{
253 mIsManualExpanded == false && mIsAutoExpanded == false) {
255 mIsAutoExpanded = true;
256 Fit();
257 }
258}

References Fit(), mAutoExpand, mIsAutoExpanded, mIsManualExpanded, msNoAutoExpandStack, mToggleButton, and AButton::PushDown().

Referenced by OnTimer(), and ExpandingToolBarEvtHandler::ProcessEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateMoving()

void ExpandingToolBar::UpdateMoving ( )

Definition at line 565 of file ExpandingToolBar.cpp.

566{
568 return;
569
570 wxPoint cursorPos = mAreaParent->ScreenToClient(wxGetMousePosition());
571 wxRect prevTarget = mDropTarget;
572 int best_dist_sq = 99999;
573 int i;
574
575 for(i = 0; i < (int)mDropTargets.size(); i++) {
576 int x = (mDropTargets[i].x + (mDropTargets[i].width/2))-cursorPos.x;
577 int y = (mDropTargets[i].y + (mDropTargets[i].height/2))-cursorPos.y;
578 int dist_sq = (x*x) + (y*y);
579
580 if (dist_sq < best_dist_sq) {
581 best_dist_sq = dist_sq;
583 }
584 }
585
586 if (!mAreaParent->GetRect().Contains(cursorPos))
588
589 if (mDropTarget != prevTarget) {
590 mDragImage->Hide();
591
592 wxRect r = mDropTarget;
593 r.Inflate(4, 4);
594 mTargetPanel->SetSize(r);
595
596 #if 0
597 wxClientDC dc(mAreaParent);
598 dc.DestroyClippingRegion();
599 dc.SetLogicalFunction(wxINVERT);
600 wxRect r = prevTarget;
601 r.Inflate(4, 4);
602 dc.DrawRectangle(r);
603 r = mDropTarget;
604 r.Inflate(4, 4);
605 dc.DrawRectangle(r);
606 #endif
607
608 // This gives time for wx to finish redrawing the window that way.
609 // HACK: why do we need to do it so many times???
610 for(i=0; i<500; i++)
611 ::wxSafeYield();
612
613 mDragImage->Show();
614 mDragImage->Move(ScreenToClient(wxGetMousePosition()));
615 }
616 else
617 mDragImage->Move(ScreenToClient(wxGetMousePosition()));
618}

References kDummyRect, mAreaParent, mDragImage, mDropTarget, mDropTargets, mSavedArrangement, and mTargetPanel.

Referenced by ToolBarArea::OnMouse().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ExpandingToolBarEvtHandler

friend class ExpandingToolBarEvtHandler
friend

Definition at line 120 of file ExpandingToolBar.h.

Member Data Documentation

◆ mAreaParent

ToolBarArea* ExpandingToolBar::mAreaParent
protected

Definition at line 108 of file ExpandingToolBar.h.

Referenced by FinishMoving(), MoveDrawer(), OnSize(), StartMoving(), and UpdateMoving().

◆ mAutoExpand

bool ExpandingToolBar::mAutoExpand
protected

Definition at line 95 of file ExpandingToolBar.h.

Referenced by GetAutoExpand(), OnTimer(), SetAutoExpand(), and TryAutoExpand().

◆ mButtonSize

wxSize ExpandingToolBar::mButtonSize
protected

Definition at line 99 of file ExpandingToolBar.h.

Referenced by Fit(), Layout(), MoveDrawer(), and ReparentExtraPanel().

◆ mCurrentDrawerSize

wxSize ExpandingToolBar::mCurrentDrawerSize
protected

Definition at line 101 of file ExpandingToolBar.h.

Referenced by Collapse(), Fit(), MoveDrawer(), and OnTimer().

◆ mCurrentTotalSize

wxSize ExpandingToolBar::mCurrentTotalSize
protected

Definition at line 103 of file ExpandingToolBar.h.

Referenced by Fit(), IsCursorInWindow(), and MoveDrawer().

◆ mDialogParent

ToolBarDialog* ExpandingToolBar::mDialogParent
protected

Definition at line 107 of file ExpandingToolBar.h.

Referenced by MoveDrawer(), and OnSize().

◆ mDragImage

std::unique_ptr<wxDragImage> ExpandingToolBar::mDragImage
protected

Definition at line 111 of file ExpandingToolBar.h.

Referenced by FinishMoving(), StartMoving(), and UpdateMoving().

◆ mDropTarget

wxRect ExpandingToolBar::mDropTarget
protected

Definition at line 114 of file ExpandingToolBar.h.

Referenced by FinishMoving(), StartMoving(), and UpdateMoving().

◆ mDropTargets

std::vector<wxRect> ExpandingToolBar::mDropTargets
protected

Definition at line 113 of file ExpandingToolBar.h.

Referenced by StartMoving(), and UpdateMoving().

◆ mExtraPanel

wxPanel* ExpandingToolBar::mExtraPanel
protected

Definition at line 89 of file ExpandingToolBar.h.

Referenced by GetExtraPanel(), Layout(), MoveDrawer(), and ReparentExtraPanel().

◆ mExtraSize

wxSize ExpandingToolBar::mExtraSize
protected

Definition at line 98 of file ExpandingToolBar.h.

Referenced by Fit(), and Layout().

◆ mFirstTime

bool ExpandingToolBar::mFirstTime
protected

Definition at line 96 of file ExpandingToolBar.h.

Referenced by Fit().

◆ mFrameParent

ToolBarFrame* ExpandingToolBar::mFrameParent
protected

Definition at line 106 of file ExpandingToolBar.h.

Referenced by MoveDrawer(), and OnSize().

◆ mGrabber

ToolBarGrabber* ExpandingToolBar::mGrabber
protected

Definition at line 90 of file ExpandingToolBar.h.

Referenced by IsCursorInWindow(), and Layout().

◆ mGrabberSize

wxSize ExpandingToolBar::mGrabberSize
protected

Definition at line 100 of file ExpandingToolBar.h.

Referenced by Fit(), Layout(), and ReparentExtraPanel().

◆ mHandlers

std::vector< std::unique_ptr< ExpandingToolBarEvtHandler > > ExpandingToolBar::mHandlers
protected

Definition at line 121 of file ExpandingToolBar.h.

Referenced by RecursivelyPushEventHandlers().

◆ mIsAutoExpanded

bool ExpandingToolBar::mIsAutoExpanded
protected

Definition at line 92 of file ExpandingToolBar.h.

Referenced by Collapse(), Expand(), Fit(), TryAutoCollapse(), and TryAutoExpand().

◆ mIsExpanded

bool ExpandingToolBar::mIsExpanded
protected

Definition at line 94 of file ExpandingToolBar.h.

Referenced by Fit(), IsExpanded(), and OnToggle().

◆ mIsManualExpanded

bool ExpandingToolBar::mIsManualExpanded
protected

Definition at line 93 of file ExpandingToolBar.h.

Referenced by Collapse(), Expand(), Fit(), TryAutoCollapse(), and TryAutoExpand().

◆ mMainPanel

wxPanel* ExpandingToolBar::mMainPanel
protected

Definition at line 88 of file ExpandingToolBar.h.

Referenced by GetMainPanel(), and Layout().

◆ mMainSize

wxSize ExpandingToolBar::mMainSize
protected

Definition at line 97 of file ExpandingToolBar.h.

Referenced by Fit(), Layout(), MoveDrawer(), and ReparentExtraPanel().

◆ mSavedArrangement

std::unique_ptr<ToolBarArrangement> ExpandingToolBar::mSavedArrangement
protected

Definition at line 109 of file ExpandingToolBar.h.

Referenced by FinishMoving(), StartMoving(), and UpdateMoving().

◆ msNoAutoExpandStack

int ExpandingToolBar::msNoAutoExpandStack = 0
staticprotected

Definition at line 116 of file ExpandingToolBar.h.

Referenced by FinishMoving(), OnTimer(), StartMoving(), and TryAutoExpand().

◆ mTargetDrawerSize

wxSize ExpandingToolBar::mTargetDrawerSize
protected

Definition at line 102 of file ExpandingToolBar.h.

Referenced by Collapse(), Fit(), and OnTimer().

◆ mTargetPanel

wxPanel* ExpandingToolBar::mTargetPanel
protected

Definition at line 110 of file ExpandingToolBar.h.

Referenced by StartMoving(), and UpdateMoving().

◆ mTimer

wxTimer ExpandingToolBar::mTimer
protected

Definition at line 105 of file ExpandingToolBar.h.

Referenced by FinishMoving(), Fit(), and StartMoving().

◆ mToggleButton

AButton* ExpandingToolBar::mToggleButton
protected

Definition at line 91 of file ExpandingToolBar.h.

Referenced by Collapse(), Expand(), Layout(), TryAutoCollapse(), and TryAutoExpand().

◆ mTopLevelParent

wxWindow* ExpandingToolBar::mTopLevelParent
protected

Definition at line 112 of file ExpandingToolBar.h.

Referenced by FinishMoving(), and StartMoving().

◆ mWindowHash

WindowHash ExpandingToolBar::mWindowHash
protected

Definition at line 104 of file ExpandingToolBar.h.

Referenced by RecursivelyPushEventHandlers().


The documentation for this class was generated from the following files: