OpenASIP  2.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
HelpBrowser Class Reference

#include <HelpBrowser.hh>

Inheritance diagram for HelpBrowser:
Inheritance graph
Collaboration diagram for HelpBrowser:
Collaboration graph

Public Member Functions

 HelpBrowser (wxString title, wxString file, wxPoint position, wxSize size)
 
 ~HelpBrowser ()
 

Private Types

enum  { ID_BACK = 10000, ID_FORWARD }
 IDs form menu items. More...
 

Private Member Functions

void onClose (wxCloseEvent &event)
 
void onMenuClose (wxCommandEvent &event)
 
void onBack (wxCommandEvent &event)
 
void onForward (wxCommandEvent &event)
 

Private Attributes

wxHtmlWindow * html_
 

Detailed Description

Simple window for displaying html-pages.

Definition at line 42 of file HelpBrowser.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

IDs form menu items.

Enumerator
ID_BACK 
ID_FORWARD 

Definition at line 58 of file HelpBrowser.hh.

58  {
59  ID_BACK = 10000,
61  };

Constructor & Destructor Documentation

◆ HelpBrowser()

HelpBrowser::HelpBrowser ( wxString  title,
wxString  file,
wxPoint  position,
wxSize  size 
)

The Constructor.

Creates a browser window and opens the given file in the html-widget.

Parameters
parentParent window of the window.
titleTitle of the help browser frame.
fileHtml file to open in the frame.
positionHelp frame position on the screen.
sizeHelp frame size.

Definition at line 62 of file HelpBrowser.cc.

63  :
64  wxFrame(NULL, -1, title, position, size), html_(NULL) {
65 
66  wxToolBar* toolbar =
67  new wxToolBar(this, -1, wxDefaultPosition, wxDefaultSize,
68  wxTB_HORIZONTAL | wxNO_BORDER | wxTB_TEXT);
69 
70  wxBitmap icon;
71 
72  if (wxImage::FindHandler(wxBITMAP_TYPE_PNG) == NULL) {
73  // load image handler for pngs
74  wxImage::AddHandler(new wxPNGHandler);
75  }
76 
77  // toolbar icon locations
78  wxString backIconFile = WxConversion::toWxString(
81  "back.png");
82  wxString forwardIconFile = WxConversion::toWxString(
85  "forward.png");
86  wxString closeIconFile = WxConversion::toWxString(
89  "close_document.png");
90 
91  // add toolbar buttons
92  icon.LoadFile(closeIconFile, wxBITMAP_TYPE_PNG);
93 
94  toolbar->AddTool(wxID_CLOSE, _T("Close"), icon,
95  wxNullBitmap, wxITEM_NORMAL, _T("Close window"),
96  _T("CloseWindow"));
97 
98  toolbar->AddSeparator();
99 
100  icon.LoadFile(backIconFile, wxBITMAP_TYPE_PNG);
101  toolbar->AddTool(ID_BACK, _T("Back"), icon,
102  wxNullBitmap, wxITEM_NORMAL, _T("Back"));
103 
104  icon.LoadFile(forwardIconFile, wxBITMAP_TYPE_PNG);
105  toolbar->AddTool(ID_FORWARD, _T("Forward"), icon,
106  wxNullBitmap, wxITEM_NORMAL, _T("Forward"));
107 
108  toolbar->Realize();
109  SetToolBar(toolbar);
110 
111  // create html-widget and open the given file in it
112  html_ = new wxHtmlWindow(this);
113  html_->LoadPage(file);
114 }

References Environment::bitmapsDirPath(), FileSystem::DIRECTORY_SEPARATOR, and WxConversion::toWxString().

Here is the call graph for this function:

◆ ~HelpBrowser()

HelpBrowser::~HelpBrowser ( )

The Destructor.

Definition at line 120 of file HelpBrowser.cc.

120  {
121 }

Member Function Documentation

◆ onBack()

void HelpBrowser::onBack ( wxCommandEvent &  event)
private

Loads the previous page in the html-widget.

Definition at line 145 of file HelpBrowser.cc.

145  {
146  html_->HistoryBack();
147 }

References html_.

◆ onClose()

void HelpBrowser::onClose ( wxCloseEvent &  event)
private

Destroys the window when a close event is received.

Definition at line 128 of file HelpBrowser.cc.

128  {
129  Destroy();
130 }

◆ onForward()

void HelpBrowser::onForward ( wxCommandEvent &  event)
private

Loads the next page in html-widget history.

Definition at line 154 of file HelpBrowser.cc.

154  {
155  html_->HistoryForward();
156 }

References html_.

◆ onMenuClose()

void HelpBrowser::onMenuClose ( wxCommandEvent &  event)
private

Destroys the window when a close event is received.

Definition at line 136 of file HelpBrowser.cc.

136  {
137  Destroy();
138 }

Member Data Documentation

◆ html_

wxHtmlWindow* HelpBrowser::html_
private

Definition at line 55 of file HelpBrowser.hh.

Referenced by onBack(), and onForward().


The documentation for this class was generated from the following files:
WxConversion::toWxString
static wxString toWxString(const std::string &source)
Environment::bitmapsDirPath
static std::string bitmapsDirPath(const std::string &prog)
Definition: Environment.cc:201
HelpBrowser::ID_BACK
@ ID_BACK
Definition: HelpBrowser.hh:59
HelpBrowser::html_
wxHtmlWindow * html_
Definition: HelpBrowser.hh:55
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
HelpBrowser::ID_FORWARD
@ ID_FORWARD
Definition: HelpBrowser.hh:60