Fix for the issue of getting occasional -5875 error on the server when
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / SystemInformation.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) 2004,2006 Novell, Inc. (http://www.novell.com)
21 //
22 // Authors:
23 //      Miguel de Icaza (miguel@novell.com).
24 //      Peter Bartok    (pbartok@novell.com)
25 //
26
27 // NOT COMPLETE
28
29 using System;
30 using System.Drawing;
31 using System.ComponentModel;
32
33 namespace System.Windows.Forms
34 {
35         public class SystemInformation
36         {
37                 private SystemInformation ()
38                 {
39                 }
40
41 #if NET_2_0
42                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
43                 public static int ActiveWindowTrackingDelay { get { return XplatUI.ActiveWindowTrackingDelay; } }
44 #endif
45
46                 public static ArrangeDirection ArrangeDirection {
47                         get {
48                                 return ThemeEngine.Current.ArrangeDirection;
49                         }
50                 }
51
52                 public static ArrangeStartingPosition ArrangeStartingPosition {
53                         get {
54                                 return ThemeEngine.Current.ArrangeStartingPosition;
55                         }
56                 }
57
58                 public static BootMode BootMode {
59                         get {
60                                 return BootMode.Normal;
61                         }
62                 }
63
64                 public static Size Border3DSize {
65                         get {
66                                 return ThemeEngine.Current.Border3DSize;
67                         }
68                 }
69                 
70 #if NET_2_0
71                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
72                 public static int BorderMultiplierFactor { get { return ThemeEngine.Current.BorderMultiplierFactor; } }
73 #endif
74
75                 public static Size BorderSize {
76                         get {
77                                 return ThemeEngine.Current.BorderSize;
78                         }
79                 }
80
81                 public static Size CaptionButtonSize {
82                         get {
83                                 return ThemeEngine.Current.CaptionButtonSize;
84                         }
85                 }
86
87                 public static int CaptionHeight {
88                         get {
89                                 return ThemeEngine.Current.CaptionHeight;
90                         }
91                 }
92
93 #if NET_2_0
94                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
95                 public static int CaretBlinkTime { get { return XplatUI.CaretBlinkTime; } }
96                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
97                 public static int CaretWidth { get { return XplatUI.CaretWidth; } }
98 #endif
99
100                 public static string ComputerName {
101                         get {
102                                 return Environment.MachineName;
103                         }
104                 }
105
106                 public static Size CursorSize {
107                         get {
108                                 return XplatUI.CursorSize;
109                         }
110                 }
111
112                 public static bool DbcsEnabled {
113                         get {
114                                 return false;
115                         }
116                 }
117
118                 public static bool DebugOS {
119                         get {
120                                 return false;
121                         }
122                 }
123
124                 public static Size DoubleClickSize {
125                         get {
126                                 return ThemeEngine.Current.DoubleClickSize;
127                         }
128                 }
129
130                 public static int DoubleClickTime {
131                         get {
132                                 return ThemeEngine.Current.DoubleClickTime;
133                         }
134                 }
135
136                 public static bool DragFullWindows {
137                         get {
138                                 return XplatUI.DragFullWindows;
139                         }
140                 }
141
142                 public static Size DragSize {
143                         get {
144                                 return XplatUI.DragSize;
145                         }
146                 }
147
148                 public static Size FixedFrameBorderSize {
149                         get {
150                                 return ThemeEngine.Current.FixedFrameBorderSize;
151                         }
152                 }
153
154 #if NET_2_0
155                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
156                 public static int FontSmoothingContrast { get { return XplatUI.FontSmoothingContrast; } }
157                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
158                 public static int FontSmoothingType { get { return XplatUI.FontSmoothingType; } }
159 #endif
160
161                 public static Size FrameBorderSize {
162                         get {
163                                 return ThemeEngine.Current.FrameBorderSize;
164                         }
165                 }
166
167                 public static bool HighContrast {
168                         get {
169                                 return false;
170                         }
171                 }
172
173 #if NET_2_0
174                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
175                 public static int HorizontalFocusThickness { get { return ThemeEngine.Current.HorizontalFocusThickness; } }
176                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
177                 public static int HorizontalResizeBorderThickness { get { return XplatUI.HorizontalResizeBorderThickness; } }
178 #endif
179
180                 public static int HorizontalScrollBarArrowWidth {
181                         get {
182                                 return ThemeEngine.Current.HorizontalScrollBarArrowWidth;
183                         }
184                 }
185
186                 public static int HorizontalScrollBarHeight {
187                         get {
188                                 return ThemeEngine.Current.HorizontalScrollBarHeight;
189                         }
190                 }
191
192                 public static int HorizontalScrollBarThumbWidth {
193                         get {
194                                 return ThemeEngine.Current.HorizontalScrollBarThumbWidth;
195                         }
196                 }
197
198                 public static Size IconSize {
199                         get {
200                                 return XplatUI.IconSize;
201                         }
202                 }
203
204 #if NET_2_0
205                 public static int IconHorizontalSpacing {
206                         get {
207                                 return IconSpacingSize.Width;
208                         }
209                 }
210
211                 public static int IconVerticalSpacing {
212                         get {
213                                 return IconSpacingSize.Height;
214                         }
215                 }
216 #endif
217
218                 public static Size IconSpacingSize {
219                         get {
220                                 return ThemeEngine.Current.IconSpacingSize;
221                         }
222                 }
223
224 #if NET_2_0
225                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
226                 public static bool IsActiveWindowTrackingEnabled {
227                         get { return XplatUI.IsActiveWindowTrackingEnabled; }
228                 }
229
230                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
231                 public static bool IsComboBoxAnimationEnabled {
232                         get { return XplatUI.IsComboBoxAnimationEnabled; }
233                 }
234
235                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
236                 public static bool IsDropShadowEnabled {
237                         get { return XplatUI.IsDropShadowEnabled; }
238                 }
239
240                 public static bool IsFlatMenuEnabled {
241                         get { return false; }
242                 }
243
244                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
245                 public static bool IsFontSmoothingEnabled {
246                         get { return XplatUI.IsFontSmoothingEnabled; }
247                 }
248
249                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
250                 public static bool IsHotTrackingEnabled {
251                         get { return XplatUI.IsHotTrackingEnabled; }
252                 }
253
254                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
255                 public static bool IsIconTitleWrappingEnabled {
256                         get { return XplatUI.IsIconTitleWrappingEnabled; }
257                 }
258
259                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
260                 public static bool IsKeyboardPreferred {
261                         get { return XplatUI.IsKeyboardPreferred; }
262                 }
263
264                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
265                 public static bool IsListBoxSmoothScrollingEnabled {
266                         get { return XplatUI.IsListBoxSmoothScrollingEnabled; }
267                 }
268
269                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
270                 public static bool IsMenuAnimationEnabled {
271                         get { return XplatUI.IsMenuAnimationEnabled; }
272                 }
273
274                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
275                 public static bool IsMenuFadeEnabled {
276                         get { return XplatUI.IsMenuFadeEnabled; }
277                 }
278
279                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
280                 public static bool IsMinimizeRestoreAnimationEnabled {
281                         get { return XplatUI.IsMinimizeRestoreAnimationEnabled; }
282                 }
283
284                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
285                 public static bool IsSelectionFadeEnabled {
286                         get { return XplatUI.IsSelectionFadeEnabled; }
287                 }
288
289                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
290                 public static bool IsSnapToDefaultEnabled {
291                         get { return XplatUI.IsSnapToDefaultEnabled; }
292                 }
293
294                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
295                 public static bool IsTitleBarGradientEnabled {
296                         get { return XplatUI.IsTitleBarGradientEnabled; }
297                 }
298
299                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
300                 public static bool IsToolTipAnimationEnabled {
301                         get { return XplatUI.IsToolTipAnimationEnabled; }
302                 }
303 #endif
304
305                 public static int KanjiWindowHeight {
306                         get {
307                                 return 0;
308                         }
309                 }
310
311 #if NET_2_0
312                 public
313 #else
314                 internal
315 #endif
316                 static int KeyboardDelay {
317                         get {
318                                 return XplatUI.KeyboardDelay;
319                         }
320                 }
321
322 #if NET_2_0
323                 public
324 #else
325                 internal
326 #endif
327                 static int KeyboardSpeed {
328                         get {
329                                 return XplatUI.KeyboardSpeed;
330                         }
331                 }
332
333                 public static Size MaxWindowTrackSize {
334                         get {
335                                 return XplatUI.MaxWindowTrackSize;
336                         }
337                 }
338
339 #if NET_2_0
340                 public
341 #else
342                 internal
343 #endif
344                 static bool MenuAccessKeysUnderlined {
345                         get {
346                                 return ThemeEngine.Current.MenuAccessKeysUnderlined;
347                         }
348                 }
349
350 #if NET_2_0
351                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
352                 public static Size MenuBarButtonSize {
353                         get { return ThemeEngine.Current.MenuBarButtonSize; }
354                 }
355 #endif
356
357                 public static Size MenuButtonSize {
358                         get {
359                                 return ThemeEngine.Current.MenuButtonSize;
360                         }
361                 }
362
363                 public static Size MenuCheckSize {
364                         get {
365                                 return ThemeEngine.Current.MenuCheckSize;
366                         }
367                 }
368
369                 public static Font MenuFont {
370                         get {
371                                 // note: we MUST return a clone of the Font instance as anyone
372                                 // can dispose it. However we shouldn't expect the theme to do
373                                 // the cloning for performance reason
374                                 return (Font) ThemeEngine.Current.MenuFont.Clone ();
375                         }
376                 }
377
378                 public static int MenuHeight {
379                         get {
380                                 return ThemeEngine.Current.MenuHeight;
381                         }
382                 }
383
384 #if NET_2_0
385                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
386                 public static int MenuShowDelay { get { return XplatUI.MenuShowDelay; } }
387 #endif
388
389                 public static bool MidEastEnabled {
390                         get {
391                                 return false; // ??? how do we decide?
392                         }
393                 }
394
395                 public static Size MinimizedWindowSize {
396                         get {
397                                 return XplatUI.MinimizedWindowSize;
398                         }
399                 }
400
401                 public static Size MinimizedWindowSpacingSize {
402                         get {
403                                 return XplatUI.MinimizedWindowSpacingSize;
404                         }
405                 }
406
407                 public static Size MinimumWindowSize {
408                         get {
409                                 return XplatUI.MinimumWindowSize;
410                         }
411                 }
412
413                 public static Size MinWindowTrackSize {
414                         get {
415                                 return XplatUI.MinWindowTrackSize;
416                         }
417                 }
418
419                 public static int MonitorCount {
420                         get {
421                                 return 1;               // Why bother...
422                         }
423                 }
424
425                 public static bool MonitorsSameDisplayFormat {
426                         get {
427                                 return true;
428                         }
429                 }
430
431                 public static int MouseButtons {
432                         get {
433                                 return XplatUI.MouseButtonCount;
434                         }
435                 }
436
437                 public static bool MouseButtonsSwapped {
438                         get {
439                                 return XplatUI.MouseButtonsSwapped;
440                         }
441                 }
442
443 #if NET_2_0
444                 public static Size MouseHoverSize {
445                         get {
446                                 return XplatUI.MouseHoverSize;
447                         }
448                 }
449
450                 public static int MouseHoverTime {
451                         get {
452                                 return XplatUI.MouseHoverTime;
453                         }
454                 }
455
456                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
457                 public static int MouseSpeed {
458                         get { return XplatUI.MouseSpeed; }
459                 }
460                 
461                 public static int MouseWheelScrollDelta {
462                         get {
463                                 return XplatUI.MouseWheelScrollDelta;
464                         }
465                 }
466
467                 [EditorBrowsable (EditorBrowsableState.Never)]          
468 #endif
469                 public static bool MousePresent {
470                         get {
471                                 return true;
472                         }
473                 }
474
475                 public static bool MouseWheelPresent {
476                         get {
477                                 return XplatUI.MouseWheelPresent;
478                         }
479                 }
480
481                 public static int MouseWheelScrollLines {
482                         get {
483                                 return ThemeEngine.Current.MouseWheelScrollLines;
484                         }
485                 }
486
487                 public static bool NativeMouseWheelSupport {
488                         get {
489                                 return MouseWheelPresent;
490                         }
491                 }
492
493                 public static bool Network {
494                         get {
495                                 return true;
496                         }
497                 }
498
499                 public static bool PenWindows {
500                         get {
501                                 return false;
502                         }
503                 }
504
505 #if NET_2_0
506                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
507                 public static LeftRightAlignment PopupMenuAlignment {
508                         get { return XplatUI.PopupMenuAlignment; }
509                 }
510                 
511                 [MonoTODO ("Only implemented for Win32.")]
512                 public static PowerStatus PowerStatus {
513                         get { return XplatUI.PowerStatus; }
514                 }
515 #endif
516
517                 public static Size PrimaryMonitorMaximizedWindowSize {
518                         get {
519                                 return new Size(WorkingArea.Width, WorkingArea.Height);
520                         }
521                 }
522
523                 public static Size PrimaryMonitorSize {
524                         get {
525                                 return new Size(WorkingArea.Width, WorkingArea.Height);
526                         }
527                 }
528
529                 public static bool RightAlignedMenus {
530                         get {
531                                 return ThemeEngine.Current.RightAlignedMenus;
532                         }
533                 }
534
535 #if NET_2_0
536                 public static ScreenOrientation ScreenOrientation {
537                         get { return ScreenOrientation.Angle0; }
538                 }
539 #endif
540
541                 public static bool Secure {
542                         get {
543                                 return true;
544                         }
545                 }
546
547                 public static bool ShowSounds {
548                         get {
549                                 return false;
550                         }
551                 }
552
553 #if NET_2_0
554                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
555                 public static int SizingBorderWidth {
556                         get { return XplatUI.SizingBorderWidth; }
557                 }
558
559                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
560                 public static Size SmallCaptionButtonSize {
561                         get { return XplatUI.SmallCaptionButtonSize; }
562                 }
563 #endif
564
565                 public static Size SmallIconSize {
566                         get {
567                                 return XplatUI.SmallIconSize;
568                         }
569                 }
570
571 #if NET_2_0
572                 public static bool TerminalServerSession {
573                         get {
574                                 return false;
575                         }
576                 }
577 #endif
578
579                 public static Size ToolWindowCaptionButtonSize {
580                         get {
581                                 return ThemeEngine.Current.ToolWindowCaptionButtonSize;
582                         }
583                 }
584
585                 public static int ToolWindowCaptionHeight {
586                         get {
587                                 return ThemeEngine.Current.ToolWindowCaptionHeight;
588                         }
589                 }
590
591 #if NET_2_0
592                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
593                 public static bool UIEffectsEnabled {
594                         get { return XplatUI.UIEffectsEnabled; }
595                 }
596 #endif
597
598                 public static string UserDomainName {
599                         get {
600                                 return Environment.UserDomainName;
601                         }
602                 }
603
604                 public static bool UserInteractive {
605                         get {
606                                 return Environment.UserInteractive;
607                         }
608                 }
609
610                 public static string UserName {
611                         get {
612                                 return Environment.UserName;
613                         }
614                 }
615
616 #if NET_2_0
617                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
618                 public static int VerticalFocusThickness { get { return ThemeEngine.Current.VerticalFocusThickness; } }
619                 [MonoInternalNote ("Determine if we need an X11 implementation or if defaults are good.")]
620                 public static int VerticalResizeBorderThickness { get { return XplatUI.VerticalResizeBorderThickness; } }
621 #endif
622
623                 public static int VerticalScrollBarArrowHeight {
624                         get {
625                                 return ThemeEngine.Current.VerticalScrollBarArrowHeight;
626                         }
627                 }
628
629                 public static int VerticalScrollBarThumbHeight {
630                         get {
631                                 return ThemeEngine.Current.VerticalScrollBarThumbHeight;
632                         }
633                 }
634
635                 public static int VerticalScrollBarWidth {
636                         get {
637                                 return ThemeEngine.Current.VerticalScrollBarWidth;
638                         }
639                 }
640
641                 public static Rectangle VirtualScreen {
642                         get {
643                                 return XplatUI.VirtualScreen;
644                         }
645                 }
646
647                 public static Rectangle WorkingArea {
648                         get {
649                                 return XplatUI.WorkingArea;
650                         }
651                 }
652         }
653 }