2006-01-13 Jonathan Chambers <jonathan.chambers@ansys.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / PrintDialog.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2005 Novell, Inc.
21 //
22 // Authors:
23 //      Someone
24 //      Jonathan Chambers (jonathan.chambers@ansys.com)
25 //
26
27 using System;
28 using System.ComponentModel;
29 using System.ComponentModel.Design;
30 using System.ComponentModel.Design.Serialization;
31 using System.Collections;
32 using System.Diagnostics;
33 using System.Drawing;
34 using System.Drawing.Printing;
35 using System.Reflection;
36
37 namespace System.Windows.Forms
38 {
39         [DefaultProperty("Document")]
40         public sealed class PrintDialog : CommonDialog {
41                 PrintDocument document;
42                 PrinterSettings printer_settings;
43                 bool allow_current_page;
44                 bool allow_print_to_file;
45                 bool allow_selection;
46                 bool allow_some_pages;
47                 bool show_help;
48                 bool show_network;
49                 bool print_to_file;
50                 
51                 public PrintDialog ()
52                 {
53                         allow_print_to_file = true;
54                         show_network = true;
55                 }
56
57                 public override void Reset ()
58                 {
59                 }
60
61 #if NET_2_0
62                 public bool AllowCurrentPage {
63                         get {
64                                 return allow_current_page;
65                         }
66
67                         set {
68                                 allow_current_page = value;
69                         }
70                 }
71 #endif
72
73                 [DefaultValue(true)]
74                 public bool AllowPrintToFile {
75                         get {
76                                 return allow_print_to_file;
77                         }
78
79                         set {
80                                 allow_print_to_file = value;
81                         }
82                 }
83
84                 [DefaultValue(false)]
85                 public bool AllowSelection {
86                         get {
87                                 return allow_selection;
88                         }
89
90                         set {
91                                 allow_selection = value;
92                         }
93                 }
94
95                 [DefaultValue(false)]
96                 public bool AllowSomePages {
97                         get {
98                                 return allow_some_pages;
99                         }
100
101                         set {
102                                 allow_some_pages = value;
103                         }
104                 }
105
106                 [DefaultValue(null)]
107                 public PrintDocument Document {
108                         get {
109                                 return document;
110                         }
111
112                         set {
113                                 document = value;
114                         }
115                 }
116
117                 [Browsable(false)]
118                 [DefaultValue(null)]
119                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
120                 public PrinterSettings PrinterSettings {
121                         get {
122                                 return printer_settings;
123                         }
124
125                         set {
126                                 printer_settings = value;
127                         }
128                 }
129
130                 [DefaultValue(false)]
131                 public bool PrintToFile {
132                         get {
133                                 return print_to_file;
134                         }
135
136                         set {
137                                 print_to_file = value;
138                         }
139                 }
140
141                 [DefaultValue(true)]
142                 public bool ShowNetwork {
143                         get {
144                                 return show_network;
145                         }
146
147                         set {
148                                 show_network = value;
149                         }
150                 }
151
152                 [DefaultValue(false)]
153                 public bool ShowHelp {
154                         get {
155                                 return show_help;
156                         }
157
158                         set {
159                                 show_help = value;
160                         }
161                 }
162
163                 protected override bool RunDialog (IntPtr hwnd)
164                 {
165                         return true;
166                 }
167         }
168 }