]> git.saurik.com Git - wxWidgets.git/blame - demos/poem/wxpoem.h
Use string sort order with CompareString() in wxString::CmpNoCase().
[wxWidgets.git] / demos / poem / wxpoem.h
CommitLineData
3013b6f4
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wxpoem.h
3// Purpose: A small C++ program which displays a random poem on
4// execution. It also allows search for poems containing a
5// string.
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
11// Created: 12/12/98
12// RCS-ID: $Id$
13// Copyright: (c) 1998 Julian Smart
14// Licence: wxWindows licence
15/////////////////////////////////////////////////////////////////////////////
16
5045ca9e
FM
17#ifndef _WXPOEM_H_
18#define _WXPOEM_H_
19
20
3013b6f4
JS
21// Define a new application
22class MyApp: public wxApp
23{
c7bde65d 24public:
3013b6f4
JS
25 bool OnInit();
26 int OnExit();
27};
28
29DECLARE_APP(MyApp)
30
31// Define a new canvas which can receive some events
b23386b2 32class MyCanvas: public wxWindow
3013b6f4 33{
c7bde65d
WS
34public:
35 MyCanvas(wxFrame *frame);
d3c7fc99 36 virtual ~MyCanvas();
3013b6f4
JS
37
38 void OnPaint(wxPaintEvent& event);
39 void OnMouseEvent(wxMouseEvent& event);
40 void OnChar(wxKeyEvent& event);
41
c7bde65d
WS
42private:
43 wxMenu *m_popupMenu;
44
3013b6f4
JS
45 DECLARE_EVENT_TABLE()
46};
47
48// Define a new frame
49class MainWindow: public wxFrame
50{
c7bde65d 51public:
3013b6f4 52 MyCanvas *canvas;
5045ca9e
FM
53 MainWindow(wxFrame *frame, wxWindowID id, const wxString& title,
54 const wxPoint& pos, const wxSize& size, long style);
d3c7fc99 55 virtual ~MainWindow();
3013b6f4
JS
56
57 void OnCloseWindow(wxCloseEvent& event);
58 void OnChar(wxKeyEvent& event);
508379ee 59 void OnPopup(wxCommandEvent& event);
3013b6f4
JS
60
61 // Display next page or poem
62 void NextPage(void);
63
64 // Display previous page
65 void PreviousPage(void);
66
67 // User search
68 void Search(bool);
69
70 // Look in file for string
71 long DoSearch(void);
72
73 // Do the actual drawing of text (or just calculate size needed)
74 void ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y);
75
76 // Load the poem
77 void GetIndexLoadPoem(void);
78 void Resize(void);
79
c7bde65d
WS
80private:
81
82 wxString m_searchString;
83 wxString m_title;
84
85 // Preferences
86 void WritePreferences();
87 void ReadPreferences();
88
89 // Fonts
90 void CreateFonts();
91 wxFont *m_normalFont;
92 wxFont *m_boldFont;
93 wxFont *m_italicFont;
94
3baa2662
WS
95 // Icons
96 wxIcon *m_corners[4];
97
17d31882 98 DECLARE_EVENT_TABLE()
3013b6f4
JS
99};
100
101// Menu items
17d31882
DS
102enum
103{
c7bde65d
WS
104 POEM_ABOUT = wxID_ABOUT,
105 POEM_EXIT = wxID_EXIT,
106 POEM_PREVIOUS = wxID_BACKWARD,
107 POEM_COPY = wxID_COPY,
108 POEM_NEXT = wxID_FORWARD,
109 POEM_NEXT_MATCH = wxID_MORE,
110 POEM_BIGGER_TEXT = wxID_ZOOM_IN,
111 POEM_SMALLER_TEXT = wxID_ZOOM_OUT,
112 POEM_SEARCH = wxID_FIND,
113 POEM_MINIMIZE = wxID_ICONIZE_FRAME
17d31882 114};
5045ca9e
FM
115
116#endif // _WXPOEM_H_