1 
2 #ifndef _CR3_H_
3 #define _CR3_H_
4 
5 #include "view.h"
6 #include "histlist.h"
7 
8 /**
9  * @short Application Main Window
10  * @author Vadim Lopatin <vadim.lopatin@coolreader.org>
11  * @version 3.0.16
12  */
13 
14 #include <cr3version.h>
15 #define CR3_VERSION CR_ENGINE_VERSION
16 
17 lString32 wx2cr( wxString str );
18 wxString cr2wx( lString32 str );
19 
20 class
21 cr3app : public wxApp
22 {
23 	public:
24 		virtual bool OnInit();
25 		virtual int OnExit();
26 };
27 
28 class
29 cr3scroll : public wxScrollBar
30 {
31 private:
32 	cr3view *  _view;
33 public:
cr3scroll(cr3view * view)34 	cr3scroll( cr3view * view )
35 		: _view( view ) { }
36     void OnSetFocus( wxFocusEvent& event );
37 private:
38 	DECLARE_EVENT_TABLE()
39 };
40 
41 enum active_mode_t {
42     am_none,
43     am_book,
44     am_history
45 };
46 
47 class
48 cr3Frame : public wxFrame
49 {
50     private:
51         bool _isFullscreen;
52         active_mode_t _activeMode;
53         int  _toolbarSize;
54 	public:
55 		cr3Frame( const wxString& title, const wxPoint& p, const wxSize& sz, lString32 appDir );
56 
57         void SetActiveMode( active_mode_t mode );
58         void UpdateToolbar();
59         void OnOptionsChange( CRPropRef oldprops, CRPropRef newprops, CRPropRef changed );
60 
61 		void OnQuit( wxCommandEvent& event );
62 		void OnAbout( wxCommandEvent& event );
63         void OnScroll( wxScrollEvent& event );
64         void OnKeyDown( wxKeyEvent& event );
65         void OnSetFocus( wxFocusEvent& event );
66         void OnFileOpen( wxCommandEvent& event );
67         void OnFileSave( wxCommandEvent& event );
68         void OnCommand( wxCommandEvent& event );
69         void OnRotate( wxCommandEvent& event );
70         void OnShowOptions( wxCommandEvent& event );
71         void OnShowTOC( wxCommandEvent& event );
72         void OnShowHistory( wxCommandEvent& event );
73         void OnUpdateUI( wxUpdateUIEvent& event );
74         void OnClose( wxCloseEvent& event );
75         void OnMouseWheel( wxMouseEvent& event);
76         void OnSize( wxSizeEvent& event);
77         void OnInitDialog( wxInitDialogEvent& event);
78         void OnHistItemActivated( wxListEvent& event );
79 
getProps()80         CRPropRef getProps() { return _props; }
81         void SaveOptions();
82         void RestoreOptions();
83         void SetMenu( bool visible );
84         void SetStatus( bool visible );
85         void SetToolbarSize( int size );
86 
87         wxBitmap getIcon16x16( const lChar32 * name );
88 	protected:
89     	cr3scroll * _scrollBar;
90 		cr3view * _view;
91     	HistList * _hist;
92         wxBoxSizer * _sizer;
93         lString32 _appDir;
94         CRPropRef _props;
95 	private:
96 		DECLARE_EVENT_TABLE()
97 };
98 
99 enum
100 {
101 	Menu_File_Quit = 100,
102 	Menu_File_About,
103 	Menu_File_Options,
104     Menu_View_ZoomIn,
105     Menu_View_ZoomOut,
106     Menu_View_NextPage,
107     Menu_View_PrevPage,
108     Menu_View_NextLine,
109     Menu_View_PrevLine,
110     Menu_View_Text_Format,
111     Menu_Link_Back,
112     Menu_Link_Forward,
113     Menu_Link_Next,
114     Menu_Link_Prev,
115     Menu_Link_Go,
116     Menu_View_Begin,
117     Menu_View_End,
118     Menu_View_ToggleFullScreen,
119     Menu_View_TogglePages,
120     Menu_View_TogglePageHeader,
121     Menu_View_TOC,
122     Menu_View_History,
123     Menu_View_Rotate,
124 };
125 
126 enum
127 {
128 	Window_Id_Scrollbar = 1000,
129 	Window_Id_View,
130     Window_Id_HistList,
131 	Window_Id_Options,
132 };
133 
134 #endif // _CR3_H_
135