diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-14 15:04:05 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-14 15:04:05 +0000 |
commit | acc50fa5d7ef195ae5f1746130a7edee646feab7 (patch) | |
tree | 35f0d6b51b76727ad0743685aaceeae42b00f20a | |
parent | 856316cb9bdcc51fc9ccd9d0dd0276197e69ad69 (diff) | |
download | fpGUI-acc50fa5d7ef195ae5f1746130a7edee646feab7.tar.xz |
* Updated a few scripts in the docs directory.
* Minor changes in the style unit.
* Added a new examples/apps/docedit project. Once complete it will be a demo
application of fpGUI and at the same time show most used widgets in action.
DocEdit will become something like lazde is to Lazarus.
-rwxr-xr-x | docs/build_gfx.sh | 28 | ||||
-rwxr-xr-x | docs/build_gui.sh | 32 | ||||
-rwxr-xr-x | docs/new_gui.sh | 41 | ||||
-rw-r--r-- | examples/apps/docedit/docedit.lpi | 61 | ||||
-rw-r--r-- | examples/apps/docedit/docedit.lpr | 28 | ||||
-rw-r--r-- | examples/apps/docedit/frm_main.pas | 81 | ||||
-rw-r--r-- | src/corelib/fpgfx.pas | 2 | ||||
-rw-r--r-- | src/corelib/gfxbase.pas | 8 | ||||
-rw-r--r-- | src/gui/gui_dialogs.pas | 21 | ||||
-rw-r--r-- | src/gui/gui_form.pas | 2 | ||||
-rw-r--r-- | src/gui/gui_style.pas | 11 |
11 files changed, 289 insertions, 26 deletions
diff --git a/docs/build_gfx.sh b/docs/build_gfx.sh index 22ddc793..2108e2fe 100755 --- a/docs/build_gfx.sh +++ b/docs/build_gfx.sh @@ -1,14 +1,22 @@ #!/bin/sh # fpc/bin must be in your PATH -fpdoc --package=fpgfx \ +fpdoc --package=CoreLib \ --format=html \ - --output=html/gfx/ \ - --content=html/gfx.cnt \ + --output=html/corelib/ \ + --content=html/corelib.cnt \ --import=html/gui.cnt,../gui/ \ - --input='-Fi../gfx ../gfx/fpgfx.pas' --descr=xml/gfx/fpgfx.xml \ - --input='-Fi../gfx ../gfx/gfxbase.pas' --descr=xml/gfx/gfxbase.xml \ - --input='-Fi../gfx ../gfx/geldirty.pas' --descr=xml/gfx/geldirty.xml \ - --input='-Fi../gfx ../gfx/gelimage.pas' --descr=xml/gfx/gelimage.xml \ - --input='-Fi../gfx ../gfx/x11/gfxinterface.pas' --descr=xml/gfx/gfxinterface.xml \ - --input='-Fi../gfx ../gfx/x11/gfx_x11.pas' --descr=xml/gfx/gfx_x11.xml \ - --input='-Fi../gfx ../gfx/x11/unitxft.pas' --descr=xml/gfx/unitxft.xml + --input='-Fi../src/corelib ../src/corelib/gfxbase.pas' --descr=xml/corelib/gfxbase.xml \ + --input='-Fi../src/corelib ../src/corelib/x11/gfx_x11.pas' --descr=xml/corelib/x11/gfx_x11.xml \ + --input='-Fi../src/corelib ../src/corelib/gdi/gfx_gdi.pas' --descr=xml/corelib/gdi/gfx_gdi.xml \ + --input='-Fi../src/corelib ../src/corelib/fpgfx.pas' --descr=xml/corelib/fpgfx.xml \ + --input='-Fi../src/corelib ../src/corelib/gfx_clipboard.pas' --descr=xml/corelib/gfx_clipboard.xml \ + --input='-Fi../src/corelib ../src/corelib/gfx_cmdlineparams.pas' --descr=xml/corelib/gfx_cmdlineparams.xml \ + --input='-Fi../src/corelib ../src/corelib/gfx_extinterpolation.pas' --descr=xml/corelib/gfx_extinterpolation.xml \ + --input='-Fi../src/corelib ../src/corelib/gfx_imgfmt_bmp.pas' --descr=xml/corelib/gfx_imgfmt_bmp.xml \ + --input='-Fi../src/corelib ../src/corelib/gfx_stdimages.pas' --descr=xml/corelib/gfx_stdimages.xml \ + --input='-Fi../src/corelib ../src/corelib/gfx_utf8utils.pas' --descr=xml/corelib/gfx_utf8utils.xml \ + --input='-Fi../src/corelib ../src/corelib/gfx_widget.pas' --descr=xml/corelib/gfx_widget.xml + + +# --input='-Fi../src/corelib ../src/corelib/x11/gfx_.pas' --descr=xml/corelib/gfx_.xml \ + diff --git a/docs/build_gui.sh b/docs/build_gui.sh index 1b595688..caf77b84 100755 --- a/docs/build_gui.sh +++ b/docs/build_gui.sh @@ -1,13 +1,31 @@ #!/bin/sh # fpc/bin must be in your PATH -fpdoc --package=fpgui \ +fpdoc --package=GUI \ --format=html \ --output=html/gui/ \ --content=html/gui.cnt \ - --import=html/gfx.cnt,../gfx/ \ - --descr=xml/gui/fpgui.xml --input='-Fi../gui ../gui/fpgui.pas' \ - --descr=xml/gui/stylemanager.xml --input='-Fi../gui ../gui/stylemanager.pas' \ - --descr=xml/gui/windowsstyle.xml --input='-Fi../gui ../gui/windowsstyle.pas' \ - --descr=xml/gui/motifstyle.xml --input='-Fi../gui ../gui/motifstyle.pas' \ - --descr=xml/gui/opensoftstyle.xml --input='-Fi../gui ../gui/opensoftstyle.pas' + --import=html/corelib.cnt,../corelib/ \ + --descr=xml/gui/gui_basegrid.xml --input='-Fi../src/gui ../src/gui/gui_basegrid.pas' \ + --descr=xml/gui/gui_bevel.xml --input='-Fi../src/gui ../src/gui/gui_bevel.pas' \ + --descr=xml/gui/gui_button.xml --input='-Fi../src/gui ../src/gui/gui_button.pas' \ + --descr=xml/gui/gui_checkbox.xml --input='-Fi../src/gui ../src/gui/gui_checkbox.pas' \ + --descr=xml/gui/gui_combobox.xml --input='-Fi../src/gui ../src/gui/gui_combobox.pas' \ + --descr=xml/gui/gui_customgrid.xml --input='-Fi../src/gui ../src/gui/gui_customgrid.pas' \ + --descr=xml/gui/gui_dialogs.xml --input='-Fi../src/gui ../src/gui/gui_dialogs.pas' \ + --descr=xml/gui/gui_edit.xml --input='-Fi../src/gui ../src/gui/gui_edit.pas' \ + --descr=xml/gui/gui_form.xml --input='-Fi../src/gui ../src/gui/gui_form.pas' \ + --descr=xml/gui/gui_label.xml --input='-Fi../src/gui ../src/gui/gui_label.pas' \ + --descr=xml/gui/gui_listbox.xml --input='-Fi../src/gui ../src/gui/gui_listbox.pas' \ + --descr=xml/gui/gui_listview.xml --input='-Fi../src/gui ../src/gui/gui_listview.pas' \ + --descr=xml/gui/gui_memo.xml --input='-Fi../src/gui ../src/gui/gui_memo.pas' \ + --descr=xml/gui/gui_popupwindow.xml --input='-Fi../src/gui ../src/gui/gui_popupwindow.pas' \ + --descr=xml/gui/gui_progressbar.xml --input='-Fi../src/gui ../src/gui/gui_progressbar.pas' \ + --descr=xml/gui/gui_radiobutton.xml --input='-Fi../src/gui ../src/gui/gui_radiobutton.pas' \ + --descr=xml/gui/gui_scrollbar.xml --input='-Fi../src/gui ../src/gui/gui_scrollbar.pas' \ + --descr=xml/gui/gui_style.xml --input='-Fi../src/gui ../src/gui/gui_style.pas' \ + --descr=xml/gui/gui_tab.xml --input='-Fi../src/gui ../src/gui/gui_tab.pas' \ + --descr=xml/gui/gui_trackbar.xml --input='-Fi../src/gui ../src/gui/gui_trackbar.pas' + + +# --descr=xml/gui/gui_.xml --input='-Fi../src/gui ../src/gui/gui_.pas' \ diff --git a/docs/new_gui.sh b/docs/new_gui.sh new file mode 100755 index 00000000..d41f9dc3 --- /dev/null +++ b/docs/new_gui.sh @@ -0,0 +1,41 @@ +####### CoreLib +makeskel --package=CoreLib --output=xml/corelib/gfxbase.xml --input='-Fi../src/corelib ../src/corelib/gfxbase.pas' +makeskel --package=CoreLib --output=xml/corelib/x11/gfx_x11.xml --input='-Fi../src/corelib ../src/corelib/x11/gfx_x11.pas' +makeskel --package=CoreLib --output=xml/corelib/gdi/gfx_gdi.xml --input='-Fi../src/corelib ../src/corelib/gdi/gfx_gdi.pas' +makeskel --package=CoreLib --output=xml/corelib/fpgfx.xml --input='-Fi../src/corelib ../src/corelib/fpgfx.pas' +makeskel --package=CoreLib --output=xml/corelib/gfx_clipboard.xml --input='-Fi../src/corelib ../src/corelib/gfx_clipboard.pas' +makeskel --package=CoreLib --output=xml/corelib/gfx_cmdlineparams.xml --input='-Fi../src/corelib ../src/corelib/gfx_cmdlineparams.pas' +makeskel --package=CoreLib --output=xml/corelib/gfx_extinterpolation.xml --input='-Fi../src/corelib ../src/corelib/gfx_extinterpolation.pas' +makeskel --package=CoreLib --output=xml/corelib/gfx_imgfmt_bmp.xml --input='-Fi../src/corelib ../src/corelib/gfx_imgfmt_bmp.pas' +makeskel --package=CoreLib --output=xml/corelib/gfx_stdimages.xml --input='-Fi../src/corelib ../src/corelib/gfx_stdimages.pas' +makeskel --package=CoreLib --output=xml/corelib/gfx_utf8utils.xml --input='-Fi../src/corelib ../src/corelib/gfx_utf8utils.pas' +makeskel --package=CoreLib --output=xml/corelib/gfx_widget.xml --input='-Fi../src/corelib ../src/corelib/gfx_widget.pas' + +# makeskel --package=CoreLib --output=xml/corelib/gfx_.xml --input='-Fi../src/corelib ../src/corelib/gfx_.pas' + +####### GUI +makeskel --package=GUI --output=xml/gui/gui_basegrid.xml --input='-Fi../src/gui ../src/gui/gui_basegrid.pas' +makeskel --package=GUI --output=xml/gui/gui_bevel.xml --input='-Fi../src/gui ../src/gui/gui_bevel.pas' +makeskel --package=GUI --output=xml/gui/gui_button.xml --input='-Fi../src/gui ../src/gui/gui_button.pas' +makeskel --package=GUI --output=xml/gui/gui_checkbox.xml --input='-Fi../src/gui ../src/gui/gui_checkbox.pas' +makeskel --package=GUI --output=xml/gui/gui_combobox.xml --input='-Fi../src/gui ../src/gui/gui_combobox.pas' +makeskel --package=GUI --output=xml/gui/gui_customgrid.xml --input='-Fi../src/gui ../src/gui/gui_customgrid.pas' +makeskel --package=GUI --output=xml/gui/gui_dialogs.xml --input='-Fi../src/gui ../src/gui/gui_dialogs.pas' +makeskel --package=GUI --output=xml/gui/gui_edit.xml --input='-Fi../src/gui ../src/gui/gui_edit.pas' +makeskel --package=GUI --output=xml/gui/gui_form.xml --input='-Fi../src/gui ../src/gui/gui_form.pas' +makeskel --package=GUI --output=xml/gui/gui_label.xml --input='-Fi../src/gui ../src/gui/gui_label.pas' +makeskel --package=GUI --output=xml/gui/gui_listbox.xml --input='-Fi../src/gui ../src/gui/gui_listbox.pas' +makeskel --package=GUI --output=xml/gui/gui_listview.xml --input='-Fi../src/gui ../src/gui/gui_listview.pas' +makeskel --package=GUI --output=xml/gui/gui_memo.xml --input='-Fi../src/gui ../src/gui/gui_memo.pas' +makeskel --package=GUI --output=xml/gui/gui_popupwindow.xml --input='-Fi../src/gui ../src/gui/gui_popupwindow.pas' +makeskel --package=GUI --output=xml/gui/gui_progressbar.xml --input='-Fi../src/gui ../src/gui/gui_progressbar.pas' +makeskel --package=GUI --output=xml/gui/gui_radiobutton.xml --input='-Fi../src/gui ../src/gui/gui_radiobutton.pas' +makeskel --package=GUI --output=xml/gui/gui_scrollbar.xml --input='-Fi../src/gui ../src/gui/gui_scrollbar.pas' +makeskel --package=GUI --output=xml/gui/gui_style.xml --input='-Fi../src/gui ../src/gui/gui_style.pas' +makeskel --package=GUI --output=xml/gui/gui_tab.xml --input='-Fi../src/gui ../src/gui/gui_tab.pas' +makeskel --package=GUI --output=xml/gui/gui_trackbar.xml --input='-Fi../src/gui ../src/gui/gui_trackbar.pas' + + +# makeskel --package=GUI --output=xml/gui/gui_.xml --input='-Fi../src/gui ../src/gui/gui_.pas' + + diff --git a/examples/apps/docedit/docedit.lpi b/examples/apps/docedit/docedit.lpi new file mode 100644 index 00000000..059210cb --- /dev/null +++ b/examples/apps/docedit/docedit.lpi @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <TargetFileExt Value=""/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="FCL"/> + </Item1> + <Item2> + <PackageName Value="fpgui_package"/> + <MinVersion Minor="5" Valid="True"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="docedit.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="docedit"/> + </Unit0> + <Unit1> + <Filename Value="frm_main.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="frm_main"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/apps/docedit/docedit.lpr b/examples/apps/docedit/docedit.lpr new file mode 100644 index 00000000..cb9978d2 --- /dev/null +++ b/examples/apps/docedit/docedit.lpr @@ -0,0 +1,28 @@ +program docedit; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, + fpgfx, + frm_main; + + +procedure MainProc; +var + frm: TMainForm; +begin + fpgApplication.Initialize; + frm := TMainForm.Create(nil); + frm.Show; + fpgApplication.Run; +end; + +begin + MainProc; +end. + + diff --git a/examples/apps/docedit/frm_main.pas b/examples/apps/docedit/frm_main.pas new file mode 100644 index 00000000..cae208bd --- /dev/null +++ b/examples/apps/docedit/frm_main.pas @@ -0,0 +1,81 @@ +unit frm_main; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + fpgfx, + gui_form, + gui_button, + gui_edit, + gui_label; + +type + TMainForm = class(TfpgForm) + private + btnQuit: TfpgButton; + lblXMLFile: TfpgLabel; + edXMLFile: TfpgEdit; + btnOpen: TfpgButton; + procedure btnQuitClicked(Sender: TObject); + procedure btnOpenClicked(Sender: TObject); + procedure InitializeComponents; + public + constructor Create(AOwner: TComponent); override; + end; + + +implementation + +{ TMainForm } + +procedure TMainForm.btnQuitClicked(Sender: TObject); +begin + Close; +end; + +procedure TMainForm.btnOpenClicked(Sender: TObject); +begin + // open xml file +end; + +procedure TMainForm.InitializeComponents; +begin + btnQuit := CreateButton(self, Width-88, Height-31, 80, 'Quit', @btnQuitClicked); + with btnQuit do + begin + ImageName := 'stdimg.Quit'; + ShowImage := True; + Anchors := [anRight, anBottom]; + end; + + lblXMLFile := CreateLabel(self, 8, 8, 'XML File:'); + edXMLFile := CreateEdit(self, lblXMLFile.Right+8, lblXMLFile.Top-2, 485, 23); + edXMLFile.Text := '/home/graemeg/programming/fpgui/docs/xml/corelib/gfx_clipboard.xml'; + + btnOpen := CreateButton(self, edXMLFile.Right+10, edXMLFile.Top, 80, 'Open', @btnOpenClicked); + with btnOpen do + begin + ImageName := 'stdimg.Open'; + ShowImage := True; + end; + +end; + +constructor TMainForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WindowTitle := 'Documentation Editor'; + Sizeable := False; + // Golden ratio 1.618 + Width := 650; + Height := 402; + + InitializeComponents; +end; + +end. + diff --git a/src/corelib/fpgfx.pas b/src/corelib/fpgfx.pas index daa244c1..cd13ccef 100644 --- a/src/corelib/fpgfx.pas +++ b/src/corelib/fpgfx.pas @@ -133,6 +133,8 @@ type public constructor Create(awin: TfpgWindow); reintroduce; destructor Destroy; override; + + // As soon as TfpgStyle has moved out of CoreLib, these must go! procedure DrawButtonFace(x, y, w, h: TfpgCoord; AFlags: TFButtonFlags); procedure DrawButtonFace(r: TfpgRect; AFlags: TFButtonFlags); procedure DrawControlFrame(x, y, w, h: TfpgCoord); diff --git a/src/corelib/gfxbase.pas b/src/corelib/gfxbase.pas index 8d7f814f..5554fbcd 100644 --- a/src/corelib/gfxbase.pas +++ b/src/corelib/gfxbase.pas @@ -337,10 +337,12 @@ type procedure ReleaseWindowHandle; procedure SetWindowTitle(const ATitle: string); virtual; public + // The standard constructor. constructor Create(AOwner: TComponent); override; - // make some setup before the window shows - procedure AdjustWindowStyle; virtual; // forms modify the window creation parameters - procedure SetWindowParameters; virtual; // invoked after the window is created + // Make some setup before the window shows. Forms modify the window creation parameters. + procedure AdjustWindowStyle; virtual; + // Make some setup before the window shows. Invoked after the window is created. + procedure SetWindowParameters; virtual; // general properties and functions function Right: TfpgCoord; function Bottom: TfpgCoord; diff --git a/src/gui/gui_dialogs.pas b/src/gui/gui_dialogs.pas index 9b26e3c4..76648a68 100644 --- a/src/gui/gui_dialogs.pas +++ b/src/gui/gui_dialogs.pas @@ -23,8 +23,8 @@ uses type - { TfpgMessageBox } - + { @abstract(A standard message box dialog.) It is used by the global @link(ShowMessage) + function. } TfpgMessageBox = class(TfpgForm) private FLines: TStringList; @@ -40,10 +40,14 @@ type public constructor Create(AOwner : TComponent); override; destructor Destroy; override; + { This sets the message to be displayed. } procedure SetMessage(AMessage: string); end; - + + { @abstract(A abstract dialog which forms the basis of other dialogs.) This + dialog implements the two basic buttons (OK, Cancel) and also some keyboard + support like Escape to close the dialog.} TfpgBaseDialog = class(TfpgForm) protected FSpacing: integer; @@ -57,7 +61,11 @@ type constructor Create(AOwner: TComponent); override; end; - + + { @abstract(A standard font selection dialog.) It also contains a Collection + listbox which gets automatically populated based on the available fonts. + There are two custom collections called Favourites and Recently Used which + list you own selection of fonts.} TfpgFontSelectDialog = class(TfpgBaseDialog) private FSampleText: string; @@ -81,13 +89,16 @@ type procedure SetFontDesc(Desc: string); public constructor Create(AOwner: TComponent); override; + { This well set the sample text or font preview text to AText.} procedure SetSampleText(AText: string); end; - +{ A convenience function to show a message using the TfpgMessageBox class.} procedure ShowMessage(AMessage, ATitle: string); overload; +{ A convenience function to show a message using the TfpgMessageBox class.} procedure ShowMessage(AMessage: string); overload; +{ A convenience function to show the font selection dialog (TfpgFontSelectDialog).} function SelectFontDialog(var FontDesc: string): boolean; diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas index 2e7472b7..10de2a44 100644 --- a/src/gui/gui_form.pas +++ b/src/gui/gui_form.pas @@ -159,7 +159,7 @@ end; constructor TfpgForm.Create(AOwner: TComponent); begin inherited; - FWindowPosition := wpUser; + FWindowPosition := wpAuto; FWindowTitle := ''; FSizeable := True; FParentForm := nil; diff --git a/src/gui/gui_style.pas b/src/gui/gui_style.pas index 623a5441..c2dff33b 100644 --- a/src/gui/gui_style.pas +++ b/src/gui/gui_style.pas @@ -99,6 +99,17 @@ type end; + TfpgButtonFeatures = set of (bfNone, bfFlat, bfDefault); + + // Button specific options + TfpgButtonStyleOption = class(TfpgStyleOption) + private + FButtonFeatures: TfpgButtonFeatures; + public + property ButtonFeatures: TfpgButtonFeatures read FButtonFeatures write FButtonFeatures; + end; + + TfpgBaseStyle = class(TObject) public procedure DrawControl(element: TfpgControlElement; const option: TfpgStyleOption; canvas: TfpgCanvas; widget: TfpgWidget = nil); virtual; abstract; |