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

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

#include <LinkingHtmlWindow.h>

Inheritance diagram for BrowserDialog:
wxDialogWrapper wxTabTraversalWrapper< wxDialog > HtmlTextHelpDialog

Public Types

enum  { ID = 0 }
 

Public Member Functions

 BrowserDialog (wxWindow *pParent, const wxString &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 wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
- 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 45 of file LinkingHtmlWindow.h.

Member Enumeration Documentation

anonymous enum
Enumerator
ID 

Definition at line 48 of file LinkingHtmlWindow.h.

48 { ID = 0 };

Constructor & Destructor Documentation

BrowserDialog::BrowserDialog ( wxWindow *  pParent,
const wxString &  title 
)

Definition at line 42 of file LinkingHtmlWindow.cpp.

43  : wxDialogWrapper{ pParent, ID, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER /*| wxMAXIMIZE_BOX */ }
44 {
45  int width, height;
46  const int minWidth = 400;
47  const int minHeight = 250;
48 
49  gPrefs->Read(wxT("/GUI/BrowserWidth"), &width, minWidth);
50  gPrefs->Read(wxT("/GUI/BrowserHeight"), &height, minHeight);
51 
52  if (width < minWidth || width > wxSystemSettings::GetMetric(wxSYS_SCREEN_X))
53  width = minWidth;
54  if (height < minHeight || height > wxSystemSettings::GetMetric(wxSYS_SCREEN_Y))
55  height = minHeight;
56 
57  SetMinSize(wxSize(minWidth, minHeight));
58  SetSize(wxDefaultPosition.x, wxDefaultPosition.y, width, height, wxSIZE_AUTO);
59 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73

Member Function Documentation

void BrowserDialog::OnBackward ( wxCommandEvent &  event)

Definition at line 67 of file LinkingHtmlWindow.cpp.

References mpHtml, and UpdateButtons().

68 {
69  mpHtml->HistoryBack();
70  UpdateButtons();
71 }
HtmlWindow * mpHtml
void BrowserDialog::OnClose ( wxCommandEvent &  event)

Definition at line 73 of file LinkingHtmlWindow.cpp.

References gPrefs, and mDismissed.

74 {
75  if (IsModal() && !mDismissed)
76  {
77  mDismissed = true;
78  EndModal(wxID_CANCEL);
79  }
80  auto parent = GetParent();
81 
82  gPrefs->Write(wxT("/GUI/BrowserWidth"), GetSize().GetX());
83  gPrefs->Write(wxT("/GUI/BrowserHeight"), GetSize().GetY());
84  gPrefs->Flush();
85 
86 #ifdef __WXMAC__
87  auto grandparent = GetParent()->GetParent();
88 #endif
89 
90  parent->Destroy();
91 
92 #ifdef __WXMAC__
93  if(grandparent && grandparent->IsShown()) {
94  grandparent->Raise();
95  }
96 #endif
97 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void BrowserDialog::OnForward ( wxCommandEvent &  event)

Definition at line 61 of file LinkingHtmlWindow.cpp.

References mpHtml, and UpdateButtons().

62 {
63  mpHtml->HistoryForward();
64  UpdateButtons();
65 }
HtmlWindow * mpHtml
void BrowserDialog::OnKeyDown ( wxKeyEvent &  event)

Definition at line 99 of file LinkingHtmlWindow.cpp.

100 {
101  bool bSkip = true;
102  if (event.GetKeyCode() == WXK_ESCAPE)
103  {
104  bSkip = false;
105  Close(false);
106  }
107  event.Skip(bSkip);
108 }
void BrowserDialog::UpdateButtons ( )

Definition at line 111 of file LinkingHtmlWindow.cpp.

References mpHtml.

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

112 {
113  wxWindow * pWnd;
114  if( (pWnd = FindWindowById( wxID_BACKWARD, this )) != NULL )
115  {
116  pWnd->Enable(mpHtml->HistoryCanBack());
117  }
118  if( (pWnd = FindWindowById( wxID_FORWARD, this )) != NULL )
119  {
120  pWnd->Enable(mpHtml->HistoryCanForward());
121  }
122 }
HtmlWindow * mpHtml

Member Data Documentation

bool BrowserDialog::mDismissed {}

Definition at line 61 of file LinkingHtmlWindow.h.

Referenced by OnClose().

HtmlWindow* BrowserDialog::mpHtml

Definition at line 60 of file LinkingHtmlWindow.h.

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


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