From f742b03ed3afc5b55df65a6bb8a3e2984479ac4b Mon Sep 17 00:00:00 2001 From: graemeg Date: Thu, 3 Jul 2008 13:33:37 +0000 Subject: * EditTest in the prototypes directory now tests Button ImageLayout property. * TfpgBevel has been added to the UI Designer component palette. * TfpgBevel is used in the UI Designer and Shape=Spacer it paints itself different in the UI Designer, so it's more visible. At runtime it doesn't paint like that. --- examples/apps/uidesigner/icons.inc | 105 +++++++++++++++++++++++++++ examples/apps/uidesigner/newformdesigner.pas | 6 +- examples/apps/uidesigner/uidesigner.lpi | 10 ++- examples/apps/uidesigner/vfdwidgets.pas | 16 ++++ images/bevel.bmp | Bin 0 -> 1710 bytes prototypes/fpgui2/tests/edittest.lpr | 29 ++++++-- src/corelib/gfx_widget.pas | 2 + src/gui/gui_button.pas | 1 - src/gui/gui_form.pas | 15 +--- src/gui/gui_panel.pas | 13 ++++ 10 files changed, 172 insertions(+), 25 deletions(-) create mode 100644 images/bevel.bmp diff --git a/examples/apps/uidesigner/icons.inc b/examples/apps/uidesigner/icons.inc index cc4f2d98..71d8542b 100644 --- a/examples/apps/uidesigner/icons.inc +++ b/examples/apps/uidesigner/icons.inc @@ -1979,3 +1979,108 @@ Const 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0, 255,255, 0,255,255, 0,255, 0, 0, 0); + +Const + stdimg_vfd_bevel : Array[0..1709] of byte = ( + 66, 77,174, 6, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 23, 0, 0, 0, 23, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 120, 6, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0, + 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, + 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, + 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0, + 255,255, 0,255, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, + 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, + 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0, + 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, + 0,255,255, 0,255,255, 0,255, 0, 0, 0,255, 0,255,200,208,212, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255, 0,255,255, 0,255, 0, 0, 0,255, 0, + 255,128,128,128,200,208,212,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,255,255,255,255, 0,255,255, 0,255, 0, + 0, 0,255, 0,255,128,128,128,255,255,255,200,208,212,200,208,212, + 200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200,208, + 212,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200, + 208,212,200,208,212,200,208,212,128,128,128,255,255,255,255, 0,255, + 255, 0,255, 0, 0, 0,255, 0,255,128,128,128,255,255,255,200,208, + 212,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200, + 208,212,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212, + 200,208,212,200,208,212,200,208,212,200,208,212,128,128,128,255,255, + 255,255, 0,255,255, 0,255, 0, 0, 0,255, 0,255,128,128,128,255, + 255,255,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212, + 200,208,212,200,208,212,128,128,128,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,200,208,212,128, + 128,128,255,255,255,255, 0,255,255, 0,255, 0, 0, 0,255, 0,255, + 128,128,128,255,255,255,200,208,212,200,208,212,200,208,212,200,208, + 212,200,208,212,200,208,212,200,208,212,128,128,128,200,208,212,200, + 208,212,200,208,212,200,208,212,200,208,212,200,208,212,255,255,255, + 200,208,212,128,128,128,255,255,255,255, 0,255,255, 0,255, 0, 0, + 0,255, 0,255,128,128,128,255,255,255,200,208,212,200,208,212,200, + 208,212,200,208,212,200,208,212,200,208,212,200,208,212,128,128,128, + 200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200,208, + 212,255,255,255,200,208,212,128,128,128,255,255,255,255, 0,255,255, + 0,255, 0, 0, 0,255, 0,255,128,128,128,255,255,255,200,208,212, + 200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200,208, + 212,128,128,128,200,208,212,200,208,212,200,208,212,200,208,212,200, + 208,212,200,208,212,255,255,255,200,208,212,128,128,128,255,255,255, + 255, 0,255,255, 0,255, 0, 0, 0,255, 0,255,128,128,128,255,255, + 255,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200, + 208,212,200,208,212,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,255,255,255,200,208,212,128,128, + 128,255,255,255,255, 0,255,255, 0,255, 0, 0, 0,255, 0,255,128, + 128,128,255,255,255,200,208,212,200,208,212,200,208,212,200,208,212, + 200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200,208, + 212,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200, + 208,212,128,128,128,255,255,255,255, 0,255,255, 0,255, 0, 0, 0, + 255, 0,255,128,128,128,255,255,255,200,208,212,200,208,212,200,208, + 212,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200, + 208,212,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212, + 200,208,212,200,208,212,128,128,128,255,255,255,255, 0,255,255, 0, + 255, 0, 0, 0,255, 0,255,128,128,128,255,255,255,200,208,212,255, + 255,255,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,200,208,212,200,208,212,200,208,212,200,208,212,200,208, + 212,200,208,212,200,208,212,200,208,212,128,128,128,255,255,255,255, + 0,255,255, 0,255, 0, 0, 0,255, 0,255,128,128,128,255,255,255, + 200,208,212,255,255,255,200,208,212,200,208,212,200,208,212,200,208, + 212,200,208,212,128,128,128,200,208,212,200,208,212,200,208,212,200, + 208,212,200,208,212,200,208,212,200,208,212,200,208,212,128,128,128, + 255,255,255,255, 0,255,255, 0,255, 0, 0, 0,255, 0,255,128,128, + 128,255,255,255,200,208,212,255,255,255,200,208,212,200,208,212,200, + 208,212,200,208,212,200,208,212,128,128,128,200,208,212,200,208,212, + 200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200,208, + 212,128,128,128,255,255,255,255, 0,255,255, 0,255, 0, 0, 0,255, + 0,255,128,128,128,255,255,255,200,208,212,255,255,255,200,208,212, + 200,208,212,200,208,212,200,208,212,200,208,212,128,128,128,200,208, + 212,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200, + 208,212,200,208,212,128,128,128,255,255,255,255, 0,255,255, 0,255, + 0, 0, 0,255, 0,255,128,128,128,255,255,255,200,208,212,255,255, + 255,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,128, + 128,128,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212, + 200,208,212,200,208,212,200,208,212,128,128,128,255,255,255,255, 0, + 255,255, 0,255, 0, 0, 0,255, 0,255,128,128,128,255,255,255,200, + 208,212,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,128,128,128,200,208,212,200,208,212,200,208,212,200,208, + 212,200,208,212,200,208,212,200,208,212,200,208,212,128,128,128,255, + 255,255,255, 0,255,255, 0,255, 0, 0, 0,255, 0,255,128,128,128, + 255,255,255,200,208,212,200,208,212,200,208,212,200,208,212,200,208, + 212,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212,200, + 208,212,200,208,212,200,208,212,200,208,212,200,208,212,200,208,212, + 128,128,128,255,255,255,255, 0,255,255, 0,255, 0, 0, 0,255, 0, + 255,128,128,128,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,200,208,212,255,255,255,255, 0,255,255, 0,255, 0, + 0, 0,255, 0,255,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,200,208,212,255, 0,255, + 255, 0,255, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0, + 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, + 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, + 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0, + 255,255, 0,255,255, 0,255, 0, 0, 0); + diff --git a/examples/apps/uidesigner/newformdesigner.pas b/examples/apps/uidesigner/newformdesigner.pas index 5fb1701a..0f6af0f8 100644 --- a/examples/apps/uidesigner/newformdesigner.pas +++ b/examples/apps/uidesigner/newformdesigner.pas @@ -276,7 +276,7 @@ var begin {@VFD_BODY_BEGIN: frmMain} Name := 'frmMain'; - SetPosition(84, 123, 695, 87); + SetPosition(84, 123, 728, 87); WindowTitle := 'frmMain'; WindowPosition := wpUser; gINI.ReadFormState(self); @@ -285,7 +285,7 @@ begin with MainMenu do begin Name := 'MainMenu'; - SetPosition(0, 0, 696, 24); + SetPosition(0, 0, 729, 24); Anchors := [anLeft,anRight,anTop]; end; @@ -332,7 +332,7 @@ begin with wgpalette do begin Name := 'wgpalette'; - SetPosition(116, 28, 580, 28); + SetPosition(116, 28, 613, 28); Anchors := [anLeft,anRight,anTop]; Focusable := False; end; diff --git a/examples/apps/uidesigner/uidesigner.lpi b/examples/apps/uidesigner/uidesigner.lpi index 683e219a..0d892a09 100644 --- a/examples/apps/uidesigner/uidesigner.lpi +++ b/examples/apps/uidesigner/uidesigner.lpi @@ -33,7 +33,7 @@ - + @@ -104,6 +104,14 @@ + + + + + + + + diff --git a/examples/apps/uidesigner/vfdwidgets.pas b/examples/apps/uidesigner/vfdwidgets.pas index d47f0d88..fb41337f 100644 --- a/examples/apps/uidesigner/vfdwidgets.pas +++ b/examples/apps/uidesigner/vfdwidgets.pas @@ -200,6 +200,12 @@ begin 'vfd.combodateedit', @stdimg_vfd_dateedit, sizeof(stdimg_vfd_dateedit), 0, 0); + + fpgImages.AddMaskedBMP( + 'vfd.bevel', @stdimg_vfd_bevel, + sizeof(stdimg_vfd_bevel), + 0, 0); + end; procedure AddWidgetPosProps(wgc: TVFDWidgetClass); @@ -334,6 +340,16 @@ begin wc.WidgetIconName := 'vfd.stringgrid'; RegisterVFDWidget(wc); + // Bevel + wc := TVFDWidgetClass.Create(TfpgBevel); + wc.NameBase := 'bvlName'; + wc.AddProperty('BorderStyle', TPropertyEnum, 'Single or Double'); + wc.AddProperty('Style', TPropertyEnum, 'Raised or Lower look'); + wc.AddProperty('Shape', TPropertyEnum, 'Box, Frame, TopLine, Spacer etc..'); + wc.WidgetIconName := 'vfd.bevel'; + wc.Container := True; + RegisterVFDWidget(wc); + // Panel wc := TVFDWidgetClass.Create(TfpgPanel); wc.NameBase := 'pnlName'; diff --git a/images/bevel.bmp b/images/bevel.bmp new file mode 100644 index 00000000..758cae75 Binary files /dev/null and b/images/bevel.bmp differ diff --git a/prototypes/fpgui2/tests/edittest.lpr b/prototypes/fpgui2/tests/edittest.lpr index dd407ad8..24fb9db0 100644 --- a/prototypes/fpgui2/tests/edittest.lpr +++ b/prototypes/fpgui2/tests/edittest.lpr @@ -68,6 +68,7 @@ type procedure checkbox1Changed(Sender: TObject); procedure TrackBarChanged(Sender: TObject; APosition: integer); procedure xpsilverClick(Sender: TObject); + procedure Combo1Changed(Sender: TObject); public label1: TfpgLabel; label2: TfpgLabel; @@ -311,6 +312,17 @@ begin BackgroundColor := clWindowBackground; end; +procedure TMainForm.Combo1Changed(Sender: TObject); +begin + // ilImageLeft, ilImageTop, ilImageRight, ilImageBottom + case combo1.FocusItem of + 0: btn.ImageLayout := ilImageLeft; + 1: btn.ImageLayout := ilImageTop; + 2: btn.ImageLayout := ilImageRight; + 3: btn.ImageLayout := ilImageBottom; + end; +end; + procedure TMainForm.Trackbar1Changed(Sender: TObject; APosition: integer); begin progress.Position := APosition; @@ -427,14 +439,19 @@ begin btn := CreateButton(self, 10, 130, 75, 'Close', @btnCloseClick); btn.ImageName := 'stdimg.close'; btn.ShowImage := True; + btn.Height := 55; - combo1 := CreateComboBox(self, 10, 160, 120, nil); + combo1 := CreateComboBox(self, 10, 200, 120, nil); combo1.BackgroundColor := clYellow; - combo1.TextColor := clRed; - for i := 1 to 5 do - combo1.Items.Add(Format('Items %.2d', [i])); - - combo2 := CreateComboBox(self, 10, 190, 120, nil); + combo1.TextColor := clBlue; + combo1.Items.Add('ilImageLeft'); + combo1.Items.Add('ilImageTop'); + combo1.Items.Add('ilImageRight'); + combo1.Items.Add('ilImageBottom'); + combo1.FocusItem := 0; + combo1.OnChange := @Combo1Changed; + + combo2 := CreateComboBox(self, 10, 230, 120, nil); for i := 1 to 20 do combo2.Items.Add(Format('Items %.2d', [i])); diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas index a49f3cca..7c46c6d1 100644 --- a/src/corelib/gfx_widget.pas +++ b/src/corelib/gfx_widget.pas @@ -575,6 +575,7 @@ var n: integer; c: TComponent; begin +// writeln('Widget.HandleShow - ', ClassName, ' x:', Left, ' y:', Top, ' w:', Width, ' h:', Height); FOnScreen := True; // FVisible := True; @@ -897,6 +898,7 @@ end; procedure TfpgWidget.MsgPaint(var msg: TfpgMessageRec); begin +// writeln('TfpgWidget.MsgPaint - ', Classname); Canvas.BeginDraw; HandlePaint; if Assigned(FOnPaint) then diff --git a/src/gui/gui_button.pas b/src/gui/gui_button.pas index 9ca528ae..1f24a13b 100644 --- a/src/gui/gui_button.pas +++ b/src/gui/gui_button.pas @@ -484,7 +484,6 @@ var begin // inherited HandlePaint; -// Canvas.Clear(FBackgroundColor); // Do we need this? Canvas.ClearClipRect; r.SetRect(0, 0, Width, Height); diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas index e2d2c6d9..1ec52a88 100644 --- a/src/gui/gui_form.pas +++ b/src/gui/gui_form.pas @@ -159,6 +159,7 @@ end; procedure TfpgBaseForm.MsgActivate(var msg: TfpgMessageRec); begin +// writeln('BaseForm - MsgActivate'); if (fpgApplication.TopModalForm = nil) or (fpgApplication.TopModalForm = self) then begin FocusRootWidget := self; @@ -307,24 +308,10 @@ begin end; procedure TfpgBaseForm.HandleShow; -{$IFDEF LINUX} -var - dw: integer; - dh: integer; -{$ENDIF} begin inherited HandleShow; if Assigned(FOnShow) then FOnShow(self); - {$IFDEF UNIX} - { TODO : A temporary work-around because XLib doesn't sent a Resize event - when the form is created. It's clever enough to size the form beforehand, - but without this call the Alignment code doesn't execute. } - -// dw := FPrevWidth - FWidth; -// dh := FPrevHeight - FHeight; -// HandleAlignments(0, 0); - {$ENDIF} end; procedure TfpgBaseForm.HandleMove(x, y: TfpgCoord); diff --git a/src/gui/gui_panel.pas b/src/gui/gui_panel.pas index fc9df44d..2dc848b5 100644 --- a/src/gui/gui_panel.pas +++ b/src/gui/gui_panel.pas @@ -306,6 +306,19 @@ begin Canvas.DrawLine(Width - 1, 0, Width - 1, Height - 1); if Shape in [bsBox, bsFrame, bsBottomLine] then Canvas.DrawLine(0, Height - 1, Width, Height - 1); + + // To make it more visible in the UI Designer + if csDesigning in ComponentState then + begin + if Shape in [bsSpacer] then + begin + Canvas.SetColor(clInactiveWgFrame); + Canvas.SetLineStyle(1, lsDash); + Canvas.DrawRectangle(0, 0, Width, Height); +// Canvas.SetTextColor(clText1); +// Canvas.DrawString(2, 2, Name + ': ' + Classname); + end; + end; end; {TfpgPanel} -- cgit v1.2.3-70-g09d2