]>
Commit | Line | Data |
---|---|---|
93cf77c0 JS |
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 | ||
34138703 JS |
16 | #include "wx/object.h" |
17 | #include "wx/stubs/printdlg.h" | |
93cf77c0 JS |
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 | ||
93cf77c0 JS |
23 | IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog) |
24 | IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog) | |
93cf77c0 JS |
25 | |
26 | wxPrintDialog::wxPrintDialog(): | |
27 | wxDialog() | |
28 | { | |
34138703 JS |
29 | m_dialogParent = NULL; |
30 | m_printerDC = NULL; | |
93cf77c0 JS |
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 | { | |
34138703 JS |
41 | m_dialogParent = p; |
42 | m_printerDC = NULL; | |
93cf77c0 JS |
43 | |
44 | if ( data ) | |
34138703 | 45 | m_printData = *data; |
93cf77c0 JS |
46 | |
47 | return TRUE; | |
48 | } | |
49 | ||
50 | wxPrintDialog::~wxPrintDialog() | |
51 | { | |
34138703 JS |
52 | if (m_printerDC) |
53 | delete m_printerDC; | |
93cf77c0 JS |
54 | } |
55 | ||
56 | int wxPrintDialog::ShowModal() | |
57 | { | |
58 | // TODO | |
59 | return wxID_CANCEL; | |
60 | } | |
61 | ||
62 | wxDC *wxPrintDialog::GetPrintDC() | |
63 | { | |
34138703 | 64 | if (m_printerDC) |
93cf77c0 | 65 | { |
34138703 JS |
66 | wxDC* dc = m_printerDC; |
67 | m_printerDC = NULL; | |
68 | return dc; | |
93cf77c0 JS |
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 |