home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April A / Pcwk4a98.iso / PROGRAM / DELPHI16 / Calmira / Src / SRC / CALFORM.PAS < prev    next >
Pascal/Delphi Source File  |  1997-02-15  |  3KB  |  87 lines

  1. {**************************************************************************}
  2. {                                                                          }
  3. {    Calmira shell for Microsoft« Windows(TM) 3.1                          }
  4. {    Source Release 1.0                                                    }
  5. {    Copyright (C) 1997  Li-Hsin Huang                                     }
  6. {                                                                          }
  7. {    This program is free software; you can redistribute it and/or modify  }
  8. {    it under the terms of the GNU General Public License as published by  }
  9. {    the Free Software Foundation; either version 2 of the License, or     }
  10. {    (at your option) any later version.                                   }
  11. {                                                                          }
  12. {    This program is distributed in the hope that it will be useful,       }
  13. {    but WITHOUT ANY WARRANTY; without even the implied warranty of        }
  14. {    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         }
  15. {    GNU General Public License for more details.                          }
  16. {                                                                          }
  17. {    You should have received a copy of the GNU General Public License     }
  18. {    along with this program; if not, write to the Free Software           }
  19. {    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             }
  20. {                                                                          }
  21. {**************************************************************************}
  22.  
  23. unit CalForm;
  24.  
  25. { TCalForm is the common ancestor of most of Calmira's modeless windows,
  26.   and you should use it for other modeless windows that you add.  The
  27.   main feature is the use of WMSettingsChanged to trigger the
  28.   SettingsChanged method.  Descendants override this to adjust their
  29.   properties depending on which settings have been modified.
  30.  
  31.   WM_NCRBUTTONDOWN is intercepted to popup the list of open windows or
  32.   close the form when the user right clicks on a minimize/maximize
  33.   button.
  34.  
  35.   Finally, ShowNormal is provided to make it easier to display a
  36.   window, whatever state it is in.
  37. }
  38.  
  39. interface
  40.  
  41. uses ExtForm, Messages, Classes, FormDrag, CalMsgs, Settings;
  42.  
  43. type
  44.  
  45. TCalForm = class(TExtForm)
  46. private
  47.   procedure WMNCRButtonDown(var Msg: TWMNCRButtonDown); message WM_NCRBUTTONDOWN;
  48.   procedure WMSettingsChanged(var Msg: TMessage); message WM_SETTINGSCHANGED;
  49. public
  50.   procedure SettingsChanged(Changes : TSettingChanges); virtual;
  51.   procedure ShowNormal;
  52. end;
  53.  
  54. implementation
  55.  
  56. uses Forms, Desk, WinProcs, WinTypes, MiscUtil;
  57.  
  58. procedure TCalForm.WMNCRButtonDown(var Msg: TWMNCRButtonDown);
  59. begin
  60.   if WindowState <> wsMinimized then
  61.   with Msg do
  62.     case HitTest of
  63.       HTCAPTION : Desktop.WindowMenu.Popup(XCursor, YCursor);
  64.       HTMAXBUTTON : Close;
  65.       HTMINBUTTON : Close;
  66.       else inherited;
  67.     end
  68.   else inherited;
  69. end;
  70.  
  71. procedure TCalForm.WMSettingsChanged(var Msg: TMessage);
  72. begin
  73.   SettingsChanged(TSettingChanges(Msg.wParam));
  74. end;
  75.  
  76. procedure TCalForm.SettingsChanged(Changes : TSettingChanges);
  77. begin
  78. end;
  79.  
  80. procedure TCalForm.ShowNormal;
  81. begin
  82.   WindowState := wsNormal;
  83.   Show;
  84. end;
  85.  
  86. end.
  87.