Audacity 3.2.0
Public Types | Public Member Functions | Public Attributes | List of all members
BrowserDialog Class Reference

Adds some event handling to an HtmlWindow. More...

#include <HelpSystem.h>

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

Public Types

enum  { ID = 0 }
 

Public Member Functions

 BrowserDialog (wxWindow *pParent, const TranslatableString &title)
 
void OnForward (wxCommandEvent &event)
 
void OnBackward (wxCommandEvent &event)
 
void OnClose (wxCommandEvent &event)
 
void OnKeyDown (wxKeyEvent &event)
 
void UpdateButtons ()
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Public Attributes

HtmlWindowmpHtml
 
bool mDismissed {}
 

Detailed Description

Adds some event handling to an HtmlWindow.

Definition at line 139 of file HelpSystem.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ID 

Definition at line 142 of file HelpSystem.h.

142{ ID = 0 };

Constructor & Destructor Documentation

◆ BrowserDialog()

BrowserDialog::BrowserDialog ( wxWindow *  pParent,
const TranslatableString title 
)

Definition at line 428 of file HelpSystem.cpp.

429 : wxDialogWrapper{ pParent, ID, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER /*| wxMAXIMIZE_BOX */ }
430{
431 int width, height;
432 const int minWidth = 400;
433 const int minHeight = 250;
434
435 gPrefs->Read(wxT("/GUI/BrowserWidth"), &width, minWidth);
436 gPrefs->Read(wxT("/GUI/BrowserHeight"), &height, minHeight);
437
438 if (width < minWidth || width > wxSystemSettings::GetMetric(wxSYS_SCREEN_X))
439 width = minWidth;
440 if (height < minHeight || height > wxSystemSettings::GetMetric(wxSYS_SCREEN_Y))
441 height = minHeight;
442
443 SetMinSize(wxSize(minWidth, minHeight));
444 SetSize(wxDefaultPosition.x, wxDefaultPosition.y, width, height, wxSIZE_AUTO);
445}
wxT("CloseDown"))
static const auto title
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
virtual bool Read(const wxString &key, bool *value) const =0

References title.

Member Function Documentation

◆ OnBackward()

void BrowserDialog::OnBackward ( wxCommandEvent &  event)

Definition at line 453 of file HelpSystem.cpp.

454{
455 mpHtml->HistoryBack();
457}
void UpdateButtons()
Definition: HelpSystem.cpp:497
HtmlWindow * mpHtml
Definition: HelpSystem.h:154

References mpHtml, and UpdateButtons().

Here is the call graph for this function:

◆ OnClose()

void BrowserDialog::OnClose ( wxCommandEvent &  event)

Definition at line 459 of file HelpSystem.cpp.

460{
461 if (IsModal() && !mDismissed)
462 {
463 mDismissed = true;
464 EndModal(wxID_CANCEL);
465 }
466 auto parent = GetParent();
467
468 gPrefs->Write(wxT("/GUI/BrowserWidth"), GetSize().GetX());
469 gPrefs->Write(wxT("/GUI/BrowserHeight"), GetSize().GetY());
470 gPrefs->Flush();
471
472#ifdef __WXMAC__
473 auto grandparent = GetParent()->GetParent();
474#endif
475
476 parent->Destroy();
477
478#ifdef __WXMAC__
479 if(grandparent && grandparent->IsShown()) {
480 grandparent->Raise();
481 }
482#endif
483}
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0

References audacity::BasicSettings::Flush(), gPrefs, mDismissed, audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnForward()

void BrowserDialog::OnForward ( wxCommandEvent &  event)

Definition at line 447 of file HelpSystem.cpp.

448{
449 mpHtml->HistoryForward();
451}

References mpHtml, and UpdateButtons().

Here is the call graph for this function:

◆ OnKeyDown()

void BrowserDialog::OnKeyDown ( wxKeyEvent &  event)

Definition at line 485 of file HelpSystem.cpp.

486{
487 bool bSkip = true;
488 if (event.GetKeyCode() == WXK_ESCAPE)
489 {
490 bSkip = false;
491 Close(false);
492 }
493 event.Skip(bSkip);
494}

◆ UpdateButtons()

void BrowserDialog::UpdateButtons ( )

Definition at line 497 of file HelpSystem.cpp.

498{
499 wxWindow * pWnd;
500 if( (pWnd = FindWindowById( wxID_BACKWARD, this )) != NULL )
501 {
502 pWnd->Enable(mpHtml->HistoryCanBack());
503 }
504 if( (pWnd = FindWindowById( wxID_FORWARD, this )) != NULL )
505 {
506 pWnd->Enable(mpHtml->HistoryCanForward());
507 }
508}

References mpHtml.

Referenced by OnBackward(), OnForward(), and LinkingHtmlWindow::OnLinkClicked().

Here is the caller graph for this function:

Member Data Documentation

◆ mDismissed

bool BrowserDialog::mDismissed {}

Definition at line 155 of file HelpSystem.h.

Referenced by OnClose().

◆ mpHtml

HtmlWindow* BrowserDialog::mpHtml

Definition at line 154 of file HelpSystem.h.

Referenced by OnBackward(), OnForward(), HelpSystem::ShowHtmlText(), and UpdateButtons().


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