summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-06-26 17:15:10 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-06-26 17:15:10 +0000
commit328be13f54585df2851894ef8f81358fdc27c5cb (patch)
tree007bf6f287f5068c7d08d499c1d0ae2e320db384 /src/gui
parentfe6c14c887387533ea55c123229ab2e5889f381c (diff)
downloadfpGUI-328be13f54585df2851894ef8f81358fdc27c5cb.tar.xz
* More code clean up.
* Renamed some classes to have consistent naming convention. * Created some Base classes to create custom components from.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui_combobox.pas44
-rw-r--r--src/gui/gui_edit.pas98
-rw-r--r--src/gui/gui_editcombo.pas44
-rw-r--r--src/gui/gui_form.pas99
-rw-r--r--src/gui/gui_popupcalendar.pas2
5 files changed, 150 insertions, 137 deletions
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas
index 6840882e..4737ced2 100644
--- a/src/gui/gui_combobox.pas
+++ b/src/gui/gui_combobox.pas
@@ -104,7 +104,7 @@ type
end;
- TfpgAbstractComboBox = class(TfpgBaseComboBox)
+ TfpgBaseStaticCombo = class(TfpgBaseComboBox)
private
procedure InternalBtnClick(Sender: TObject);
protected
@@ -130,7 +130,7 @@ type
end;
- TfpgComboBox = class(TfpgAbstractComboBox)
+ TfpgComboBox = class(TfpgBaseStaticCombo)
published
property BackgroundColor default clBoxColor;
property DropDownCount;
@@ -166,7 +166,7 @@ type
{ This is the class representing the dropdown window of the combo box. }
TComboboxDropdownWindow = class(TfpgPopupWindow)
private
- FCallerWidget: TfpgAbstractComboBox;
+ FCallerWidget: TfpgBaseStaticCombo;
FListBox: TfpgListBox;
procedure SetFirstItem;
protected
@@ -174,7 +174,7 @@ type
procedure HandleShow; override;
procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
public
- constructor Create(AOwner: TComponent; ACallerWidget: TfpgAbstractComboBox); reintroduce;
+ constructor Create(AOwner: TComponent; ACallerWidget: TfpgBaseStaticCombo); reintroduce;
property ListBox: TfpgListBox read FListBox;
end;
@@ -420,7 +420,7 @@ begin
end
end;
-constructor TComboboxDropdownWindow.Create(AOwner: TComponent; ACallerWidget: TfpgAbstractComboBox);
+constructor TComboboxDropdownWindow.Create(AOwner: TComponent; ACallerWidget: TfpgBaseStaticCombo);
begin
inherited Create(nil);
Name := '_ComboboxDropdownWindow';
@@ -455,9 +455,9 @@ begin
Result.Items.Assign(AList);
end;
-{ TfpgAbstractComboBox }
+{ TfpgBaseStaticCombo }
-function TfpgAbstractComboBox.GetText: string;
+function TfpgBaseStaticCombo.GetText: string;
begin
if (FocusItem >= 0) and (FocusItem < FItems.Count) then
Result := Items.Strings[FocusItem]
@@ -465,12 +465,12 @@ begin
Result := '';
end;
-function TfpgAbstractComboBox.HasText: boolean;
+function TfpgBaseStaticCombo.HasText: boolean;
begin
Result := FocusItem >= 0;
end;
-procedure TfpgAbstractComboBox.DoDropDown;
+procedure TfpgBaseStaticCombo.DoDropDown;
var
ddw: TComboboxDropdownWindow;
rowcount: integer;
@@ -521,12 +521,12 @@ begin
end;
end;
-procedure TfpgAbstractComboBox.InternalBtnClick(Sender: TObject);
+procedure TfpgBaseStaticCombo.InternalBtnClick(Sender: TObject);
begin
DoDropDown;
end;
-procedure TfpgAbstractComboBox.SetText(const AValue: string);
+procedure TfpgBaseStaticCombo.SetText(const AValue: string);
var
i: integer;
begin
@@ -547,28 +547,28 @@ begin
end;
end;
-procedure TfpgAbstractComboBox.SetWidth(const AValue: TfpgCoord);
+procedure TfpgBaseStaticCombo.SetWidth(const AValue: TfpgCoord);
begin
inherited SetWidth(AValue);
CalculateInternalButtonRect;
RePaint;
end;
-procedure TfpgAbstractComboBox.HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean);
+procedure TfpgBaseStaticCombo.HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean);
begin
inherited HandleKeyPress(keycode, shiftstate, consumed);
if consumed then
RePaint
end;
-procedure TfpgAbstractComboBox.SetHeight(const AValue: TfpgCoord);
+procedure TfpgBaseStaticCombo.SetHeight(const AValue: TfpgCoord);
begin
inherited SetHeight(AValue);
CalculateInternalButtonRect;
RePaint;
end;
-procedure TfpgAbstractComboBox.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
+procedure TfpgBaseStaticCombo.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
begin
inherited HandleLMouseDown(x, y, shiftstate);
// button state is down only if user clicked in the button rectangle.
@@ -577,14 +577,14 @@ begin
DoDropDown;
end;
-procedure TfpgAbstractComboBox.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
+procedure TfpgBaseStaticCombo.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
begin
inherited HandleLMouseUp(x, y, shiftstate);
FBtnPressed := False;
PaintInternalButton;
end;
-procedure TfpgAbstractComboBox.HandleMouseScroll(x, y: integer;
+procedure TfpgBaseStaticCombo.HandleMouseScroll(x, y: integer;
shiftstate: TShiftState; delta: smallint);
var
NewIndex: Integer;
@@ -609,13 +609,13 @@ begin
end;
end;
-procedure TfpgAbstractComboBox.HandleResize(awidth, aheight: TfpgCoord);
+procedure TfpgBaseStaticCombo.HandleResize(awidth, aheight: TfpgCoord);
begin
inherited HandleResize(awidth, aheight);
CalculateInternalButtonRect;
end;
-procedure TfpgAbstractComboBox.HandlePaint;
+procedure TfpgBaseStaticCombo.HandlePaint;
var
r: TfpgRect;
begin
@@ -663,7 +663,7 @@ begin
fpgStyle.DrawString(Canvas, FMargin+1, FMargin, Text, Enabled);
end;
-constructor TfpgAbstractComboBox.Create(AOwner: TComponent);
+constructor TfpgBaseStaticCombo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FBackgroundColor := clBoxColor;
@@ -676,13 +676,13 @@ begin
CalculateInternalButtonRect;
end;
-destructor TfpgAbstractComboBox.Destroy;
+destructor TfpgBaseStaticCombo.Destroy;
begin
FDropDown.Free;
inherited Destroy;
end;
-procedure TfpgAbstractComboBox.Update;
+procedure TfpgBaseStaticCombo.Update;
begin
FFocusItem := -1;
Repaint;
diff --git a/src/gui/gui_edit.pas b/src/gui/gui_edit.pas
index 166e5e80..ce9a9f64 100644
--- a/src/gui/gui_edit.pas
+++ b/src/gui/gui_edit.pas
@@ -33,7 +33,7 @@ type
TfpgEditBorderStyle = (ebsNone, ebsDefault, ebsSingle);
- TfpgCustomEdit = class(TfpgWidget)
+ TfpgBaseEdit = class(TfpgWidget)
private
FAutoSelect: Boolean;
FHideSelection: Boolean;
@@ -115,7 +115,7 @@ type
end;
- TfpgEdit = class(TfpgCustomEdit)
+ TfpgEdit = class(TfpgBaseEdit)
public
property Font;
property PopupMenu; // UI Designer doesn't fully support it yet
@@ -140,7 +140,7 @@ type
end;
- TfpgBaseNumericEdit = class(TfpgCustomEdit)
+ TfpgBaseNumericEdit = class(TfpgBaseEdit)
private
fOldColor: TfpgColor;
fAlignment: TAlignment;
@@ -186,8 +186,6 @@ type
end;
- { TfpgEditInteger }
-
TfpgEditInteger = class(TfpgBaseNumericEdit)
protected
function GetValue: integer; virtual;
@@ -201,8 +199,6 @@ type
end;
- { TfpgEditFloat }
-
TfpgEditFloat = class(TfpgBaseNumericEdit)
protected
function GetValue: extended; virtual;
@@ -246,15 +242,15 @@ begin
Result.Height:= h;
end;
-{ TfpgCustomEdit }
+{ TfpgBaseEdit }
-procedure TfpgCustomEdit.Adjust(UsePxCursorPos: boolean = false);
+procedure TfpgBaseEdit.Adjust(UsePxCursorPos: boolean = false);
begin
AdjustTextOffset(False);
AdjustDrawingInfo;
end;
-procedure TfpgCustomEdit.AdjustTextOffset(UsePxCursorPos: boolean);
+procedure TfpgBaseEdit.AdjustTextOffset(UsePxCursorPos: boolean);
{If UsePxCursorPos then determines FCursorPos from FCursorPx (that holds mouse pointer coordinates)
Calculates exact FCursorPx (relative to the widget bounding box) from FCursorPos
Calculates FTextOffset based on FCursorPx}
@@ -322,7 +318,7 @@ begin
FCursorPx := tw - FTextOffset + FSideMargin;
end;
-procedure TfpgCustomEdit.AdjustDrawingInfo;
+procedure TfpgBaseEdit.AdjustDrawingInfo;
// Calculates FVisSelStartPx, FVisSelEndPx, FVisibleText, FDrawOffset
var
// fvc, lvc: integer; // first/last visible characters
@@ -406,7 +402,7 @@ begin
FDrawOffset := FTextOffset - FDrawOffset;
end;
-{function TfpgCustomEdit.PointToCharPos(x, y: integer): integer;
+{function TfpgBaseEdit.PointToCharPos(x, y: integer): integer;
var
n: integer;
cx: integer; // character X position
@@ -442,7 +438,7 @@ begin
end;
end;}
-procedure TfpgCustomEdit.SetBorderStyle(const AValue: TfpgEditBorderStyle);
+procedure TfpgBaseEdit.SetBorderStyle(const AValue: TfpgEditBorderStyle);
begin
if FBorderStyle = AValue then
Exit; //==>
@@ -450,14 +446,14 @@ begin
RePaint;
end;
-procedure TfpgCustomEdit.SetHideSelection(const AValue: Boolean);
+procedure TfpgBaseEdit.SetHideSelection(const AValue: Boolean);
begin
if FHideSelection = AValue then
Exit;
FHideSelection := AValue;
end;
-procedure TfpgCustomEdit.HandlePaint;
+procedure TfpgBaseEdit.HandlePaint;
var
r: TfpgRect;
tw, tw2, st, len: integer;
@@ -541,13 +537,13 @@ begin
end;
end;
-procedure TfpgCustomEdit.HandleResize(awidth, aheight: TfpgCoord);
+procedure TfpgBaseEdit.HandleResize(awidth, aheight: TfpgCoord);
begin
inherited HandleResize(awidth, aheight);
AdjustDrawingInfo;
end;
-procedure TfpgCustomEdit.HandleKeyChar(var AText: TfpgChar;
+procedure TfpgBaseEdit.HandleKeyChar(var AText: TfpgChar;
var shiftstate: TShiftState; var consumed: Boolean);
var
s: TfpgChar;
@@ -583,7 +579,7 @@ begin
inherited HandleKeyChar(AText, shiftstate, consumed);
end;
-procedure TfpgCustomEdit.HandleKeyPress(var keycode: word;
+procedure TfpgBaseEdit.HandleKeyPress(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
var
hasChanged: boolean;
@@ -726,7 +722,7 @@ begin
FOnChange(self);
end;
-procedure TfpgCustomEdit.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
+procedure TfpgBaseEdit.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
{var
cp: integer;}
begin
@@ -759,7 +755,7 @@ begin
RePaint;
end;
-procedure TfpgCustomEdit.HandleRMouseDown(x, y: integer; shiftstate: TShiftState);
+procedure TfpgBaseEdit.HandleRMouseDown(x, y: integer; shiftstate: TShiftState);
begin
inherited HandleRMouseDown(x, y, shiftstate);
if Assigned(PopupMenu) then
@@ -768,7 +764,7 @@ begin
ShowDefaultPopupMenu(x, y, ShiftState);
end;
-procedure TfpgCustomEdit.HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState);
+procedure TfpgBaseEdit.HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState);
var
cp: integer;
begin
@@ -797,7 +793,7 @@ begin
end;
end;
-procedure TfpgCustomEdit.HandleDoubleClick(x, y: integer; button: word; shiftstate: TShiftState);
+procedure TfpgBaseEdit.HandleDoubleClick(x, y: integer; button: word; shiftstate: TShiftState);
begin
// button is always Mouse_Left, but lets leave this test here for good measure
if button = MOUSE_LEFT then
@@ -806,7 +802,7 @@ begin
inherited;
end;
-procedure TfpgCustomEdit.HandleMouseEnter;
+procedure TfpgBaseEdit.HandleMouseEnter;
begin
inherited HandleMouseEnter;
if (csDesigning in ComponentState) then
@@ -815,7 +811,7 @@ begin
MouseCursor := mcIBeam;
end;
-procedure TfpgCustomEdit.HandleMouseExit;
+procedure TfpgBaseEdit.HandleMouseExit;
begin
inherited HandleMouseExit;
if (csDesigning in ComponentState) then
@@ -823,21 +819,21 @@ begin
MouseCursor := mcDefault;
end;
-procedure TfpgCustomEdit.HandleSetFocus;
+procedure TfpgBaseEdit.HandleSetFocus;
begin
inherited HandleSetFocus;
if AutoSelect then
SelectAll;
end;
-procedure TfpgCustomEdit.HandleKillFocus;
+procedure TfpgBaseEdit.HandleKillFocus;
begin
inherited HandleKillFocus;
if AutoSelect then
FSelOffset := 0;
end;
-function TfpgCustomEdit.GetDrawText: string;
+function TfpgBaseEdit.GetDrawText: string;
begin
if not PassWordMode then
Result := FText
@@ -845,7 +841,7 @@ begin
Result := StringOfChar('*', UTF8Length(FText));
end;
-constructor TfpgCustomEdit.Create(AOwner: TComponent);
+constructor TfpgBaseEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FFont := fpgGetFont('#Edit1'); // owned object !
@@ -871,7 +867,7 @@ begin
FOnChange := nil;
end;
-destructor TfpgCustomEdit.Destroy;
+destructor TfpgBaseEdit.Destroy;
begin
if Assigned(FDefaultPopupMenu) then
FDefaultPopupMenu.Free;
@@ -879,7 +875,7 @@ begin
inherited Destroy;
end;
-function TfpgCustomEdit.SelectionText: string;
+function TfpgBaseEdit.SelectionText: string;
begin
if FSelOffset <> 0 then
begin
@@ -894,7 +890,7 @@ begin
Result := '';
end;
-procedure TfpgCustomEdit.SetPasswordMode (const AValue: boolean );
+procedure TfpgBaseEdit.SetPasswordMode (const AValue: boolean );
begin
if FPasswordMode = AValue then
Exit; //==>
@@ -903,12 +899,12 @@ begin
RePaint;
end;
-function TfpgCustomEdit.GetFontDesc: string;
+function TfpgBaseEdit.GetFontDesc: string;
begin
Result := FFont.FontDesc;
end;
-procedure TfpgCustomEdit.SetFontDesc(const AValue: string);
+procedure TfpgBaseEdit.SetFontDesc(const AValue: string);
begin
FFont.Free;
FFont := fpgGetFont(AValue);
@@ -918,7 +914,7 @@ begin
RePaint;
end;
-procedure TfpgCustomEdit.SetText(const AValue: string);
+procedure TfpgBaseEdit.SetText(const AValue: string);
var
s: string;
begin
@@ -945,27 +941,27 @@ begin
RePaint;
end;
-procedure TfpgCustomEdit.DefaultPopupCut(Sender: TObject);
+procedure TfpgBaseEdit.DefaultPopupCut(Sender: TObject);
begin
CutToClipboard;
end;
-procedure TfpgCustomEdit.DefaultPopupCopy(Sender: TObject);
+procedure TfpgBaseEdit.DefaultPopupCopy(Sender: TObject);
begin
CopyToClipboard;
end;
-procedure TfpgCustomEdit.DefaultPopupPaste(Sender: TObject);
+procedure TfpgBaseEdit.DefaultPopupPaste(Sender: TObject);
begin
PasteFromClipboard
end;
-procedure TfpgCustomEdit.DefaultPopupClearAll(Sender: TObject);
+procedure TfpgBaseEdit.DefaultPopupClearAll(Sender: TObject);
begin
Clear;
end;
-procedure TfpgCustomEdit.SetDefaultPopupMenuItemsState;
+procedure TfpgBaseEdit.SetDefaultPopupMenuItemsState;
var
i: integer;
itm: TfpgMenuItem;
@@ -988,13 +984,13 @@ begin
end;
end;
-procedure TfpgCustomEdit.DoOnChange;
+procedure TfpgBaseEdit.DoOnChange;
begin
if Assigned(FOnChange) then
FOnChange(self);
end;
-procedure TfpgCustomEdit.ShowDefaultPopupMenu(const x, y: integer;
+procedure TfpgBaseEdit.ShowDefaultPopupMenu(const x, y: integer;
const shiftstate: TShiftState);
var
itm: TfpgMenuItem;
@@ -1017,7 +1013,7 @@ begin
FDefaultPopupMenu.ShowAt(self, x, y);
end;
-procedure TfpgCustomEdit.DeleteSelection;
+procedure TfpgBaseEdit.DeleteSelection;
begin
if FSelOffset <> 0 then
begin
@@ -1036,14 +1032,14 @@ begin
end;
end;
-procedure TfpgCustomEdit.DoCopy;
+procedure TfpgBaseEdit.DoCopy;
begin
if FSelOffset = 0 then
Exit; //==>
fpgClipboard.Text := SelectionText;
end;
-procedure TfpgCustomEdit.DoPaste;
+procedure TfpgBaseEdit.DoPaste;
var
s: string;
begin
@@ -1064,14 +1060,14 @@ begin
Repaint;
end;
-procedure TfpgCustomEdit.SetAutoSelect(const AValue: Boolean);
+procedure TfpgBaseEdit.SetAutoSelect(const AValue: Boolean);
begin
if FAutoSelect = AValue then
Exit; //==>
FAutoSelect := AValue;
end;
-procedure TfpgCustomEdit.SelectAll;
+procedure TfpgBaseEdit.SelectAll;
begin
FSelecting := True;
FSelStart := 0;
@@ -1081,24 +1077,24 @@ begin
Repaint;
end;
-procedure TfpgCustomEdit.Clear;
+procedure TfpgBaseEdit.Clear;
begin
Text := '';
end;
-procedure TfpgCustomEdit.ClearSelection;
+procedure TfpgBaseEdit.ClearSelection;
begin
DeleteSelection;
Adjust;
RePaint;
end;
-procedure TfpgCustomEdit.CopyToClipboard;
+procedure TfpgBaseEdit.CopyToClipboard;
begin
DoCopy;
end;
-procedure TfpgCustomEdit.CutToClipboard;
+procedure TfpgBaseEdit.CutToClipboard;
begin
DoCopy;
DeleteSelection;
@@ -1106,7 +1102,7 @@ begin
RePaint;
end;
-procedure TfpgCustomEdit.PasteFromClipboard;
+procedure TfpgBaseEdit.PasteFromClipboard;
begin
DoPaste;
end;
diff --git a/src/gui/gui_editcombo.pas b/src/gui/gui_editcombo.pas
index dc1f271d..4411b5cc 100644
--- a/src/gui/gui_editcombo.pas
+++ b/src/gui/gui_editcombo.pas
@@ -64,7 +64,7 @@ type
TAllowNew = (anNo, anYes, anAsk);
- TfpgAbstractEditCombo = class(TfpgBaseComboBox)
+ TfpgBaseEditCombo = class(TfpgBaseComboBox)
private
FAutoCompletion: Boolean;
FAutoDropDown: Boolean;
@@ -106,11 +106,10 @@ type
destructor Destroy; override;
procedure Update;
property NewText: boolean read FNewItem;
- property OnKeyPress;
end;
- TfpgEditCombo = class(TfpgAbstractEditCombo)
+ TfpgEditCombo = class(TfpgBaseEditCombo)
published
property AutoCompletion;
property AutoDropDown;
@@ -127,6 +126,7 @@ type
property OnChange;
property OnCloseUp;
property OnDropDown;
+ property OnKeyPress;
end;
@@ -243,15 +243,15 @@ begin
Result.Items.Assign(AList);
end;
-{ TfpgAbstractEditCombo }
+{ TfpgBaseEditCombo }
-procedure TfpgAbstractEditCombo.SetAllowNew(const AValue: TAllowNew);
+procedure TfpgBaseEditCombo.SetAllowNew(const AValue: TAllowNew);
begin
if FAllowNew <> AValue then
FAllowNew := AValue;
end;
-function TfpgAbstractEditCombo.GetText: string;
+function TfpgBaseEditCombo.GetText: string;
var
i: integer;
begin
@@ -264,12 +264,12 @@ begin
Result := '';
end;
-function TfpgAbstractEditCombo.HasText: boolean;
+function TfpgBaseEditCombo.HasText: boolean;
begin
Result := FFocusItem >= 0;
end;
-procedure TfpgAbstractEditCombo.DoDropDown;
+procedure TfpgBaseEditCombo.DoDropDown;
var
ddw: TDropDownWindow;
rowcount, i: integer;
@@ -326,12 +326,12 @@ begin
end;
end;
-procedure TfpgAbstractEditCombo.InternalBtnClick(Sender: TObject);
+procedure TfpgBaseEditCombo.InternalBtnClick(Sender: TObject);
begin
DoDropDown;
end;
-procedure TfpgAbstractEditCombo.InternalListBoxSelect(Sender: TObject);
+procedure TfpgBaseEditCombo.InternalListBoxSelect(Sender: TObject);
var
i: Integer;
begin
@@ -350,7 +350,7 @@ begin
Repaint;
end;
-procedure TfpgAbstractEditCombo.SetText(const AValue: string);
+procedure TfpgBaseEditCombo.SetText(const AValue: string);
var
i: integer;
begin
@@ -375,21 +375,21 @@ begin
end;
end;
-procedure TfpgAbstractEditCombo.SetWidth(const AValue: TfpgCoord);
+procedure TfpgBaseEditCombo.SetWidth(const AValue: TfpgCoord);
begin
inherited SetWidth(AValue);
CalculateInternalButtonRect;
RePaint;
end;
-procedure TfpgAbstractEditCombo.SetHeight(const AValue: TfpgCoord);
+procedure TfpgBaseEditCombo.SetHeight(const AValue: TfpgCoord);
begin
inherited SetHeight(AValue);
CalculateInternalButtonRect;
RePaint;
end;
-procedure TfpgAbstractEditCombo.HandleKeyChar(var AText: TfpgChar;
+procedure TfpgBaseEditCombo.HandleKeyChar(var AText: TfpgChar;
var shiftstate: TShiftState; var consumed: Boolean);
var
s: TfpgChar;
@@ -450,7 +450,7 @@ begin
inherited HandleKeyChar(AText, shiftstate, consumed);
end;
-procedure TfpgAbstractEditCombo.HandleKeyPress(var keycode: word;
+procedure TfpgBaseEditCombo.HandleKeyPress(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
var
hasChanged: boolean;
@@ -540,7 +540,7 @@ begin
inherited HandleKeyPress(keycode, shiftstate, consumed);
end;
-procedure TfpgAbstractEditCombo.HandleLMouseDown(x, y: integer;
+procedure TfpgBaseEditCombo.HandleLMouseDown(x, y: integer;
shiftstate: TShiftState);
begin
inherited HandleLMouseDown(x, y, shiftstate);
@@ -558,7 +558,7 @@ begin
end;
end;
-procedure TfpgAbstractEditCombo.HandleLMouseUp(x, y: integer;
+procedure TfpgBaseEditCombo.HandleLMouseUp(x, y: integer;
shiftstate: TShiftState);
begin
inherited HandleLMouseUp(x, y, shiftstate);
@@ -566,13 +566,13 @@ begin
PaintInternalButton;
end;
-procedure TfpgAbstractEditCombo.HandleResize(awidth, aheight: TfpgCoord);
+procedure TfpgBaseEditCombo.HandleResize(awidth, aheight: TfpgCoord);
begin
inherited HandleResize(awidth, aheight);
CalculateInternalButtonRect;
end;
-procedure TfpgAbstractEditCombo.HandlePaint;
+procedure TfpgBaseEditCombo.HandlePaint;
var
r: TfpgRect;
tw, tw2, st, len: integer;
@@ -717,7 +717,7 @@ begin
Canvas.EndDraw;
end;
-constructor TfpgAbstractEditCombo.Create(AOwner: TComponent);
+constructor TfpgBaseEditCombo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FBackgroundColor := clBoxColor;
@@ -741,13 +741,13 @@ begin
CalculateInternalButtonRect;
end;
-destructor TfpgAbstractEditCombo.Destroy;
+destructor TfpgBaseEditCombo.Destroy;
begin
FDropDown.Free;
inherited Destroy;
end;
-procedure TfpgAbstractEditCombo.Update;
+procedure TfpgBaseEditCombo.Update;
begin
FFocusItem := -1;
Repaint;
diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas
index 438a675b..18cd1960 100644
--- a/src/gui/gui_form.pas
+++ b/src/gui/gui_form.pas
@@ -35,7 +35,7 @@ type
TFormCloseEvent = procedure(Sender: TObject; var CloseAction: TCloseAction) of object;
TFormCloseQueryEvent = procedure(Sender: TObject; var CanClose: boolean) of object;
- TfpgForm = class(TfpgWidget)
+ TfpgBaseForm = class(TfpgWidget)
private
FFullScreen: boolean;
FOnActivate: TNotifyEvent;
@@ -48,7 +48,7 @@ type
FOnShow: TNotifyEvent;
protected
FModalResult: integer;
- FParentForm: TfpgForm;
+ FParentForm: TfpgBaseForm;
FWindowPosition: TWindowPosition;
FWindowTitle: string;
FSizeable: boolean;
@@ -66,23 +66,10 @@ type
procedure HandleResize(awidth, aheight: TfpgCoord); override;
procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
procedure DoOnClose(var CloseAction: TCloseAction); virtual;
- public
- constructor Create(AOwner: TComponent); override;
- procedure AfterConstruction; override;
- procedure BeforeDestruction; override;
- procedure AfterCreate; virtual;
- procedure Show;
- procedure Hide;
- function ShowModal: integer;
- procedure Close;
- function CloseQuery: boolean; virtual;
+
property Sizeable: boolean read FSizeable write FSizeable;
property ModalResult: integer read FModalResult write FModalResult;
property FullScreen: boolean read FFullScreen write FFullScreen default False;
- published
- { TODO : Refactor this to a TfpgCustomForm and only surface it here }
- property BackgroundColor;
- property TextColor;
property WindowPosition: TWindowPosition read FWindowPosition write FWindowPosition default wpAuto;
property WindowTitle: string read FWindowTitle write SetWindowTitle;
// events
@@ -93,9 +80,39 @@ type
property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
property OnHide: TNotifyEvent read FOnHide write FOnHide;
+ property OnShow: TNotifyEvent read FOnShow write FOnShow;
+ public
+ constructor Create(AOwner: TComponent); override;
+ procedure AfterConstruction; override;
+ procedure BeforeDestruction; override;
+ procedure AfterCreate; virtual;
+ procedure Show;
+ procedure Hide;
+ function ShowModal: integer;
+ procedure Close;
+ function CloseQuery: boolean; virtual;
+ end;
+
+
+ TfpgForm = class(TfpgBaseForm)
+ published
+ property BackgroundColor;
+ property FullScreen;
+ property ModalResult;
+ property Sizeable;
+ property TextColor;
+ property WindowPosition;
+ property WindowTitle;
+ property OnActivate;
+ property OnClose;
+ property OnCloseQuery;
+ property OnCreate;
+ property OnDeactivate;
+ property OnDestroy;
+ property OnHide;
property OnPaint;
property OnResize;
- property OnShow: TNotifyEvent read FOnShow write FOnShow;
+ property OnShow;
end;
@@ -132,15 +149,15 @@ begin
Result := nil;
end;
-{ TfpgForm }
+{ TfpgBaseForm }
-procedure TfpgForm.SetWindowTitle(const ATitle: string);
+procedure TfpgBaseForm.SetWindowTitle(const ATitle: string);
begin
FWindowTitle := ATitle;
inherited SetWindowTitle(ATitle);
end;
-procedure TfpgForm.MsgActivate(var msg: TfpgMessageRec);
+procedure TfpgBaseForm.MsgActivate(var msg: TfpgMessageRec);
begin
if (fpgApplication.TopModalForm = nil) or (fpgApplication.TopModalForm = self) then
begin
@@ -162,7 +179,7 @@ begin
FOnActivate(self);
end;
-procedure TfpgForm.MsgDeActivate(var msg: TfpgMessageRec);
+procedure TfpgBaseForm.MsgDeActivate(var msg: TfpgMessageRec);
begin
ClosePopups;
if ActiveWidget <> nil then
@@ -171,13 +188,13 @@ begin
FOnDeactivate(self);
end;
-procedure TfpgForm.HandlePaint;
+procedure TfpgBaseForm.HandlePaint;
begin
inherited HandlePaint;
Canvas.Clear(FBackgroundColor);
end;
-procedure TfpgForm.AdjustWindowStyle;
+procedure TfpgBaseForm.AdjustWindowStyle;
begin
if fpgApplication.MainForm = nil then
fpgApplication.MainForm := self;
@@ -203,13 +220,13 @@ begin
Exclude(FWindowAttributes, waFullScreen);
end;
-procedure TfpgForm.SetWindowParameters;
+procedure TfpgBaseForm.SetWindowParameters;
begin
inherited;
DoSetWindowTitle(FWindowTitle);
end;
-constructor TfpgForm.Create(AOwner: TComponent);
+constructor TfpgBaseForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FWindowPosition := wpAuto;
@@ -224,18 +241,18 @@ begin
FFullScreen := False;
end;
-procedure TfpgForm.AfterCreate;
+procedure TfpgBaseForm.AfterCreate;
begin
// for the user
end;
-procedure TfpgForm.Show;
+procedure TfpgBaseForm.Show;
begin
FVisible := True;
HandleShow;
end;
-function TfpgForm.ShowModal: integer;
+function TfpgBaseForm.ShowModal: integer;
var
lCloseAction: TCloseAction;
begin
@@ -271,24 +288,24 @@ begin
end;
end;
-procedure TfpgForm.MsgClose(var msg: TfpgMessageRec);
+procedure TfpgBaseForm.MsgClose(var msg: TfpgMessageRec);
begin
HandleClose;
end;
-procedure TfpgForm.HandleClose;
+procedure TfpgBaseForm.HandleClose;
begin
Close;
end;
-procedure TfpgForm.HandleHide;
+procedure TfpgBaseForm.HandleHide;
begin
if Assigned(FOnHide) then
FOnHide(self);
inherited HandleHide;
end;
-procedure TfpgForm.HandleShow;
+procedure TfpgBaseForm.HandleShow;
begin
inherited HandleShow;
if Assigned(FOnShow) then
@@ -301,19 +318,19 @@ begin
{$ENDIF}
end;
-procedure TfpgForm.HandleMove(x, y: TfpgCoord);
+procedure TfpgBaseForm.HandleMove(x, y: TfpgCoord);
begin
ClosePopups;
inherited HandleMove(x, y);
end;
-procedure TfpgForm.HandleResize(awidth, aheight: TfpgCoord);
+procedure TfpgBaseForm.HandleResize(awidth, aheight: TfpgCoord);
begin
ClosePopups;
inherited HandleResize(awidth, aheight);
end;
-procedure TfpgForm.HandleKeyPress(var keycode: word;
+procedure TfpgBaseForm.HandleKeyPress(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
var
i: integer;
@@ -337,7 +354,7 @@ begin
inherited HandleKeyPress(keycode, shiftstate, consumed);
end;
-procedure TfpgForm.AfterConstruction;
+procedure TfpgBaseForm.AfterConstruction;
begin
inherited AfterConstruction;
AfterCreate;
@@ -345,20 +362,20 @@ begin
FOnCreate(self);
end;
-procedure TfpgForm.BeforeDestruction;
+procedure TfpgBaseForm.BeforeDestruction;
begin
inherited BeforeDestruction;
if Assigned(FOnDestroy) then
FOnDestroy(self);
end;
-procedure TfpgForm.DoOnClose(var CloseAction: TCloseAction);
+procedure TfpgBaseForm.DoOnClose(var CloseAction: TCloseAction);
begin
if Assigned(FOnClose) then
OnClose(self, CloseAction);
end;
-procedure TfpgForm.Hide;
+procedure TfpgBaseForm.Hide;
begin
Visible := False;
// HandleHide;
@@ -366,7 +383,7 @@ begin
ModalResult := -1;
end;
-procedure TfpgForm.Close;
+procedure TfpgBaseForm.Close;
var
CloseAction: TCloseAction;
IsMainForm: Boolean;
@@ -402,7 +419,7 @@ begin
end; { if CloseQuery }
end;
-function TfpgForm.CloseQuery: boolean;
+function TfpgBaseForm.CloseQuery: boolean;
begin
Result := True;
if Assigned(FOnCloseQuery) then
diff --git a/src/gui/gui_popupcalendar.pas b/src/gui/gui_popupcalendar.pas
index e712b85d..6ee37019 100644
--- a/src/gui/gui_popupcalendar.pas
+++ b/src/gui/gui_popupcalendar.pas
@@ -113,7 +113,7 @@ type
end;
- TfpgCalendarCombo = class(TfpgAbstractComboBox)
+ TfpgCalendarCombo = class(TfpgBaseStaticCombo)
private
FDate: TDateTime;
FDateFormat: string;