Audacity  3.0.3
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 440 of file HelpSystem.cpp.

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

References title.

Member Function Documentation

◆ OnBackward()

void BrowserDialog::OnBackward ( wxCommandEvent &  event)

Definition at line 465 of file HelpSystem.cpp.

466 {
467  mpHtml->HistoryBack();
468  UpdateButtons();
469 }

References mpHtml, and UpdateButtons().

Here is the call graph for this function:

◆ OnClose()

void BrowserDialog::OnClose ( wxCommandEvent &  event)

Definition at line 471 of file HelpSystem.cpp.

472 {
473  if (IsModal() && !mDismissed)
474  {
475  mDismissed = true;
476  EndModal(wxID_CANCEL);
477  }
478  auto parent = GetParent();
479 
480  gPrefs->Write(wxT("/GUI/BrowserWidth"), GetSize().GetX());
481  gPrefs->Write(wxT("/GUI/BrowserHeight"), GetSize().GetY());
482  gPrefs->Flush();
483 
484 #ifdef __WXMAC__
485  auto grandparent = GetParent()->GetParent();
486 #endif
487 
488  parent->Destroy();
489 
490 #ifdef __WXMAC__
491  if(grandparent && grandparent->IsShown()) {
492  grandparent->Raise();
493  }
494 #endif
495 }

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

Here is the call graph for this function:

◆ OnForward()

void BrowserDialog::OnForward ( wxCommandEvent &  event)

Definition at line 459 of file HelpSystem.cpp.

460 {
461  mpHtml->HistoryForward();
462  UpdateButtons();
463 }

References mpHtml, and UpdateButtons().

Here is the call graph for this function:

◆ OnKeyDown()

void BrowserDialog::OnKeyDown ( wxKeyEvent &  event)

Definition at line 497 of file HelpSystem.cpp.

498 {
499  bool bSkip = true;
500  if (event.GetKeyCode() == WXK_ESCAPE)
501  {
502  bSkip = false;
503  Close(false);
504  }
505  event.Skip(bSkip);
506 }

◆ UpdateButtons()

void BrowserDialog::UpdateButtons ( )

Definition at line 509 of file HelpSystem.cpp.

510 {
511  wxWindow * pWnd;
512  if( (pWnd = FindWindowById( wxID_BACKWARD, this )) != NULL )
513  {
514  pWnd->Enable(mpHtml->HistoryCanBack());
515  }
516  if( (pWnd = FindWindowById( wxID_FORWARD, this )) != NULL )
517  {
518  pWnd->Enable(mpHtml->HistoryCanForward());
519  }
520 }

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:
BrowserDialog::mpHtml
HtmlWindow * mpHtml
Definition: HelpSystem.h:154
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
BrowserDialog::mDismissed
bool mDismissed
Definition: HelpSystem.h:155
BrowserDialog::UpdateButtons
void UpdateButtons()
Definition: HelpSystem.cpp:509
BrowserDialog::ID
@ ID
Definition: HelpSystem.h:142
wxDialogWrapper
Definition: wxPanelWrapper.h:81
title
static const auto title
Definition: NoUpdatesAvailableDialog.cpp:22
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143