]> git.saurik.com Git - wxWidgets.git/blame - demos/poem/wxpoem.h
Rebaked (build/bakefiles/common.bkl 1.95->1.96 change)
[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
ab7ce33c 17#if defined(__GNUG__) && !defined(__APPLE__)
3013b6f4
JS
18#pragma interface "wxpoem.h"
19#endif
20
21// Define a new application
22class MyApp: public wxApp
23{
24 public:
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
JS
33{
34 public:
35 MyCanvas(wxFrame *frame, wxWindowID id, const wxPoint& pos, const wxSize& size);
17d31882 36 ~MyCanvas();
3013b6f4
JS
37
38 void OnPaint(wxPaintEvent& event);
39 void OnMouseEvent(wxMouseEvent& event);
40 void OnChar(wxKeyEvent& event);
41
42 DECLARE_EVENT_TABLE()
17d31882
DS
43 private:
44 wxMenu *popupMenu;
3013b6f4
JS
45};
46
47// Define a new frame
48class MainWindow: public wxFrame
49{
50 public:
51 MyCanvas *canvas;
52 MainWindow(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
53
54 void OnCloseWindow(wxCloseEvent& event);
55 void OnChar(wxKeyEvent& event);
508379ee 56 void OnPopup(wxCommandEvent& event);
3013b6f4
JS
57
58 // Display next page or poem
59 void NextPage(void);
60
61 // Display previous page
62 void PreviousPage(void);
63
64 // User search
65 void Search(bool);
66
67 // Look in file for string
68 long DoSearch(void);
69
70 // Do the actual drawing of text (or just calculate size needed)
71 void ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y);
72
73 // Load the poem
74 void GetIndexLoadPoem(void);
75 void Resize(void);
76
17d31882 77 DECLARE_EVENT_TABLE()
3013b6f4
JS
78};
79
80// Menu items
17d31882
DS
81enum
82{
83 POEM_NEXT = wxID_HIGHEST,
84 POEM_PREVIOUS,
85 POEM_COPY,
86 POEM_SEARCH,
87 POEM_NEXT_MATCH,
88 POEM_ABOUT,
89 POEM_EXIT,
90 POEM_COMPILE,
91 POEM_BIGGER_TEXT,
92 POEM_SMALLER_TEXT,
93 POEM_MINIMIZE
94};