]>
git.saurik.com Git - wxWidgets.git/blob - demos/poem/wxpoem.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: A small C++ program which displays a random poem on
4 // execution. It also allows search for poems containing a
6 // It requires winpoem.dat and creates winpoem.idx.
7 // Original version (WinPoem) written in 1994.
8 // This has not been rewritten in a long time so
9 // beware, inelegant code!
10 // Author: Julian Smart
13 // Copyright: (c) 1998 Julian Smart
14 // Licence: wxWindows licence
15 /////////////////////////////////////////////////////////////////////////////
17 // Define a new application
18 class MyApp
: public wxApp
27 // Define a new canvas which can receive some events
28 class MyCanvas
: public wxWindow
31 MyCanvas(wxFrame
*frame
);
34 void OnPaint(wxPaintEvent
& event
);
35 void OnMouseEvent(wxMouseEvent
& event
);
36 void OnChar(wxKeyEvent
& event
);
45 class MainWindow
: public wxFrame
49 MainWindow(wxFrame
*frame
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
);
50 virtual ~MainWindow();
52 void OnCloseWindow(wxCloseEvent
& event
);
53 void OnChar(wxKeyEvent
& event
);
54 void OnPopup(wxCommandEvent
& event
);
56 // Display next page or poem
59 // Display previous page
60 void PreviousPage(void);
65 // Look in file for string
68 // Do the actual drawing of text (or just calculate size needed)
69 void ScanBuffer(wxDC
*dc
, bool DrawIt
, int *max_x
, int *max_y
);
72 void GetIndexLoadPoem(void);
77 wxString m_searchString
;
81 void WritePreferences();
82 void ReadPreferences();
99 POEM_ABOUT
= wxID_ABOUT
,
100 POEM_EXIT
= wxID_EXIT
,
101 POEM_PREVIOUS
= wxID_BACKWARD
,
102 POEM_COPY
= wxID_COPY
,
103 POEM_NEXT
= wxID_FORWARD
,
104 POEM_NEXT_MATCH
= wxID_MORE
,
105 POEM_BIGGER_TEXT
= wxID_ZOOM_IN
,
106 POEM_SMALLER_TEXT
= wxID_ZOOM_OUT
,
107 POEM_SEARCH
= wxID_FIND
,
108 POEM_MINIMIZE
= wxID_ICONIZE_FRAME