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