1 /*
2 	statwin.h	Status Window Header
3 	Copyright (c) 1997-8,2000,2003,2007 Kriang Lerdsuwanakij
4 	email:		lerdsuwa@users.sourceforge.net
5 
6 	This program is free software; you can redistribute it and/or modify
7 	it under the terms of the GNU General Public License as published by
8 	the Free Software Foundation; either version 2 of the License, or
9 	(at your option) any later version.
10 
11 	This program is distributed in the hope that it will be useful,
12 	but WITHOUT ANY WARRANTY; without even the implied warranty of
13 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 	GNU General Public License for more details.
15 
16 	You should have received a copy of the GNU General Public License
17 	along with this program; if not, write to the Free Software
18 	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 #ifndef __K_STATWIN_H
22 #define __K_STATWIN_H
23 
24 #include "config.h"
25 
26 #include "scrnman.h"
27 #include "editbox.h"
28 #include "khdoc.h"		/* For attributes */
29 
30 USING_NAMESPACE_STD;
31 
32 /*************************************************************************
33 	Status window base class
34 *************************************************************************/
35 
36 class StatusWindowBase : public NCWindowBase {
37 	protected:
38 		size_t	statusNo;
39 	public:
40 		virtual size_t	MaxStatus() = 0;
41 		virtual void	SetTitle(const char *title_) = 0;
42 		virtual void	SetTitle(const string &title_) = 0;
43 		virtual void	NextStatus() = 0;
SetCount(size_t)44 		virtual void	SetCount(size_t /*count_*/) {}
45 		StatusWindowBase(NCScreenManager &scrnMan_, int id_);
46 };
47 
48 
49 /*************************************************************************
50 	kcd/khyper Status window class
51 *************************************************************************/
52 
53 class khStatusWindow : public StatusWindowBase {
54 	protected:
55 		string		title;
56 		string		edit_string;
57 		string		prev_edit_string;
58 		bool		find_backward;
59 
60 	public:
61 		virtual void	DrawStatusBar(int num = -1);
62 		virtual void	DoResize();
63 		virtual void	DoUpdate();
64 
MaxStatus()65 		virtual size_t	MaxStatus() { return 1; }
66 		virtual void	SetTitle(const char *title_);
67 		virtual void	SetTitle(const string &title_);
68 		virtual void	NextStatus();
69 		khStatusWindow(NCScreenManager &scrnMan_, int id_);
~khStatusWindow()70 		virtual ~khStatusWindow() {}
71 		virtual void	Init();
72 };
73 
74 /*************************************************************************
75 	kcd/khyper URL window
76 *************************************************************************/
77 
78 class khURLWindow : public StatusWindowBase {
79 	protected:
80 		enum { DISP_TITLE = 0, DISP_KEYS1, DISP_KEYS2, DISP_KEYS3,
81 			DISP_NUMDISPLAY };
82 		string		title;
83 		string		switch_disp;
84 		size_t		switch_disp_width;
85 
86 		char	*statKey1;
87 		char	*statKey2;
88 		char	*statKey3;
89 
90 #ifdef NCURSES_MOUSE_VERSION
91 		virtual void	ProcessMouse(MEVENT &event);
92 #endif
93 	public:
94 		virtual void	DrawStatusBar(int num = -1);
95 		virtual void	DoResize();
96 		virtual void	DoUpdate();
97 
MaxStatus()98 		virtual size_t	MaxStatus() { return DISP_NUMDISPLAY; }
99 		virtual void	SetTitle(const char *title_);
100 		virtual void	SetTitle(const string &title_);
101 		virtual void	NextStatus();
102 		khURLWindow(NCScreenManager &scrnMan_, int id_);
~khURLWindow()103 		virtual ~khURLWindow() {}
104 		virtual void	Init();
105 };
106 
107 /*************************************************************************
108 	kcd/khyper URL window with find key help
109 *************************************************************************/
110 
111 class khURLWindowWithFind : public khURLWindow {
112 	protected:
113 		enum { DISP_KEYS4FIND = khURLWindow::DISP_NUMDISPLAY,
114 			DISP_KEYSFIND,
115 			DISP_NUMDISPLAYFIND };
116 		char	*statKey4WithFind;
117 		char	*statKeyFind;
118 		char	*statKeyCtrlF;
119 
120 	public:
MaxStatus()121 		virtual size_t	MaxStatus() { return DISP_NUMDISPLAYFIND; }
122 		void	ProcessCtrl(char c, bool s);
123 		virtual void	DrawStatusBar(int num = -1);
124 		khURLWindowWithFind(NCScreenManager &scrnMan_, int id_);
125 };
126 
127 /*************************************************************************
128 	kcd/khyper Status window with find class
129 *************************************************************************/
130 
131 class SomethingWithFind;
132 
133 class khStatusWindowWithFind : public khStatusWindow {
134 	public:
135 		static const int	MAX_SEARCHCHAR = 15;
136 	protected:
137 		EditBox		*editBox;
138 		int		statusSearch;
139 		size_t		count;
140 		char		searchStr[MAX_SEARCHCHAR+1];
141 		SomethingWithFind	*findText;
142 
143 		static const char	*statFind1;
144 		static const char	*statFind2;
145 		static const char	*statFindOvr;
146 		static const char	*statFindIns;
147 
148 	public:
149 		static	int	spaceSelect;
150 
151 		virtual void	DrawStatusBar(int num = -1);
152 		virtual void	DoRestCursor();
153 		virtual void	ProcessKey(int ch);
SetCount(size_t count_)154 		void		SetCount(size_t count_) { count = count_; }
155 		khStatusWindowWithFind(NCScreenManager &scrnMan_, int id_,
156 					SomethingWithFind *findText_);
157 		virtual ~khStatusWindowWithFind();
158 		void	SetFindWindow(SomethingWithFind *findText_);
159 };
160 
161 /*************************************************************************
162 	Marker bar class
163 *************************************************************************/
164 
165 class khMarkerBar : public NCWindowBase {
166 	public:
167 		virtual void	DoResize();
168 		virtual void	DoUpdate();
169 		virtual void	Init();
170 
171 		khMarkerBar(NCScreenManager &scrnMan_, int id_);
172 
173 		void	Mark(int row, chtype c);
174 };
175 
176 #endif	/* __K_STATWIN_H */
177