More wxWidgets in poem demo.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@
|
|||||||
// Define a new application
|
// Define a new application
|
||||||
class MyApp: public wxApp
|
class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
int OnExit();
|
int OnExit();
|
||||||
};
|
};
|
||||||
@@ -31,23 +31,24 @@ DECLARE_APP(MyApp)
|
|||||||
// Define a new canvas which can receive some events
|
// Define a new canvas which can receive some events
|
||||||
class MyCanvas: public wxWindow
|
class MyCanvas: public wxWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyCanvas(wxFrame *frame, wxWindowID id, const wxPoint& pos, const wxSize& size);
|
MyCanvas(wxFrame *frame);
|
||||||
~MyCanvas();
|
~MyCanvas();
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnMouseEvent(wxMouseEvent& event);
|
void OnMouseEvent(wxMouseEvent& event);
|
||||||
void OnChar(wxKeyEvent& event);
|
void OnChar(wxKeyEvent& event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxMenu *m_popupMenu;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
private:
|
|
||||||
wxMenu *popupMenu;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define a new frame
|
// Define a new frame
|
||||||
class MainWindow: public wxFrame
|
class MainWindow: public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyCanvas *canvas;
|
MyCanvas *canvas;
|
||||||
MainWindow(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
|
MainWindow(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
|
||||||
|
|
||||||
@@ -74,21 +75,35 @@ class MainWindow: public wxFrame
|
|||||||
void GetIndexLoadPoem(void);
|
void GetIndexLoadPoem(void);
|
||||||
void Resize(void);
|
void Resize(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
wxString m_searchString;
|
||||||
|
wxString m_title;
|
||||||
|
|
||||||
|
// Preferences
|
||||||
|
void WritePreferences();
|
||||||
|
void ReadPreferences();
|
||||||
|
|
||||||
|
// Fonts
|
||||||
|
void CreateFonts();
|
||||||
|
wxFont *m_normalFont;
|
||||||
|
wxFont *m_boldFont;
|
||||||
|
wxFont *m_italicFont;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Menu items
|
// Menu items
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
POEM_NEXT = wxID_HIGHEST,
|
POEM_ABOUT = wxID_ABOUT,
|
||||||
POEM_PREVIOUS,
|
POEM_EXIT = wxID_EXIT,
|
||||||
POEM_COPY,
|
POEM_PREVIOUS = wxID_BACKWARD,
|
||||||
POEM_SEARCH,
|
POEM_COPY = wxID_COPY,
|
||||||
POEM_NEXT_MATCH,
|
POEM_NEXT = wxID_FORWARD,
|
||||||
POEM_ABOUT,
|
POEM_NEXT_MATCH = wxID_MORE,
|
||||||
POEM_EXIT,
|
POEM_BIGGER_TEXT = wxID_ZOOM_IN,
|
||||||
POEM_COMPILE,
|
POEM_SMALLER_TEXT = wxID_ZOOM_OUT,
|
||||||
POEM_BIGGER_TEXT,
|
POEM_SEARCH = wxID_FIND,
|
||||||
POEM_SMALLER_TEXT,
|
POEM_MINIMIZE = wxID_ICONIZE_FRAME
|
||||||
POEM_MINIMIZE
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user