home *** CD-ROM | disk | FTP | other *** search
- unit TabBox;
-
- interface
-
- uses
- Classes, Controls, Forms, Graphics, Menus, Messages, StdCtrls, SysUtils,
- WinTypes, WinProcs;
-
- const
- MIN_COL = 1;
-
- type
- TWidthCalc = (lbPixels, lbAverageChar, lbMaxChar);
-
- TTabComboBox = class(TCustomComboBox)
- private
- FTabs : PWordArray;
- FNumTabs : Integer;
- FCol : Integer;
- FColumns : Integer;
- FWidthCalc : TWidthCalc;
-
- procedure AllocTabs;
- procedure CMFontChanged(var Msg: TMessage); message CM_FONTCHANGED;
- procedure ConvertUnits(NewUnits : TWidthCalc);
- procedure FreeTabs;
- function GetAverageCharWidth: Double;
- function GetColWidth: Integer;
- function GetMaxCharWidth: Integer;
- procedure SetCol(AColumn : Integer);
- procedure SetColumns(AValue : Integer);
- procedure SetColWidth(AWidth : Integer);
- procedure SetWidthCalc(AMethod : TWidthCalc);
- procedure ReadWidths(Reader: TReader);
- procedure WriteWidths(Writer: TWriter);
-
- protected
- procedure DrawItem(Index: Integer;
- Rect: TRect;
- State: TOwnerDrawState); override;
- procedure DefineProperties(Filer: TFiler); override;
- procedure Loaded; override;
-
- public
- constructor Create(AOwner : TComponent); override;
- destructor Destroy; virtual;
-
- published
- property Color;
- property Ctl3D;
- property DragMode;
- property DragCursor;
- property DropDownCount;
- property Enabled;
- property Font;
- property ItemHeight;
- property Items;
- property MaxLength;
- property ParentColor;
- property ParentCtl3D;
- property ParentFont;
- property ParentShowHint;
- property PopupMenu;
- property ShowHint;
- property Sorted;
- property TabOrder;
- property TabStop;
- property Text;
- property Visible;
- property OnChange;
- property OnClick;
- property OnDblClick;
- property OnDragDrop;
- property OnDragOver;
- property OnDrawItem;
- property OnDropDown;
- property OnEndDrag;
- property OnEnter;
- property OnExit;
- property OnKeyDown;
- property OnKeyPress;
- property OnKeyUp;
- property OnMeasureItem;
-
- property Column: Integer read FCol write SetCol stored False;
- property Columns: Integer read FColumns write SetColumns default MIN_COL;
- property ColWidth: Integer read GetColWidth write SetColWidth stored False;
- property ColWidthCalc: TWidthCalc read FWidthCalc write SetWidthCalc;
- end;
-
- TTabListBox = Class(TCustomListBox)
- private
- FTabs : PWordArray;
- FNumTabs : Integer;
- FCol : Integer;
- FColumns : Integer;
- FWidthCalc : TWidthCalc;
-
- private
- procedure AllocTabs;
- procedure CMFontChanged(var Msg: TMessage); message CM_FONTCHANGED;
- procedure ConvertUnits(NewUnits : TWidthCalc);
- procedure FreeTabs;
- function GetColWidth: Integer;
- procedure SetCol(AColumn : Integer);
- procedure SetColumns(AValue : Integer);
- procedure SetColWidth(AWidth : Integer);
- procedure SetWidthCalc(AMethod : TWidthCalc);
- procedure ReadWidths(Reader: TReader);
- procedure WriteWidths(Writer: TWriter);
-
- protected
- procedure CreateParams(var Params : TCreateParams); override;
- procedure DrawItem(Index: Integer;
- Rect: TRect;
- State: TOwnerDrawState); override;
- procedure DefineProperties(Filer: TFiler); override;
- procedure Loaded; override;
-
- public
- constructor Create(AOwner : TComponent); override;
- destructor Destroy; virtual;
-
- function GetAverageCharWidth: Double;
- function GetMaxCharWidth: Integer;
-
- published
- property Align;
- property BorderStyle;
- property Color;
- {property Columns;}
- property Ctl3D;
- property DragCursor;
- property DragMode;
- property Enabled;
- property ExtendedSelect;
- property Font;
- property IntegralHeight;
- property ItemHeight;
- property Items;
- {property MultiSelect;}
- property ParentColor;
- property ParentCtl3D;
- property ParentFont;
- property ParentShowHint;
- property PopupMenu;
- property ShowHint;
- property Sorted;
- {property Style;}
- property TabOrder;
- property TabStop;
- property Visible;
- property OnClick;
- property OnDblClick;
- property OnDragDrop;
- property OnDragOver;
- {property OnDrawItem;}
- property OnEndDrag;
- property OnEnter;
- property OnExit;
- property OnKeyDown;
- property OnKeyPress;
- property OnKeyUp;
- property OnMeasureItem;
- property OnMouseDown;
- property OnMouseMove;
- property OnMouseUp;
-
- property Column: Integer read FCol write SetCol stored False;
- property Columns: Integer read FColumns write SetColumns default MIN_COL;
- property ColWidth: Integer read GetColWidth write SetColWidth stored False;
- property ColWidthCalc: TWidthCalc read FWidthCalc write SetWidthCalc;
- end;
-
-
- implementation
- end.