XplatUIDriver.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 Novell, Inc.
  21. //
  22. // Authors:
  23. // Peter Bartok [email protected]
  24. //
  25. //
  26. // $Revision: 1.7 $
  27. // $Modtime: $
  28. // $Log: XplatUIDriver.cs,v $
  29. // Revision 1.7 2004/08/10 17:39:22 pbartok
  30. // - Added GetWindowPos method
  31. //
  32. // Revision 1.6 2004/08/10 14:34:15 jackson
  33. // Use default colors from the theme
  34. //
  35. // Revision 1.5 2004/08/09 20:55:59 pbartok
  36. // - Removed Run method, was only required for initial development
  37. //
  38. // Revision 1.4 2004/08/09 20:51:25 pbartok
  39. // - Implemented GrabWindow/ReleaseWindow methods to allow pointer capture
  40. //
  41. // Revision 1.3 2004/08/04 20:11:24 pbartok
  42. // - Added Invalidate handling
  43. //
  44. // Revision 1.2 2004/08/03 23:09:02 jordi
  45. // fixes spelling mistake
  46. //
  47. // Revision 1.1 2004/07/09 05:21:25 pbartok
  48. // - Initial check-in
  49. //
  50. //
  51. // COMPLETE
  52. using System.Drawing;
  53. namespace System.Windows.Forms {
  54. public abstract class XplatUIDriver {
  55. internal abstract IntPtr InitializeDriver();
  56. internal abstract void ShutdownDriver(IntPtr token);
  57. internal delegate IntPtr WndProc(IntPtr hwnd, Msg msg, IntPtr wParam, IntPtr lParam);
  58. #region XplatUI Driver Properties
  59. internal virtual Color ForeColor {
  60. get {
  61. return ThemeEngine.Current.DefaultWindowForeColor;
  62. }
  63. }
  64. internal virtual Color BackColor {
  65. get {
  66. return ThemeEngine.Current.DefaultWindowBackColor;
  67. }
  68. }
  69. internal virtual Font Font {
  70. get {
  71. return ThemeEngine.Current.DefaultFont;
  72. }
  73. }
  74. internal virtual Keys ModifierKeys {
  75. get {
  76. return Keys.None;
  77. }
  78. }
  79. internal virtual MouseButtons MouseButtons {
  80. get {
  81. return MouseButtons.None;
  82. }
  83. }
  84. internal virtual Point MousePosition {
  85. get {
  86. return Point.Empty;
  87. }
  88. }
  89. internal virtual bool DropTarget {
  90. get {
  91. return false;
  92. }
  93. set {
  94. }
  95. }
  96. #endregion // XplatUI Driver Properties
  97. #region XplatUI Driver Methods
  98. internal abstract void Exit();
  99. internal abstract IntPtr CreateWindow(CreateParams cp);
  100. internal abstract IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height);
  101. internal abstract void DestroyWindow(IntPtr handle);
  102. internal abstract bool Text(IntPtr handle, string text);
  103. internal abstract bool SetVisible(IntPtr handle, bool visible);
  104. internal abstract bool IsVisible(IntPtr handle);
  105. internal abstract IntPtr SetParent(IntPtr handle, IntPtr parent);
  106. internal abstract IntPtr GetParent(IntPtr handle);
  107. internal abstract void RefreshWindow(IntPtr handle);
  108. internal abstract PaintEventArgs PaintEventStart(IntPtr handle);
  109. internal abstract void PaintEventEnd(IntPtr handle);
  110. internal abstract void SetWindowPos(IntPtr handle, int x, int y, int width, int height);
  111. internal abstract void GetWindowPos(IntPtr handle, out int x, out int y, out int width, out int height);
  112. internal abstract void Activate(IntPtr handle);
  113. internal abstract void Invalidate(IntPtr handle, Rectangle rc, bool clear);
  114. internal abstract IntPtr DefWndProc(ref Message msg);
  115. internal abstract void HandleException(Exception e);
  116. internal abstract void DoEvents();
  117. internal abstract bool PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags);
  118. internal abstract bool GetMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax);
  119. internal abstract bool TranslateMessage(ref MSG msg);
  120. internal abstract bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height);
  121. internal abstract bool DispatchMessage(ref MSG msg);
  122. internal abstract void GrabWindow(IntPtr hWnd);
  123. internal abstract void ReleaseWindow(IntPtr hWnd);
  124. #endregion // XplatUI Driver Methods
  125. }
  126. }