1 /*
2 Copyright (C) 2013-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5 
6 /*
7 	WARNING: This file was generated by the dkct program (see
8 	http://dktools.sourceforge.net/ for details).
9 	Changes you make here will be lost if dkct is run again!
10 	You should modify the original source and run dkct on it.
11 	Original source: WinprintFrame.wxc
12 */
13 
14 /**	@file WinprintFrame.h Header file for the WinprintFrame module.
15 */
16 
17 #ifndef WINPRINTFRAME_H_INCLUDED
18 /** Avoid multiple inclusions. */
19 #define WINPRINTFRAME_H_INCLUDED 1
20 
21 
22 #ifdef	DK3_USE_WX
23 #undef	DK3_USE_WX
24 #endif
25 /**	Use wxWidgets libraries to build GUI programs.
26 */
27 #define	DK3_USE_WX	1
28 
29 
30 class WinprintFrame : public DkWxFrame
31 {
32   private:
33 
34     /**	Event table for frame.
35     */
36 #if	wxCHECK_VERSION(3,0,0)
37     wxDECLARE_EVENT_TABLE();
38 #else
39     DECLARE_EVENT_TABLE()
40 #endif
41 
42   protected:
43 
44     /**	Black color for status label.
45     */
46     wxColour			 cBlack;
47 
48     /**	Green color for status label.
49     */
50     wxColour			 cGreen;
51 
52     /**	Red color for status label.
53     */
54     wxColour			 cRed;
55 
56     /**	Printer names.
57     */
58     DK3_PCWXCHAR		*pNames;
59 
60     /**	Printer names as wxString array.
61     */
62     wxString			*wxsNames;
63 
64     /**	Size of printer names array.
65     */
66     size_t			 nNames;
67 
68     /**	Index of default printer in array.
69     */
70     int				 nDefPrinter;
71 
72     /**	File dialog x position.
73     */
74     int				 fdx;
75 
76     /**	File dialog y position.
77     */
78     int				 fdy;
79 
80     /**	Printer chooser dialog x position.
81     */
82     int				 pcx;
83 
84     /**	Printer chooser dialog y position.
85     */
86     int				 pcy;
87 
88     /**	Localized texts.
89     */
90     wxChar const * const	*sTexts;
91 
92     /**	Non-localized texts.
93     */
94     wxChar const * const	*sNlWx;
95 
96     /**	Non-localized texts.
97     */
98     dkChar const * const	*sNlDk;
99 
100     /**	Print configuration.
101     */
102     dk3_print_conf_t		*pc;
103 
104     /**	Use default printer.
105     */
106     BOOL			 bUseDefaultPrinter;
107 
108     /**	Use named printer.
109     */
110     wxChar const		*sNamedPrinter;
111 
112     /**	Named file to process.
113     */
114     wxChar const		*sNamedFile;
115 
116     /**	Communicator object.
117     */
118     DkWxCommunicator		*pComm;
119 
120     /**	Time to close the application.
121     */
122     dk3_time_t			 timeClose;
123 
124     /**	Flag: Closing the application is scheduled.
125     */
126     BOOL			 bCloseScheduled;
127 
128     /**	Flag: Autostart wanted.
129     */
130     BOOL			 bAutostartWanted;
131 
132     /**	Flag: GUI ok.
133     */
134     bool dkctGUILayoutOK;
135 
136     /**	Contents panel.
137     */
138     wxPanel *dkctGUIContentsPanel;
139 
140     /**	GUI element mainSizer.
141     */
142     wxBoxSizer *mainSizer;
143 
144     /**	GUI element tbMain.
145     */
146     wxToolBar *tbMain;
147 
148     /**	GUI element mbMain.
149     */
150     wxMenuBar *mbMain;
151 
152     /**	GUI element bRun.
153     */
154     wxToolBarToolBase *bRun;
155 
156     /**	GUI element bExit.
157     */
158     wxToolBarToolBase *bExit;
159 
160     /**	GUI element menuFile.
161     */
162     wxMenu *menuFile;
163 
164     /**	GUI element menuHelp.
165     */
166     wxMenu *menuHelp;
167 
168     /**	GUI element miFilePrint.
169     */
170     wxMenuItem *miFilePrint;
171 
172     /**	GUI element miFileExit.
173     */
174     wxMenuItem *miFileExit;
175 
176     /**	GUI element miHelpAbout.
177     */
178     wxMenuItem *miHelpAbout;
179 
180     /**	GUI element miHelpContents.
181     */
182     wxMenuItem *miHelpContents;
183 
184     /**	GUI element verticalSizer.
185     */
186     wxBoxSizer *verticalSizer;
187 
188     /**	GUI element contentsSizer.
189     */
190     wxGridBagSizer *contentsSizer;
191 
192     /**	GUI element tStatus.
193     */
194     wxStaticText *tStatus;
195 
196 
197   public:
198 
199     /**	Constructor.
200 	@param	wxid			Window ID.
201 	@param	applicationHelper	Application helper object.
202 	@param	hc			Help controller for online help.
203 	@param	argc			Number of command line arguments.
204 	@param	argv			Command line arguments array.
205 	@param	localizedTexts		Localized wxChar texts.
206 	@param	nlWx			Non-localized wxChar texts.
207 	@param	nlDk			Non-localized dkChar texts.
208 	@param	pPrintConf		Print configuration.
209     */
210     WinprintFrame(
211       int			  wxid,
212       DkWxAppHelper		 *applicationHelper,
213       DkWxHelpController	 *hc,
214       int			  argc,
215       wxChar			**argv,
216       wxChar const * const	 *localizedTexts,
217       wxChar const * const	 *nlWx,
218       dkChar const * const	 *nlDk,
219       dk3_print_conf_t		 *pPrintConf,
220       DK3_PCWXCHAR		 *printerNames,
221       size_t			  numberOfPrinters,
222       int			  defaultPrinterIndex
223     );
224 
225     /**	Destructor.
226     */
227     ~WinprintFrame();
228 
229     /**	Check whether we can close the window.
230     	@param	isLast	Flag: Last main window to close.
231     */
232     bool
233     canClose(bool isLast);
234 
235     /**	Handler for File/Exit.
236     	@param	event	Event to process.
237     */
238     void
239     OnQuit(wxCommandEvent & event);
240 
241     /**	Handler for Help/About.
242     	@param	event	Event to process.
243     */
244     void
245     OnAbout(wxCommandEvent & event);
246 
247     /**	Handler for Help/Contents.
248     	@param	event	Event to process.
249     */
250     void
251     OnHelpContents(wxCommandEvent & event);
252 
253     /**	Handler for print menu item.
254     	@param	event	Event to process.
255     */
256     void
257     OnPrint(wxCommandEvent & event);
258 
259     /*	__CHANGE__ 008:	Remove OnIdle if no idle processing required.
260     */
261     /**	Handler for idle events.
262     */
263     void
264     OnIdle(wxIdleEvent & event);
265 
266     /*	__CHANGE__ 017:	Event handlers for further events.
267     */
268 
269     /*	__CHANGE__ 014:	Add further methods.
270     */
271 
272     /**	Run print job for given file name.
273     	@param	filename	Name of file to print.
274     */
275     int
276     runFileNameJob(wxChar const *filename);
277 
278     /**	Run for a print job.
279     */
280     int	runJob(void);
281 
282     /**	Set error status.
283     	@param	txt		Error message text.
284 	@param	filename	Current filename to process.
285     */
286     void setErrorStatus(wxChar const *txt, wxChar const *filename);
287 
288 };
289 
290 
291 
292 #endif
293