summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-15 10:30:46 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-15 10:30:46 +0000
commit9e89b98db6b5c885da8c2b67782faf9c9b93a0f2 (patch)
treeb786db572bae448c54421c64133de92a405c0ba2 /src
parente86fedd9b4bdd139e06d59952ddaa65e1cbd6a11 (diff)
downloadfpGUI-9e89b98db6b5c885da8c2b67782faf9c9b93a0f2.tar.xz
* Published BackgroundColor and OnPaint for TfpgForm
* TfpgWidget.HandleShow now always sets Visible = True. This fixes issue with the fpGUI-LCL interface as well. * Added a few more safety checks into the PageControl widget. * The OnPaint event is now wrapped with BeginDraw/EndDraw calls so that a event handler for OnPaint doesn't need to call it explicitly.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/gfx_widget.pas14
-rw-r--r--src/gui/gui_form.pas13
-rw-r--r--src/gui/gui_label.pas4
-rw-r--r--src/gui/gui_tab.pas16
-rw-r--r--src/gui/gui_tree.pas6
5 files changed, 40 insertions, 13 deletions
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index 728be6b3..f6eeba24 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -149,7 +149,7 @@ end;
procedure TfpgWidget.SetEnabled(const AValue: boolean);
begin
if FEnabled = AValue then
- Exit;
+ Exit; //==>
FEnabled := AValue;
RePaint;
end;
@@ -158,7 +158,8 @@ procedure TfpgWidget.SetActiveWidget(const AValue: TfpgWidget);
begin
if FActiveWidget = AValue then
Exit; //==>
- if FFormDesigner <> nil then Exit;
+ if FFormDesigner <> nil then
+ Exit; //==>
if FActiveWidget <> nil then
FActiveWidget.HandleKillFocus;
@@ -169,6 +170,7 @@ end;
procedure TfpgWidget.SetVisible(const AValue: boolean);
begin
+// Writeln(Classname, ' TfpgWidget.SetVisible AValue = ', AValue);
if FVisible = AValue then
Exit; //==>
FVisible := AValue;
@@ -220,8 +222,10 @@ begin
// This is for components that are create at runtime, after it's
// parent has already been shown.
if (Parent <> nil) and (Parent.HasHandle) then
+ begin
+// writeln('about to call InternalHandleShow');
InternalHandleShow;
-// HandleShow;
+ end;
Exclude(ComponentState, csLoading);
end;
@@ -466,6 +470,8 @@ var
c: TComponent;
begin
FOnScreen := True;
+ FVisible := True;
+// writeln(Classname, ' TfpgWidget.HandleShow - FVisible = ', FVisible);
if FVisible then
begin
AllocateWindowHandle;
@@ -766,9 +772,11 @@ end;
procedure TfpgWidget.MsgPaint(var msg: TfpgMessageRec);
begin
+ Canvas.BeginDraw;
HandlePaint;
if Assigned(FOnPaint) then
FOnPaint(Self);
+ Canvas.EndDraw;
end;
procedure TfpgWidget.MsgResize(var msg: TfpgMessageRec);
diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas
index 448e1c8e..0efac32b 100644
--- a/src/gui/gui_form.pas
+++ b/src/gui/gui_form.pas
@@ -41,6 +41,7 @@ type
FOnDestroy: TNotifyEvent;
FOnHide: TNotifyEvent;
FOnShow: TNotifyEvent;
+ procedure SetBackgroundColor(const AValue: TfpgColor);
protected
FPrevModalForm: TfpgWindowBase;
FModalResult: integer;
@@ -73,6 +74,7 @@ type
property ModalResult: integer read FModalResult write FModalResult;
published
{$Note Refactor this to a TfpgCustomForm and only surface it here }
+ property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
property WindowPosition: TWindowPosition read FWindowPosition write FWindowPosition;
property WindowTitle: string read FWindowTitle write SetWindowTitle;
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
@@ -81,6 +83,7 @@ type
property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
property OnHide: TNotifyEvent read FOnHide write FOnHide;
+ property OnPaint;
property OnShow: TNotifyEvent read FOnShow write FOnShow;
end;
@@ -162,6 +165,14 @@ begin
Canvas.EndDraw(0, 0, FWidth, FHeight);
end;
+procedure TfpgForm.SetBackgroundColor(const AValue: TfpgColor);
+begin
+ if FBackgroundColor = AValue then
+ Exit; //==>
+ FBackgroundColor := AValue;
+ RePaint;
+end;
+
procedure TfpgForm.AdjustWindowStyle;
begin
if fpgApplication.MainForm = nil then
@@ -212,7 +223,7 @@ end;
procedure TfpgForm.Show;
begin
- Visible := True;
+ FVisible := True;
HandleShow;
end;
diff --git a/src/gui/gui_label.pas b/src/gui/gui_label.pas
index 4f877792..85caadda 100644
--- a/src/gui/gui_label.pas
+++ b/src/gui/gui_label.pas
@@ -104,7 +104,7 @@ end;
procedure TfpgLabel.SetBackgroundColor(const AValue: TfpgColor);
begin
if FBackgroundColor = AValue then
- Exit;
+ Exit; //==>
FBackgroundColor := AValue;
RePaint;
end;
@@ -121,7 +121,7 @@ end;
procedure TfpgLabel.SetText(const AValue: string);
begin
if FText = AValue then
- Exit;
+ Exit; //==>
FText := AValue;
if FAutoSize then
ResizeLabel;
diff --git a/src/gui/gui_tab.pas b/src/gui/gui_tab.pas
index e85cebb8..5351ae46 100644
--- a/src/gui/gui_tab.pas
+++ b/src/gui/gui_tab.pas
@@ -89,7 +89,7 @@ type
FStyle: TfpgTabStyle;
FTabPosition: TfpgTabPosition;
function GetActivePageIndex: integer;
- function GetPage(AIndex: integer): TfpgTabSheet;
+ function GetPage(AIndex: integer): TfpgTabSheet;
function GetPageCount: Integer;
procedure InsertPage(const APage: TfpgTabSheet);
procedure RemovePage(const APage: TfpgTabSheet);
@@ -258,8 +258,13 @@ begin
FPages.Remove(APage);
{$Note This still needs to be fixed.}
if APage = FActivePage then
+ begin
// FActivePage := FindNextPage(APage, True);
- ActivePage := TfpgTabSheet(FPages.First);
+// if FPages.Count > 0 then
+ ActivePage := TfpgTabSheet(FPages.First);
+// else
+// ActivePage := nil;
+ end;
end;
procedure TfpgPageControl.SetActivePageIndex(const AValue: integer);
@@ -454,6 +459,8 @@ begin
Exit; //==>
h := TfpgTabSheet(FPages.First);
+ if h = nil then
+ Exit;
Canvas.BeginDraw;
Canvas.SetTextColor(clText1);
@@ -712,6 +719,9 @@ destructor TfpgPageControl.Destroy;
var
ts: TfpgTabSheet;
begin
+ FOnChange := nil;
+ FActivePage := TfpgTabSheet(FPages[0]);
+ ActiveWidget := nil;
while FPages.Count > 0 do
begin
ts := TfpgTabSheet(FPages.Last);
@@ -719,9 +729,7 @@ begin
ts.Free;
end;
FPages.Free;
-
FFirstTabButton := nil;
- FOnChange := nil;
inherited Destroy;
end;
diff --git a/src/gui/gui_tree.pas b/src/gui/gui_tree.pas
index ea00b59c..defe179d 100644
--- a/src/gui/gui_tree.pas
+++ b/src/gui/gui_tree.pas
@@ -24,10 +24,10 @@ unit gui_tree;
* Lots!!
* Columns need to be reworked. We don't want coluns per node levels. Instead
we want a main column covering the tree. Then extra columns for user
- text and data.gui_tree
+ text and data.
* Implement event handlers the user can hook into and do custom drawing.
- WARNING: This is still under heavy development! Do NOT use.
+ WARNING: This is still under heavy development! Do NOT use yet.
}
{.$Define Debug}
@@ -105,7 +105,7 @@ type
property Parent: TfpgTreeNode read FParent write SetParent;
property FirstSubNode: TfpgTreeNode read FFirstSubNode;
property LastSubNode: TfpgTreeNode read FLastSubNode;
- property ImageIndex : integer read FImageIndex write FImageIndex;
+ property ImageIndex: integer read FImageIndex write FImageIndex;
// color settings
property TextColor: TfpgColor read FTextColor write SetTextColor;
property SelColor: TfpgColor read FSelColor write SetSelColor;