Constructor
| 70 | // Constructor |
| 71 | // |
| 72 | ToolFrame::ToolFrame |
| 73 | ( AudacityProject *parent, ToolManager *manager, ToolBar *bar, wxPoint pos ) |
| 74 | : wxFrame( FindProjectFrame( parent ), |
| 75 | bar->GetId(), |
| 76 | wxEmptyString, |
| 77 | pos, |
| 78 | wxDefaultSize, |
| 79 | wxNO_BORDER | |
| 80 | wxFRAME_NO_TASKBAR | |
| 81 | #if !defined(__WXMAC__) // bug1358 |
| 82 | wxFRAME_TOOL_WINDOW | |
| 83 | #endif |
| 84 | wxFRAME_FLOAT_ON_PARENT ) |
| 85 | , mParent{ parent } |
| 86 | { |
| 87 | int width = bar->GetSize().x; |
| 88 | int border = 1; |
| 89 | |
| 90 | // Save parameters |
| 91 | mManager = manager; |
| 92 | mBar = bar; |
| 93 | |
| 94 | // Transfer the bar to the ferry |
| 95 | bar->Reparent(this); |
| 96 | |
| 97 | // Bug 2120 (comment 6 residual): No need to set a minimum size |
| 98 | // if the toolbar is not resizable. On GTK, setting a minimum |
| 99 | // size will prevent the frame from shrinking if the toolbar gets |
| 100 | // reconfigured and needs to resize smaller. |
| 101 | if (bar->IsResizable()) |
| 102 | { |
| 103 | SetMinSize(bar->GetDockedSize()); |
| 104 | } |
| 105 | |
| 106 | { |
| 107 | // We use a sizer to maintain proper spacing |
| 108 | auto s = std::make_unique<wxBoxSizer>(wxHORIZONTAL); |
| 109 | |
| 110 | // Add the bar to the sizer |
| 111 | s->Add(bar, 1, wxEXPAND | wxALL, border); |
| 112 | |
| 113 | // Add space for the resize grabber |
| 114 | if (bar->IsResizable()) |
| 115 | { |
| 116 | s->Add(sizerW, 1); |
| 117 | width += sizerW; |
| 118 | } |
| 119 | |
| 120 | SetSize(width + 2 * ToolBarFloatMargin, |
| 121 | bar->GetDockedSize().y + 2 * ToolBarFloatMargin); |
| 122 | |
| 123 | // Attach the sizer and resize the window to fit |
| 124 | SetSizer(s.release()); |
| 125 | } |
| 126 | |
| 127 | Layout(); |
| 128 | |
| 129 | // Inform toolbar of change |
nothing calls this directly
no test coverage detected