]> git.saurik.com Git - wxWidgets.git/blob - src/stubs/printdlg.cpp
-somewhat more elegant method, supporting the src subdir (-Markus)
[wxWidgets.git] / src / stubs / printdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: printdlg.cpp
3 // Purpose: wxPrintDialog, wxPageSetupDialog
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "printdlg.h"
14 #endif
15
16 #include "wx/printdlg.h"
17 #include "wx/dcprint.h"
18
19 // Use generic page setup dialog: use your own native one if one exists.
20 #include "wx/generic/prntdlgg.h"
21
22 #if !USE_SHARED_LIBRARY
23 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
24 IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
25 #endif
26
27 wxPrintDialog::wxPrintDialog():
28 wxDialog()
29 {
30 dialogParent = NULL;
31 printerDC = NULL;
32 destroyDC = TRUE;
33 deviceName = NULL;
34 driverName = NULL;
35 portName = NULL;
36 }
37
38 wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data):
39 wxDialog()
40 {
41 Create(p, data);
42 }
43
44 bool wxPrintDialog::Create(wxWindow *p, wxPrintData* data)
45 {
46 dialogParent = p;
47 printerDC = NULL;
48 destroyDC = TRUE;
49 deviceName = NULL;
50 driverName = NULL;
51 portName = NULL;
52
53 if ( data )
54 printData = *data;
55
56 return TRUE;
57 }
58
59 wxPrintDialog::~wxPrintDialog()
60 {
61 if (destroyDC && printerDC)
62 delete printerDC;
63 if (deviceName) delete[] deviceName;
64 if (driverName) delete[] driverName;
65 if (portName) delete[] portName;
66 }
67
68 int wxPrintDialog::ShowModal()
69 {
70 // TODO
71 return wxID_CANCEL;
72 }
73
74 wxDC *wxPrintDialog::GetPrintDC()
75 {
76 if (printerDC)
77 {
78 destroyDC = FALSE;
79 return printerDC;
80 }
81 else
82 return NULL;
83 }
84
85 /*
86 * wxPageSetupDialog
87 */
88
89 wxPageSetupDialog::wxPageSetupDialog():
90 wxDialog()
91 {
92 m_dialogParent = NULL;
93 }
94
95 wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
96 wxDialog()
97 {
98 Create(p, data);
99 }
100
101 bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data)
102 {
103 m_dialogParent = p;
104
105 if (data)
106 m_pageSetupData = (*data);
107
108 return TRUE;
109 }
110
111 wxPageSetupDialog::~wxPageSetupDialog()
112 {
113 }
114
115 int wxPageSetupDialog::ShowModal()
116 {
117 // Uses generic page setup dialog
118 wxGenericPageSetupDialog *genericPageSetupDialog = new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData);
119 int ret = genericPageSetupDialog->ShowModal();
120 m_pageSetupData = genericPageSetupDialog->GetPageSetupData();
121 genericPageSetupDialog->Close(TRUE);
122 return ret;
123 }
124