home *** CD-ROM | disk | FTP | other *** search
/ Freelog 11 / Freelog011.iso / BestOf / PhoenixMail / Source / phoenix / FMSelectMail.pas < prev    next >
Pascal/Delphi Source File  |  1999-02-05  |  5KB  |  167 lines

  1. {*****************************************************************************
  2.  *
  3.  *  FMSelectMail.pas - Select mails before download  (30-August-1998)
  4.  *
  5.  *  Copyright (c) 1998-99 Michael Haller
  6.  *
  7.  *  Author:     Michael Haller
  8.  *  E-mail:     michael@discountdrive.com
  9.  *  Homepage:   http://www.discountdrive.com/sunrise
  10.  *
  11.  *  This program is free software; you can redistribute it and/or
  12.  *  modify it under the terms of the GNU General Public License
  13.  *  as published by the Free Software Foundation;
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
  23.  *
  24.  *----------------------------------------------------------------------------
  25.  *
  26.  *  Revision history:
  27.  *
  28.  *     DATE     REV                 DESCRIPTION
  29.  *  ----------- --- ----------------------------------------------------------
  30.  *
  31.  *****************************************************************************}
  32.  
  33. unit FMSelectMail;
  34.  
  35. interface
  36.  
  37. uses
  38.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  39.   ExtCtrls, StdCtrls, ComCtrls, ImgList, EnhListView, ExtListView, Registry,
  40.   PXStuff, LangSup, IniFiles;
  41.  
  42. type
  43.   TSelectMailForm = class(TForm)
  44.     Button3: TButton;
  45.     Button5: TButton;
  46.     Button6: TButton;
  47.     ImageList1: TImageList;
  48.     Button1: TButton;
  49.     Notebook1: TNotebook;
  50.     ListView1: TExtListView;
  51.     Label4: TLabel;
  52.     Label7: TLabel;
  53.     Label5: TLabel;
  54.     Label6: TLabel;
  55.     Image1: TImage;
  56.     Image2: TImage;
  57.     Image3: TImage;
  58.     Image4: TImage;
  59.     Label2: TLabel;
  60.     Bevel2: TBevel;
  61.     Label1: TLabel;
  62.     Label8: TLabel;
  63.     Label10: TLabel;
  64.     Label9: TLabel;
  65.     Image5: TImage;
  66.     Label11: TLabel;
  67.     Bevel3: TBevel;
  68.     Label3: TLabel;
  69.     procedure ListView1MouseDown(Sender: TObject; Button: TMouseButton;
  70.       Shift: TShiftState; X, Y: Integer);
  71.     procedure FormCreate(Sender: TObject);
  72.     procedure FormDestroy(Sender: TObject);
  73.     procedure ListView1DrawHeader(Control: TWinControl;
  74.       var ACanvas: TCanvas; Index: Integer; var ARect: TRect;
  75.       Selected: Boolean; var DefaultDrawing: Boolean);
  76.     procedure Button1Click(Sender: TObject);
  77.     procedure Button6Click(Sender: TObject);
  78.   private
  79.     { Private declarations }
  80.   public
  81.     { Public declarations }
  82.   end;
  83.  
  84. var
  85.   SelectMailForm: TSelectMailForm;
  86.  
  87. implementation
  88.  
  89. uses
  90.   FMOnline, Main;
  91.  
  92. {$R *.DFM}
  93.  
  94. procedure TSelectMailForm.ListView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  95. var
  96.   Item: TListItem;
  97.   I: Integer;
  98. begin
  99.   if (X > 0) and (X < 18) then begin
  100.     Item := ListView1.GetItemAt(X, Y);
  101.     if Assigned(Item) then begin
  102.       I := Item.StateIndex;
  103.       Inc(I); if I > 3 then I := 0;
  104.       Item.StateIndex := I;
  105.     end;
  106.   end;
  107. end;
  108.  
  109. procedure TSelectMailForm.FormCreate(Sender: TObject);
  110. var
  111.   IniFile: TIniFile;
  112. begin
  113.   AttachLanguageToForm(Self);
  114.   if bOfficeFonts then Font.Name := sOfficeFontName;
  115.   Button1.Caption := Label9.Caption;
  116.   //ListView
  117.   if MainForm.CheckBox1.Checked then begin
  118.     ListView1.AutoSortStyle := assSmart;
  119.   end;
  120.   IniFile := TIniFile.Create(sSettingsFile);
  121.   ListView1.ReadSettingsFromIniFile('NewMailList', IniFile);
  122.   IniFile.Free;
  123.   //Resources
  124.   ImageList1.ResourceLoad(rtBitmap, 'PX501', clFuchsia);
  125.   //Size
  126.   ListView1.Width := NoteBook1.Width-(ListView1.Left*2);
  127.   ListView1.Height := NoteBook1.Height-(ListView1.Top*2)-9;
  128. end;
  129.  
  130. procedure TSelectMailForm.FormDestroy(Sender: TObject);
  131. var
  132.   IniFile: TIniFile;
  133. begin
  134.   IniFile := TIniFile.Create(sSettingsFile);
  135.   ListView1.WriteSettingsToIniFile('NewMailList', IniFile);
  136.   IniFile.Free;
  137. end;
  138.  
  139. procedure TSelectMailForm.ListView1DrawHeader(Control: TWinControl;
  140.   var ACanvas: TCanvas; Index: Integer; var ARect: TRect;
  141.   Selected: Boolean; var DefaultDrawing: Boolean);
  142. begin
  143.   if Index = 0 then begin
  144.     DefaultDrawing := False;
  145.     ACanvas.BrushCopy(Rect(ARect.Left+2, ARect.Top, ARect.Left+18, ARect.Top+16), Image5.Picture.Bitmap, Rect(0, 0, 16, 16), clFuchsia);
  146.   end else
  147.     DefaultDrawing := True;
  148. end;
  149.  
  150. procedure TSelectMailForm.Button1Click(Sender: TObject);
  151. begin
  152.   if NoteBook1.ActivePage = 'Legend' then begin
  153.     NoteBook1.ActivePage := 'Mails';
  154.     Button1.Caption := Label9.Caption;
  155.   end else begin
  156.     NoteBook1.ActivePage := 'Legend';
  157.     Button1.Caption := Label10.Caption;
  158.   end;
  159. end;
  160.  
  161. procedure TSelectMailForm.Button6Click(Sender: TObject);
  162. begin
  163.   Application.HelpContext(5);
  164. end;
  165.  
  166. end.
  167.