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 444 of file HelpSystem.cpp.

445 : wxDialogWrapper{ pParent, ID, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER /*| wxMAXIMIZE_BOX */ }
446{
447 int width, height;
448 const int minWidth = 400;
449 const int minHeight = 250;
450
451 gPrefs->Read(wxT("/GUI/BrowserWidth"), &width, minWidth);
452 gPrefs->Read(wxT("/GUI/BrowserHeight"), &height, minHeight);
453
454 if (width < minWidth || width > wxSystemSettings::GetMetric(wxSYS_SCREEN_X))
455 width = minWidth;
456 if (height < minHeight || height > wxSystemSettings::GetMetric(wxSYS_SCREEN_Y))
457 height = minHeight;
458
459 SetMinSize(wxSize(minWidth, minHeight));
460 SetSize(wxDefaultPosition.x, wxDefaultPosition.y, width, height, wxSIZE_AUTO);
461}
wxT("CloseDown"))
static const auto title
FileConfig * gPrefs
Definition: Prefs.cpp:70

References title.

Member Function Documentation

◆ OnBackward()

void BrowserDialog::OnBackward ( wxCommandEvent &  event)

Definition at line 469 of file HelpSystem.cpp.

470{
471 mpHtml->HistoryBack();
473}
void UpdateButtons()
Definition: HelpSystem.cpp:513
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 475 of file HelpSystem.cpp.

476{
477 if (IsModal() && !mDismissed)
478 {
479 mDismissed = true;
480 EndModal(wxID_CANCEL);
481 }
482 auto parent = GetParent();
483
484 gPrefs->Write(wxT("/GUI/BrowserWidth"), GetSize().GetX());
485 gPrefs->Write(wxT("/GUI/BrowserHeight"), GetSize().GetY());
486 gPrefs->Flush();
487
488#ifdef __WXMAC__
489 auto grandparent = GetParent()->GetParent();
490#endif
491
492 parent->Destroy();
493
494#ifdef __WXMAC__
495 if(grandparent && grandparent->IsShown()) {
496 grandparent->Raise();
497 }
498#endif
499}
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143

References FileConfig::Flush(), gPrefs, mDismissed, and wxT().

Here is the call graph for this function:

◆ OnForward()

void BrowserDialog::OnForward ( wxCommandEvent &  event)

Definition at line 463 of file HelpSystem.cpp.

464{
465 mpHtml->HistoryForward();
467}

References mpHtml, and UpdateButtons().

Here is the call graph for this function:

◆ OnKeyDown()

void BrowserDialog::OnKeyDown ( wxKeyEvent &  event)

Definition at line 501 of file HelpSystem.cpp.

502{
503 bool bSkip = true;
504 if (event.GetKeyCode() == WXK_ESCAPE)
505 {
506 bSkip = false;
507 Close(false);
508 }
509 event.Skip(bSkip);
510}

◆ UpdateButtons()

void BrowserDialog::UpdateButtons ( )

Definition at line 513 of file HelpSystem.cpp.

514{
515 wxWindow * pWnd;
516 if( (pWnd = FindWindowById( wxID_BACKWARD, this )) != NULL )
517 {
518 pWnd->Enable(mpHtml->HistoryCanBack());
519 }
520 if( (pWnd = FindWindowById( wxID_FORWARD, this )) != NULL )
521 {
522 pWnd->Enable(mpHtml->HistoryCanForward());
523 }
524}

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: