home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April A / Pcwk4a98.iso / PROGRAM / DELPHI16 / Calmira / Src / SRC / TASKPROP.PAS < prev    next >
Pascal/Delphi Source File  |  1997-02-15  |  4KB  |  134 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 Taskprop;
  24.  
  25. interface
  26.  
  27. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  28.   StdCtrls, Chklist, TabNotBk, ExtCtrls, Spin, StylSped;
  29.  
  30. type
  31.   TTaskPropDlg = class(TForm)
  32.     OKBtn: TBitBtn;
  33.     CancelBtn: TBitBtn;
  34.     Notebook: TTabbedNotebook;
  35.     CheckList: TCheckList;
  36.     ExcludeList: TListBox;
  37.     Header: THeader;
  38.     Label1: TLabel;
  39.     AddBtn: TStyleSpeed;
  40.     RemoveBtn: TStyleSpeed;
  41.     RefreshEdit: TSpinEdit;
  42.     Label2: TLabel;
  43.     Bevel1: TBevel;
  44.     HelpBtn: TBitBtn;
  45.     procedure FormCreate(Sender: TObject);
  46.     procedure OKBtnClick(Sender: TObject);
  47.     procedure ExcludeListDrawItem(Control: TWinControl; Index: Integer;
  48.       Rect: TRect; State: TOwnerDrawState);
  49.     procedure AddBtnClick(Sender: TObject);
  50.     procedure RemoveBtnClick(Sender: TObject);
  51.   private
  52.     { Private declarations }
  53.   public
  54.     { Public declarations }
  55.   end;
  56.  
  57. {
  58. var
  59.   TaskPropDlg: TTaskPropDlg;
  60. }
  61.  
  62.  
  63. implementation
  64.  
  65. {$R *.DFM}
  66.  
  67. uses Settings, CalMsgs, Strings, Dialogs;
  68.  
  69. procedure TTaskPropDlg.FormCreate(Sender: TObject);
  70. begin
  71.   Notebook.PageIndex := 0;
  72.  
  73.   CheckList.SetData(
  74.     [StayVisible, Highlight, ShrinkMax,
  75.      Clock24, PopupRes, PopupDate,
  76.      Animate, ButtonHints, ArrangeMin,
  77.      HideMinApps, IconWindowTask, ExplorerTask,
  78.      FullFolderPath, CalIcons, DocNameFirst,
  79.      DocNameLower]);
  80.  
  81.   ini.ReadStrings('Exclude', ExcludeList.Items);
  82.   RefreshEdit.Value := ini.ReadInteger('Taskbar', 'Refresh', 5);
  83. end;
  84.  
  85. procedure TTaskPropDlg.OKBtnClick(Sender: TObject);
  86. begin
  87.   CheckList.GetData(
  88.     [@StayVisible, @Highlight, @ShrinkMax,
  89.      @Clock24, @PopupRes, @PopupDate,
  90.      @Animate, @ButtonHints, @ArrangeMin,
  91.      @HideMinApps, @IconWindowTask, @ExplorerTask,
  92.      @FullFolderPath, @CalIcons, @DocNameFirst,
  93.      @DocNameLower]);
  94.  
  95.   SaveTaskProp;
  96.   ini.WriteStrings('Exclude', ExcludeList.Items);
  97.   ini.WriteInteger('Taskbar', 'Refresh', RefreshEdit.Value);
  98.  
  99.   AnnounceSettingsChanged([scTaskbar]);
  100. end;
  101.  
  102.  
  103. procedure TTaskPropDlg.ExcludeListDrawItem(Control: TWinControl;
  104.   Index: Integer; Rect: TRect; State: TOwnerDrawState);
  105. var
  106.   m, c : string[79];
  107. begin
  108.   with ExcludeList do begin
  109.     m := '';
  110.     c := '';
  111.     Unformat(Items[Index], '%s %s', [@m, 79, @c, 79]);
  112.     Canvas.FillRect(Rect);
  113.     Canvas.TextOut(Rect.Left+2, Rect.Top+1, m);
  114.     Canvas.TextOut(Header.SectionWidth[0], Rect.Top+1, c);
  115.   end;
  116. end;
  117.  
  118.  
  119. procedure TTaskPropDlg.AddBtnClick(Sender: TObject);
  120. var s: string;
  121. begin
  122.   s := '';
  123.   if InputQuery('Add taskbar exclusion', 'Module [classname]', s) and
  124.     (s > '') then ExcludeList.Items.Add(s);
  125. end;
  126.  
  127. procedure TTaskPropDlg.RemoveBtnClick(Sender: TObject);
  128. begin
  129.   with ExcludeList do
  130.     if ItemIndex <> -1 then Items.Delete(ItemIndex);
  131. end;
  132.  
  133. end.
  134.