From 05e93fa995cd6b0543001e4d70be59538dfcdbc7 Mon Sep 17 00:00:00 2001 From: graemeg Date: Tue, 24 Jul 2007 20:57:52 +0000 Subject: Replaced some code that got undone in the previous revision regarding modal forms. --- src/corelib/fpgfx.pas | 4 +--- src/corelib/gdi/gfx_gdi.pas | 8 +++----- src/corelib/gfxbase.pas | 3 +++ src/corelib/x11/gfx_x11.pas | 12 ++++++------ src/gui/gui_label.pas | 6 ++++++ 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/corelib/fpgfx.pas b/src/corelib/fpgfx.pas index 11845e52..b94f45c1 100644 --- a/src/corelib/fpgfx.pas +++ b/src/corelib/fpgfx.pas @@ -184,8 +184,6 @@ type end; - { TfpgTimer } - TfpgTimer = class private FEnabled: boolean; @@ -205,7 +203,7 @@ type end; - { Caret (text cursor). Inverts painting over text and has blinking + { Caret or text cursor, inverts painting over text and has blinking support. } TfpgCaret = class private diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index dca5ce15..6aa7f910 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -868,7 +868,8 @@ procedure TfpgWindowImpl.DoSetWindowVisible(const AValue: Boolean); var r: TRect; begin - if AValue then begin + if AValue then + begin BringWindowToTop(FWinHandle); if FWindowType in [wtPopup] then @@ -883,13 +884,10 @@ begin FLeft := r.Left; FTop := r.Top; end; - Windows.UpdateWindow(FWinHandle); end - else begin + else Windows.ShowWindow(FWinHandle, SW_HIDE); - end; - end; procedure TfpgWindowImpl.DoMoveWindow(const x: TfpgCoord; const y: TfpgCoord); diff --git a/src/corelib/gfxbase.pas b/src/corelib/gfxbase.pas index 0d85a642..2b677e57 100644 --- a/src/corelib/gfxbase.pas +++ b/src/corelib/gfxbase.pas @@ -344,11 +344,14 @@ type TfpgApplicationBase = class(TObject) + private + FTopModalForm: TfpgWindowBase; protected FIsInitialized: Boolean; public constructor Create(const AParams: string); virtual; abstract; property IsInitialized: boolean read FIsInitialized; + property TopModalForm: TfpgWindowBase read FTopModalForm write FTopModalForm; end; diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas index 53b8c12c..d5a09843 100644 --- a/src/corelib/x11/gfx_x11.pas +++ b/src/corelib/x11/gfx_x11.pas @@ -691,11 +691,11 @@ begin msgp.mouse.shiftstate := ConvertShiftState(ev.xbutton.state); w := FindWindowByHandle(ev.xbutton.window); - if fpgTopModalForm <> nil then + if xapplication.TopModalForm <> nil then begin // This is ugly!!!!!!!!!!!!!!! ew := TfpgWindowImpl(WidgetParentForm(TfpgWidget(w))); - if (ew <> nil) and (fpgTopModalForm <> ew) then + if (ew <> nil) and (xapplication.TopModalForm <> ew) then blockmsg := true; end; @@ -758,11 +758,11 @@ begin until not XCheckTypedWindowEvent(display, ev.xbutton.window, X.MotionNotify, @ev); w := FindWindowByHandle(ev.xany.window); - if fpgTopModalForm <> nil then + if xapplication.TopModalForm <> nil then begin // This is ugly!!!!!!!!!!!!!!! ew := TfpgWindowImpl(WidgetParentForm(TfpgWidget(w))); - if (ew <> nil) and (fpgTopModalForm <> ew) then + if (ew <> nil) and (xapplication.TopModalForm <> ew) then blockmsg := true; end; @@ -780,11 +780,11 @@ begin X.ClientMessage: begin w := FindWindowByHandle(ev.xany.window); - if fpgTopModalForm <> nil then + if xapplication.TopModalForm <> nil then begin // This is ugly!!!!!!!!!!!!!!! ew := TfpgWindowImpl(WidgetParentForm(TfpgWidget(w))); - if (ew <> nil) and (fpgTopModalForm <> ew) then + if (ew <> nil) and (xapplication.TopModalForm <> ew) then blockmsg := true; end; diff --git a/src/gui/gui_label.pas b/src/gui/gui_label.pas index ea635be0..96f638a7 100644 --- a/src/gui/gui_label.pas +++ b/src/gui/gui_label.pas @@ -29,6 +29,7 @@ type FText: string; FFont: TfpgFont; procedure HandlePaint; override; + procedure HandleResize(awidth, aheight: TfpgCoord); override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -148,5 +149,10 @@ begin Canvas.EndDraw; end; +procedure TfpgLabel.HandleResize(awidth, aheight: TfpgCoord); +begin + inherited HandleResize(awidth, aheight); +end; + end. -- cgit v1.2.3-70-g09d2