OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Tabbook Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Tabbook.hpp>

Inheritance diagram for Tabbook:
Collaboration diagram for Tabbook:

Public Member Functions

 Tabbook (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, wxBoxSizer *side_tools=NULL, long style=0)
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, wxBoxSizer *side_tools=NULL, long style=0)
bool ShowNewPage (wxWindow *page)
void SetEffects (wxShowEffect showEffect, wxShowEffect hideEffect)
void SetEffect (wxShowEffect effect)
void SetEffectsTimeouts (unsigned showTimeout, unsigned hideTimeout)
void SetEffectTimeout (unsigned timeout)
bool AddPage (wxWindow *page, const wxString &text, bool bSelect=false, int imageId=NO_IMAGE) override
virtual bool InsertPage (size_t n, wxWindow *page, const wxString &text, bool bSelect=false, int imageId=NO_IMAGE) override
bool RemovePage (size_t n) override
virtual int SetSelection (size_t n) override
virtual int ChangeSelection (size_t n) override
virtual bool SetPageText (size_t n, const wxString &strText) override
virtual wxString GetPageText (size_t n) const override
virtual bool SetPageImage (size_t WXUNUSED(n), int WXUNUSED(imageId)) override
virtual int GetPageImage (size_t WXUNUSED(n)) const override
bool SetPageImage (size_t n, const std::string &bmp_name)
virtual void SetFocus () override
TabButtonsListCtrl * GetBtnsListCtrl () const
void Rescale ()
void SetFooterText (const wxString &text)
void OnNavigationKey (wxNavigationKeyEvent &event)

Protected Member Functions

virtual void UpdateSelectedPage (size_t WXUNUSED(newsel)) override
virtual wxBookCtrlEvent * CreatePageChangingEvent () const override
virtual void MakeChangedEvent (wxBookCtrlEvent &event) override
virtual wxWindow * DoRemovePage (size_t page) override
virtual void DoSize () override
virtual void DoShowPage (wxWindow *page, bool show) override

Private Member Functions

void Init ()

Private Attributes

wxShowEffect m_showEffect
wxShowEffect m_hideEffect
unsigned m_showTimeout
unsigned m_hideTimeout

Detailed Description

Constructor & Destructor Documentation

◆ Tabbook()

Tabbook::Tabbook ( wxWindow * parent,
wxWindowID winid = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
wxBoxSizer * side_tools = NULL,
long style = 0 )
inline
74 {
75 Init();
76 Create(parent, winid, pos, size, side_tools, style);
77 }
#define style
Definition WipeTowerDialog.cpp:101
void Init()
Definition Tabbook.hpp:397
bool Create(wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, wxBoxSizer *side_tools=NULL, long style=0)
Definition Tabbook.hpp:79

References Create(), Init(), and style.

Here is the call graph for this function:

Member Function Documentation

◆ AddPage()

bool Tabbook::AddPage ( wxWindow * page,
const wxString & text,
bool bSelect = false,
int imageId = NO_IMAGE )
inlineoverride
160 {
161 DoInvalidateBestSize();
162 return InsertPage(GetPageCount(), page, text, bSelect, imageId);
163 }
virtual bool InsertPage(size_t n, wxWindow *page, const wxString &text, bool bSelect=false, int imageId=NO_IMAGE) override
Definition Tabbook.hpp:166

References InsertPage().

Referenced by ShowNewPage().

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

◆ ChangeSelection()

virtual int Tabbook::ChangeSelection ( size_t n)
inlineoverridevirtual
210 {
212 return DoSetSelection(n);
213 }
void SetSelection(int sel)
Definition Tabbook.cpp:111
TabButtonsListCtrl * GetBtnsListCtrl() const
Definition Tabbook.hpp:255

References GetBtnsListCtrl(), and TabButtonsListCtrl::SetSelection().

Referenced by Slic3r::GUI::Plater::print_job_finished().

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

◆ Create()

bool Tabbook::Create ( wxWindow * parent,
wxWindowID winid = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
wxBoxSizer * side_tools = NULL,
long style = 0 )
inline
86 {
87 if (!wxBookCtrlBase::Create(parent, winid, pos, size, style))
88 return false;
89
90 m_bookctrl = new TabButtonsListCtrl(this, side_tools);
91
92 wxSizer* mainSizer = new wxBoxSizer(IsVertical() ? wxVERTICAL : wxHORIZONTAL);
93
94 if (style & wxBK_RIGHT || style & wxBK_BOTTOM)
95 mainSizer->Add(0, 0, 1, wxEXPAND, 0);
96
97 m_controlSizer = new wxBoxSizer(IsVertical() ? wxHORIZONTAL : wxVERTICAL);
98 m_controlSizer->Add(m_bookctrl, wxSizerFlags(0).Expand());
99 wxSizerFlags flags;
100 if (IsVertical())
101 flags.Expand();
102 else
103 flags.Expand();
104 mainSizer->Add(m_controlSizer, flags.Border(wxALL, m_controlMargin));
105 SetSizer(mainSizer);
106
107 this->Bind(wxCUSTOMEVT_TABBOOK_SEL_CHANGED, [this](wxCommandEvent& evt)
108 {
109 if (int page_idx = evt.GetId(); page_idx >= 0)
110 SetSelection(page_idx);
111 });
112
113 this->Bind(wxEVT_NAVIGATION_KEY, &Tabbook::OnNavigationKey, this);
114
115 return true;
116 }
void OnNavigationKey(wxNavigationKeyEvent &event)
Definition Tabbook.hpp:267
virtual int SetSelection(size_t n) override
Definition Tabbook.hpp:192

References OnNavigationKey(), SetSelection(), and style.

Referenced by Tabbook().

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

◆ CreatePageChangingEvent()

virtual wxBookCtrlEvent * Tabbook::CreatePageChangingEvent ( ) const
inlineoverrideprotectedvirtual
359 {
360 return new wxBookCtrlEvent(wxEVT_BOOKCTRL_PAGE_CHANGING,
361 GetId());
362 }

◆ DoRemovePage()

virtual wxWindow * Tabbook::DoRemovePage ( size_t page)
inlineoverrideprotectedvirtual
370 {
371 wxWindow* const win = wxBookCtrlBase::DoRemovePage(page);
372 if (win)
373 {
375 DoSetSelectionAfterRemoval(page);
376 }
377
378 return win;
379 }
void RemovePage(size_t n)
Definition Tabbook.cpp:163

References GetBtnsListCtrl(), and TabButtonsListCtrl::RemovePage().

Here is the call graph for this function:

◆ DoShowPage()

virtual void Tabbook::DoShowPage ( wxWindow * page,
bool show )
inlineoverrideprotectedvirtual
389 {
390 if (show)
391 page->ShowWithEffect(m_showEffect, m_showTimeout);
392 else
393 page->HideWithEffect(m_hideEffect, m_hideTimeout);
394 }
wxShowEffect m_hideEffect
Definition Tabbook.hpp:412
unsigned m_showTimeout
Definition Tabbook.hpp:414
wxShowEffect m_showEffect
Definition Tabbook.hpp:411
unsigned m_hideTimeout
Definition Tabbook.hpp:415

References m_hideEffect, m_hideTimeout, m_showEffect, and m_showTimeout.

◆ DoSize()

virtual void Tabbook::DoSize ( )
inlineoverrideprotectedvirtual
382 {
383 wxWindow* const page = GetCurrentPage();
384 if (page)
385 page->SetSize(GetPageRect());
386 }

◆ GetBtnsListCtrl()

TabButtonsListCtrl * Tabbook::GetBtnsListCtrl ( ) const
inline
255{ return static_cast<TabButtonsListCtrl *>(m_bookctrl); }

Referenced by ChangeSelection(), DoRemovePage(), GetPageText(), InsertPage(), Rescale(), SetFooterText(), SetPageImage(), SetPageText(), and SetSelection().

Here is the caller graph for this function:

◆ GetPageImage()

virtual int Tabbook::GetPageImage ( size_t WXUNUSEDn) const
inlineoverridevirtual
238 {
239 return NO_IMAGE;
240 }

◆ GetPageText()

virtual wxString Tabbook::GetPageText ( size_t n) const
inlineoverridevirtual
227 {
228 wxCHECK_MSG(n < GetPageCount(), wxString(), wxS("Invalid page"));
229 return GetBtnsListCtrl()->GetPageText(n);
230 }
wxString GetPageText(size_t n) const
Definition Tabbook.cpp:193

References GetBtnsListCtrl(), and TabButtonsListCtrl::GetPageText().

Here is the call graph for this function:

◆ Init()

void Tabbook::Init ( )
inlineprivate
398 {
399 // We don't need any border as we don't have anything to separate the
400 // page contents from.
401 SetInternalBorder(0);
402
403 // No effects by default.
405 m_hideEffect = wxSHOW_EFFECT_NONE;
406
408 m_hideTimeout = 0;
409 }

References m_hideEffect, m_hideTimeout, m_showEffect, and m_showTimeout.

Referenced by Tabbook().

Here is the caller graph for this function:

◆ InsertPage()

virtual bool Tabbook::InsertPage ( size_t n,
wxWindow * page,
const wxString & text,
bool bSelect = false,
int imageId = NO_IMAGE )
inlineoverridevirtual
171 {
172 if (!wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId))
173 return false;
174
175 GetBtnsListCtrl()->InsertPage(n, text, bSelect);
176
177 if (!DoSetSelectionAfterInsertion(n, bSelect))
178 page->Hide();
179
180 return true;
181 }
bool InsertPage(size_t n, const wxString &text, bool bSelect=false, const std::string &bmp_name="")
Definition Tabbook.cpp:136

References GetBtnsListCtrl(), and TabButtonsListCtrl::InsertPage().

Referenced by AddPage().

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

◆ MakeChangedEvent()

virtual void Tabbook::MakeChangedEvent ( wxBookCtrlEvent & event)
inlineoverrideprotectedvirtual
365 {
366 event.SetEventType(wxEVT_BOOKCTRL_PAGE_CHANGED);
367 }

◆ OnNavigationKey()

void Tabbook::OnNavigationKey ( wxNavigationKeyEvent & event)
inline
268 {
269 if (event.IsWindowChange()) {
270 // change pages
271 //AdvanceSelection(event.GetDirection());
272 this->GetGrandParent()->HandleWindowEvent(event);
273 }
274 else {
275 // we get this event in 3 cases
276 //
277 // a) one of our pages might have generated it because the user TABbed
278 // out from it in which case we should propagate the event upwards and
279 // our parent will take care of setting the focus to prev/next sibling
280 //
281 // or
282 //
283 // b) the parent panel wants to give the focus to us so that we
284 // forward it to our selected page. We can't deal with this in
285 // OnSetFocus() because we don't know which direction the focus came
286 // from in this case and so can't choose between setting the focus to
287 // first or last panel child
288 //
289 // or
290 //
291 // c) we ourselves (see MSWTranslateMessage) generated the event
292 //
293 wxWindow* const parent = GetParent();
294
295 // the wxObject* casts are required to avoid MinGW GCC 2.95.3 ICE
296 const bool isFromParent = event.GetEventObject() == (wxObject*)parent;
297 const bool isFromSelf = event.GetEventObject() == (wxObject*)this;
298 const bool isForward = event.GetDirection();
299
300 if (isFromSelf && !isForward)
301 {
302 // focus is currently on notebook tab and should leave
303 // it backwards (Shift-TAB)
304 event.SetCurrentFocus(this);
305 parent->HandleWindowEvent(event);
306 }
307 else if (isFromParent || isFromSelf)
308 {
309 // no, it doesn't come from child, case (b) or (c): forward to a
310 // page but only if entering notebook page (i.e. direction is
311 // backwards (Shift-TAB) comething from out-of-notebook, or
312 // direction is forward (TAB) from ourselves),
313 if (m_selection != wxNOT_FOUND &&
314 (!event.GetDirection() || isFromSelf))
315 {
316 // so that the page knows that the event comes from it's parent
317 // and is being propagated downwards
318 event.SetEventObject(this);
319
320 wxWindow* page = m_pages[m_selection];
321 if (!page->HandleWindowEvent(event))
322 {
323 page->SetFocus();
324 }
325 //else: page manages focus inside it itself
326 }
327 else // otherwise set the focus to the notebook itself
328 {
329 SetFocus();
330 }
331 }
332 else
333 {
334 // it comes from our child, case (a), pass to the parent, but only
335 // if the direction is forwards. Otherwise set the focus to the
336 // notebook itself. The notebook is always the 'first' control of a
337 // page.
338 if (!isForward)
339 {
340 SetFocus();
341 }
342 else if (parent)
343 {
344 event.SetCurrentFocus(this);
345 parent->HandleWindowEvent(event);
346 }
347 }
348 }
349 }
virtual void SetFocus() override
Definition Tabbook.hpp:248

References SetFocus().

Referenced by Create().

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

◆ RemovePage()

bool Tabbook::RemovePage ( size_t n)
inlineoverride
184 {
185 if (!wxBookCtrlBase::RemovePage(n))
186 return false;
187
188 SetSelection(0);
189 return true;
190 }

References SetSelection().

Here is the call graph for this function:

◆ Rescale()

void Tabbook::Rescale ( )
inline
258 {
260 }
void Rescale()
Definition Tabbook.cpp:97

References GetBtnsListCtrl(), and TabButtonsListCtrl::Rescale().

Here is the call graph for this function:

◆ SetEffect()

void Tabbook::SetEffect ( wxShowEffect effect)
inline
137 {
138 SetEffects(effect, effect);
139 }
void SetEffects(wxShowEffect showEffect, wxShowEffect hideEffect)
Definition Tabbook.hpp:129

References SetEffects().

Here is the call graph for this function:

◆ SetEffects()

void Tabbook::SetEffects ( wxShowEffect showEffect,
wxShowEffect hideEffect )
inline
130 {
131 m_showEffect = showEffect;
132 m_hideEffect = hideEffect;
133 }

References m_hideEffect, and m_showEffect.

Referenced by SetEffect().

Here is the caller graph for this function:

◆ SetEffectsTimeouts()

void Tabbook::SetEffectsTimeouts ( unsigned showTimeout,
unsigned hideTimeout )
inline
143 {
144 m_showTimeout = showTimeout;
145 m_hideTimeout = hideTimeout;
146 }

References m_hideTimeout, and m_showTimeout.

Referenced by SetEffectTimeout().

Here is the caller graph for this function:

◆ SetEffectTimeout()

void Tabbook::SetEffectTimeout ( unsigned timeout)
inline
149 {
150 SetEffectsTimeouts(timeout, timeout);
151 }
void SetEffectsTimeouts(unsigned showTimeout, unsigned hideTimeout)
Definition Tabbook.hpp:142

References SetEffectsTimeouts().

Here is the call graph for this function:

◆ SetFocus()

virtual void Tabbook::SetFocus ( )
inlineoverridevirtual
249 {
250 wxWindow* const page = GetCurrentPage();
251 if (page)
252 page->SetFocus();
253 }

Referenced by OnNavigationKey().

Here is the caller graph for this function:

◆ SetFooterText()

void Tabbook::SetFooterText ( const wxString & text)
inline
263 {
265 }
void SetFooterText(const wxString &text)
Definition Tabbook.cpp:209

References GetBtnsListCtrl(), and TabButtonsListCtrl::SetFooterText().

Here is the call graph for this function:

◆ SetPageImage() [1/2]

bool Tabbook::SetPageImage ( size_t n,
const std::string & bmp_name )
inline
243 {
244 return GetBtnsListCtrl()->SetPageImage(n, bmp_name);
245 }
bool SetPageImage(size_t n, const std::string &bmp_name)
Definition Tabbook.cpp:174

References GetBtnsListCtrl(), and TabButtonsListCtrl::SetPageImage().

Here is the call graph for this function:

◆ SetPageImage() [2/2]

virtual bool Tabbook::SetPageImage ( size_t WXUNUSEDn,
int WXUNUSEDimageId )
inlineoverridevirtual
233 {
234 return false;
235 }

◆ SetPageText()

virtual bool Tabbook::SetPageText ( size_t n,
const wxString & strText )
inlineoverridevirtual
218 {
219 wxCHECK_MSG(n < GetPageCount(), false, wxS("Invalid page"));
220
221 GetBtnsListCtrl()->SetPageText(n, strText);
222
223 return true;
224 }
void SetPageText(size_t n, const wxString &strText)
Definition Tabbook.cpp:187

References GetBtnsListCtrl(), and TabButtonsListCtrl::SetPageText().

Here is the call graph for this function:

◆ SetSelection()

virtual int Tabbook::SetSelection ( size_t n)
inlineoverridevirtual
193 {
195 int ret = DoSetSelection(n, SetSelection_SendEvent);
196
197 // check that only the selected page is visible and others are hidden:
198 for (size_t page = 0; page < m_pages.size(); page++) {
199 wxWindow* win_a = GetPage(page);
200 wxWindow* win_b = GetPage(n);
201 if (page != n && GetPage(page) != GetPage(n)) {
202 m_pages[page]->Hide();
203 }
204 }
205
206 return ret;
207 }

References GetBtnsListCtrl(), and TabButtonsListCtrl::SetSelection().

Referenced by Create(), and RemovePage().

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

◆ ShowNewPage()

bool Tabbook::ShowNewPage ( wxWindow * page)
inline
124 {
125 return AddPage(page, wxString());
126 }
bool AddPage(wxWindow *page, const wxString &text, bool bSelect=false, int imageId=NO_IMAGE) override
Definition Tabbook.hpp:156

References AddPage().

Here is the call graph for this function:

◆ UpdateSelectedPage()

virtual void Tabbook::UpdateSelectedPage ( size_t WXUNUSEDnewsel)
inlineoverrideprotectedvirtual
353 {
354 // Nothing to do here, but must be overridden to avoid the assert in
355 // the base class version.
356 }

Member Data Documentation

◆ m_hideEffect

wxShowEffect Tabbook::m_hideEffect
private

Referenced by DoShowPage(), Init(), and SetEffects().

◆ m_hideTimeout

unsigned Tabbook::m_hideTimeout
private

◆ m_showEffect

wxShowEffect Tabbook::m_showEffect
private

Referenced by DoShowPage(), Init(), and SetEffects().

◆ m_showTimeout

unsigned Tabbook::m_showTimeout
private

The documentation for this class was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Tabbook.hpp