]>
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
12 // Copyright: (c) 1998 Julian Smart
13 // Licence: wxWindows licence
14 /////////////////////////////////////////////////////////////////////////////
20 // Define a new application
21 class MyApp
: public wxApp
30 // Define a new canvas which can receive some events
31 class MyCanvas
: public wxWindow
34 MyCanvas(wxFrame
*frame
);
37 void OnPaint(wxPaintEvent
& event
);
38 void OnMouseEvent(wxMouseEvent
& event
);
39 void OnChar(wxKeyEvent
& event
);
48 class MainWindow
: public wxFrame
52 MainWindow(wxFrame
*frame
, wxWindowID id
, const wxString
& title
,
53 const wxPoint
& pos
, const wxSize
& size
, long style
);
54 virtual ~MainWindow();
56 void OnCloseWindow(wxCloseEvent
& event
);
57 void OnChar(wxKeyEvent
& event
);
58 void OnPopup(wxCommandEvent
& event
);
60 // Display next page or poem
63 // Display previous page
64 void PreviousPage(void);
69 // Look in file for string
72 // Do the actual drawing of text (or just calculate size needed)
73 void ScanBuffer(wxDC
*dc
, bool DrawIt
, int *max_x
, int *max_y
);
76 void GetIndexLoadPoem(void);
81 wxString m_searchString
;
85 void WritePreferences();
86 void ReadPreferences();
103 POEM_ABOUT
= wxID_ABOUT
,
104 POEM_EXIT
= wxID_EXIT
,
105 POEM_PREVIOUS
= wxID_BACKWARD
,
106 POEM_COPY
= wxID_COPY
,
107 POEM_NEXT
= wxID_FORWARD
,
108 POEM_NEXT_MATCH
= wxID_MORE
,
109 POEM_BIGGER_TEXT
= wxID_ZOOM_IN
,
110 POEM_SMALLER_TEXT
= wxID_ZOOM_OUT
,
111 POEM_SEARCH
= wxID_FIND
,
112 POEM_MINIMIZE
= wxID_ICONIZE_FRAME