diff options
author | sekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-13 05:48:52 +0000 |
---|---|---|
committer | sekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-13 05:48:52 +0000 |
commit | 234062f2837a5d707611ea0a54d2fcb4a5b93db1 (patch) | |
tree | 43d125cd5b37d92d1cf005c0ae8dfb87a4853902 | |
parent | 2a4f80da527ce0f4e8ec53004c965fb809b05a37 (diff) | |
download | fpGUI-234062f2837a5d707611ea0a54d2fcb4a5b93db1.tar.xz |
Added some more properties/methods to TFWindow
-rw-r--r-- | examples/gfx/eventtest/eventtest.lpi | 1 | ||||
-rw-r--r-- | gfx/gdi/gfx_gdi.pas | 14 | ||||
-rw-r--r-- | gfx/gfxbase.pas | 39 |
3 files changed, 47 insertions, 7 deletions
diff --git a/examples/gfx/eventtest/eventtest.lpi b/examples/gfx/eventtest/eventtest.lpi index cef9a64b..6328a842 100644 --- a/examples/gfx/eventtest/eventtest.lpi +++ b/examples/gfx/eventtest/eventtest.lpi @@ -14,7 +14,6 @@ </General> <PublishOptions> <Version Value="2"/> - <DestinationDirectory Value="$(TestDir)\publishedproject\"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> </PublishOptions> diff --git a/gfx/gdi/gfx_gdi.pas b/gfx/gdi/gfx_gdi.pas index b1b21ec2..3a567547 100644 --- a/gfx/gdi/gfx_gdi.pas +++ b/gfx/gdi/gfx_gdi.pas @@ -223,6 +223,7 @@ type procedure SetClientSize(const ASize: TSize); override; procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); override; procedure Show; override; + procedure Hide; override; procedure Invalidate; override; procedure CaptureMouse; override; procedure ReleaseMouse; override; @@ -1432,11 +1433,24 @@ begin Windows.ShowWindow(Handle, SW_SHOWNORMAL); Windows.UpdateWindow(Handle); Windows.SetForegroundWindow(Handle); + + { Show all child windows } for i := 0 to Pred(ChildWindows.Count) do TGDIWindow(ChildWindows.Items[i]).Show; end; +procedure TGDIWindow.Hide; +var + i: integer; +begin + Windows.ShowWindow(Handle, SW_HIDE); + + { Hide all child windows } + for i := 0 to Pred(ChildWindows.Count) do + TGDIWindow(ChildWindows.Items[i]).Hide; +end; +{ Invalidates the entire window } procedure TGDIWindow.Invalidate; begin Windows.InvalidateRect(Handle, nil, True); diff --git a/gfx/gfxbase.pas b/gfx/gfxbase.pas index bed76023..efbee2db 100644 --- a/gfx/gfxbase.pas +++ b/gfx/gfxbase.pas @@ -483,16 +483,19 @@ type FOnMove: TNotifyEvent; FOnResize: TNotifyEvent; FOnShow: TNotifyEvent; + FVisible: Boolean; { Property setting methods mapped to other methods } procedure SetClientHeight(const AValue: Integer); procedure SetClientWidth(const AValue: Integer); + procedure SetCursor(ACursor: TFCursor); + procedure SetHeight(AHeight: Integer); procedure SetLeft(const AValue: Integer); procedure SetTop(const AValue: Integer); + procedure SetVisible(const AValue: Boolean); procedure SetWidth(AWidth: Integer); - procedure SetHeight(AHeight: Integer); - procedure SetCursor(ACursor: TFCursor); procedure SetWindowOptions(const AValue: TFWindowOptions); protected + { Fields related to properties } FParent: TFCustomWindow; FCanvas: TFCustomCanvas; FLeft: Integer; @@ -502,8 +505,12 @@ type FClientWidth: Integer; FClientHeight: Integer; FWindowOptions: TFWindowOptions; - FChildWindows: TList; FMinSize, FMaxSize: TSize; + FFocusable: Boolean; + + { Fields of the child windows list } + FChildWindows: TList; + FFocusedWindow: TFCustomWindow; { Internal resource allocation methods } procedure DoSetCursor; virtual; abstract; @@ -543,11 +550,14 @@ type procedure SetClientSize(const ASize: TSize); virtual; abstract; procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); virtual; abstract; procedure Show; virtual; abstract; + procedure Hide; virtual; abstract; procedure Invalidate; virtual; abstract; procedure CaptureMouse; virtual; abstract; procedure ReleaseMouse; virtual; abstract; { Event processing methods } procedure ProcessEvent(AEvent: TFEvent); + { Methods of the child windows list } + function FindTopParentWindow: TFCustomWindow; { Properties } property WindowOptions: TFWindowOptions read FWindowOptions write SetWindowOptions; @@ -555,15 +565,17 @@ type property Handle: PtrUInt read GetHandle; property ChildWindows: TList read FChildWindows; { Window state } + property ClientWidth: Integer read FClientWidth write SetClientWidth; + property ClientHeight: Integer read FClientHeight write SetClientHeight; + property Cursor: TFCursor read FCursor write SetCursor; property Left: Integer read FLeft write SetLeft; property Top: Integer read FTop write SetTop; property Width: Integer read FWidth write SetWidth; property Height: Integer read FHeight write SetHeight; - property ClientWidth: Integer read FClientWidth write SetClientWidth; - property ClientHeight: Integer read FClientHeight write SetClientHeight; - property Cursor: TFCursor read FCursor write SetCursor; property Title: String read GetTitle write SetTitle; property Parent: TFCustomWindow read FParent; + property Visible: Boolean read FVisible write SetVisible; + property Focusable: Boolean read FFocusable write FFocusable; { Event handlers } property OnCreate: TNotifyEvent read FOnCreate write FOnCreate; property OnCanClose: TGfxCanCloseEvent read FOnCanClose write FOnCanClose; @@ -1089,6 +1101,14 @@ begin SetPosition(Point(FLeft, AValue)); end; +procedure TFCustomWindow.SetVisible(const AValue: Boolean); +begin + if FVisible = AValue then exit; + + if AValue then Show + else Hide; +end; + procedure TFCustomWindow.SetHeight(AHeight: Integer); begin SetSize(Size(Width, AHeight)); @@ -1110,6 +1130,13 @@ begin DoSetWindowOptions; end; +{ Finds the top window througth recursion } +function TFCustomWindow.FindTopParentWindow: TFCustomWindow; +begin + if Assigned(Parent) then Result := Parent.FindTopParentWindow + else Result := Self; +end; + { Global functions } { Sizes, points etc. } |