]>
Commit | Line | Data |
---|---|---|
e9576ca5 SC |
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/object.h" | |
17 | #include "wx/stubs/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 | #if !USE_SHARED_LIBRARY | |
24 | IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog) | |
25 | IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog) | |
26 | #endif | |
27 | ||
28 | wxPrintDialog::wxPrintDialog(): | |
29 | wxDialog() | |
30 | { | |
31 | m_dialogParent = NULL; | |
32 | m_printerDC = NULL; | |
33 | } | |
34 | ||
35 | wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data): | |
36 | wxDialog() | |
37 | { | |
38 | Create(p, data); | |
39 | } | |
40 | ||
41 | bool wxPrintDialog::Create(wxWindow *p, wxPrintData* data) | |
42 | { | |
43 | m_dialogParent = p; | |
44 | m_printerDC = NULL; | |
45 | ||
46 | if ( data ) | |
47 | m_printData = *data; | |
48 | ||
49 | return TRUE; | |
50 | } | |
51 | ||
52 | wxPrintDialog::~wxPrintDialog() | |
53 | { | |
54 | if (m_printerDC) | |
55 | delete m_printerDC; | |
56 | } | |
57 | ||
58 | int wxPrintDialog::ShowModal() | |
59 | { | |
60 | // TODO | |
61 | return wxID_CANCEL; | |
62 | } | |
63 | ||
64 | wxDC *wxPrintDialog::GetPrintDC() | |
65 | { | |
66 | if (m_printerDC) | |
67 | { | |
68 | wxDC* dc = m_printerDC; | |
69 | m_printerDC = NULL; | |
70 | return dc; | |
71 | } | |
72 | else | |
73 | return NULL; | |
74 | } | |
75 | ||
76 | /* | |
77 | * wxPageSetupDialog | |
78 | */ | |
79 | ||
80 | wxPageSetupDialog::wxPageSetupDialog(): | |
81 | wxDialog() | |
82 | { | |
83 | m_dialogParent = NULL; | |
84 | } | |
85 | ||
86 | wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data): | |
87 | wxDialog() | |
88 | { | |
89 | Create(p, data); | |
90 | } | |
91 | ||
92 | bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data) | |
93 | { | |
94 | m_dialogParent = p; | |
95 | ||
96 | if (data) | |
97 | m_pageSetupData = (*data); | |
98 | ||
99 | return TRUE; | |
100 | } | |
101 | ||
102 | wxPageSetupDialog::~wxPageSetupDialog() | |
103 | { | |
104 | } | |
105 | ||
106 | int wxPageSetupDialog::ShowModal() | |
107 | { | |
108 | // Uses generic page setup dialog | |
109 | wxGenericPageSetupDialog *genericPageSetupDialog = new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData); | |
110 | int ret = genericPageSetupDialog->ShowModal(); | |
111 | m_pageSetupData = genericPageSetupDialog->GetPageSetupData(); | |
112 | genericPageSetupDialog->Close(TRUE); | |
113 | return ret; | |
114 | } | |
115 |