sysmsg.pas 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. {
  2. $Id$
  3. Unit to handle system events
  4. Copyright 2000 by Pierre Muller <[email protected]>
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License as published by the Free Software Foundation; either
  8. version 2 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Library General Public License for more details.
  13. You should have received a copy of the GNU Library General Public
  14. License along with this library; if not, write to the Free
  15. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************}
  17. Unit sysmsg;
  18. interface
  19. type
  20. TSystemMessage = (
  21. SysNothing,
  22. SysSetFocus,
  23. SysReleaseFocus,
  24. SysClose,
  25. SysResize );
  26. TSystemEvent = Record
  27. case typ : TSystemMessage of
  28. SysClose : ( CloseTyp : Longint);
  29. SysResize : (X,Y : Longint);
  30. end;
  31. PSystemEvent = ^TSystemEvent;
  32. const
  33. SystemEventBufSize = 16;
  34. var
  35. PendingSystemEvent : array[0..SystemEventBufSize-1] of TSystemEvent;
  36. PendingSystemHead,
  37. PendingSystemTail : PSystemEvent;
  38. PendingSystemEvents : byte;
  39. LastSystemEvent : TSystemEvent;
  40. procedure InitSystemMsg;
  41. procedure DoneSystemMsg;
  42. procedure GetSystemEvent(var SystemEvent:TSystemEvent);
  43. { Returns the last SystemEvent, and waits for one if not available }
  44. procedure PutSystemEvent(const SystemEvent: TSystemEvent);
  45. { Adds the given SystemEvent to the input queue. }
  46. function PollSystemEvent(var SystemEvent: TSystemEvent):boolean;
  47. { Checks if a SystemEvent is available, and returns it if one is found. If no
  48. event is pending, it returns 0 }
  49. implementation
  50. {$undef HAS_SYSMSG}
  51. {$ifdef go32v2}
  52. {$i go32smsg.inc}
  53. {$define HAS_SYSMSG}
  54. {$endif go32v2}
  55. {$ifdef win32}
  56. {$i w32smsg.inc}
  57. {$define HAS_SYSMSG}
  58. {$endif win32}
  59. {$ifdef unix}
  60. {$i unixsmsg.inc}
  61. {$define HAS_SYSMSG}
  62. {$endif unix}
  63. {$ifdef HAS_SYSMSG}
  64. procedure PutSystemEvent(const SystemEvent: TSystemEvent);
  65. begin
  66. if PendingSystemEvents<SystemEventBufSize then
  67. begin
  68. PendingSystemTail^:=SystemEvent;
  69. inc(PendingSystemTail);
  70. if longint(PendingSystemTail)=longint(@PendingSystemEvent)+sizeof(PendingSystemEvent) then
  71. PendingSystemTail:=@PendingSystemEvent;
  72. inc(PendingSystemEvents);
  73. end;
  74. end;
  75. {$else HAS_SYSMSG}
  76. procedure InitSystemMsg;
  77. begin
  78. end;
  79. procedure DoneSystemMsg;
  80. begin
  81. end;
  82. procedure GetSystemEvent(var SystemEvent:TSystemEvent);
  83. begin
  84. FillChar(SystemEvent,SizeOf(SystemEvent),#0);
  85. end;
  86. function PollSystemEvent(var SystemEvent: TSystemEvent):boolean;
  87. begin
  88. FillChar(SystemEvent,SizeOf(SystemEvent),#0);
  89. PollSystemEvent:=false;
  90. end;
  91. procedure PutSystemEvent(const SystemEvent: TSystemEvent);
  92. begin
  93. end;
  94. {$endif not HAS_SYSMSG}
  95. end.
  96. {
  97. $Log$
  98. Revision 1.3 2004-11-06 17:08:48 peter
  99. * drawing of tview merged from old fv code
  100. }