diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2014-09-19 16:03:47 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2014-09-19 16:03:47 +0100 |
commit | 0e22d024b497675c0fb5098d8d90638ce53208c1 (patch) | |
tree | d3b170788584f814d2abd090ac09dde8180da5cd /docview/src | |
parent | 8409869f55b178214d4a20f39e19603817d55105 (diff) | |
download | fpGUI-0e22d024b497675c0fb5098d8d90638ce53208c1.tar.xz |
docview: Adds an "About..." menu item in the Windows System Menu of the main form.
Just for fun and can be disabled if needed.
Diffstat (limited to 'docview/src')
-rw-r--r-- | docview/src/frm_main.pas | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/docview/src/frm_main.pas b/docview/src/frm_main.pas index 802c3600..7b0804db 100644 --- a/docview/src/frm_main.pas +++ b/docview/src/frm_main.pas @@ -2,9 +2,16 @@ unit frm_main; {$mode objfpc}{$H+} +{$IFDEF WINDOWS} + {$define ABOUT_SYSMENU} +{$ENDIF} + interface uses + {$IFDEF ABOUT_SYSMENU} + Windows, // Used for HMENU to add a new menu to the window System Menu. This feature is just for fun. + {$ENDIF} SysUtils, Classes, fpg_base, fpg_main, fpg_form, fpg_panel, fpg_tab, fpg_tree, fpg_splitter, fpg_menu, fpg_button, fpg_listbox, fpg_label, fpg_edit, fpg_radiobutton, fpg_progressbar, fpg_imagelist, @@ -202,6 +209,7 @@ type // Used in loading contents procedure AddChildNodes(AHelpFile: THelpFile; AParentNode: TfpgTreeNode; ALevel: longint; var ATopicIndex: longint ); procedure ClearIndexComponents; + procedure ProcessAboutMsg(var Msg: TfpgMessageRec); message FPGM_ABOUT; // Note manipulations -------------------------------- // make sure that note insert positions are not in @@ -634,6 +642,11 @@ end; procedure TMainForm.MainFormShow(Sender: TObject); var lFilename: TfpgString; + {$IFDEF ABOUT_SYSMENU} + hSysMenu: HMENU; +const + ID_ABOUT = 200001; // Must match the definition in fpg_gdi.pas + {$ENDIF} begin bvlBody.Realign; @@ -660,6 +673,12 @@ begin OpenFile(lFilename, '', true); end; end; + // This is just for fun! ;-) + {$IFDEF ABOUT_SYSMENU} + hSysMenu := GetSystemMenu(self.WinHandle, false); + AppendMenu(hSysMenu, MF_SEPARATOR, 0, nil); + AppendMenu(hSysMenu, MF_STRING, ID_ABOUT, PChar('&About fpGUI Toolkit...')); + {$ENDIF} end; procedure TMainForm.MainFormDestroy(Sender: TObject); @@ -889,7 +908,7 @@ end; procedure TMainForm.miToolsShowEnvVariablesClicked(Sender: TObject); function LGetEnvVarValue(const AVariable: string): string; begin - Result := Format('%s = ''%s''', [AVariable, GetEnvironmentVariable(AVariable)]); + Result := Format('%s = ''%s''', [AVariable, SysUtils.GetEnvironmentVariable(AVariable)]); end; begin RichView.Clear; @@ -2223,6 +2242,11 @@ begin IndexLoaded := False; end; +procedure TMainForm.ProcessAboutMsg(var Msg: TfpgMessageRec); +begin + TfpgMessageDialog.AboutFPGui; +end; + procedure TMainForm.CorrectNotesPositions(Topic: TTopic; AText: pchar); var NoteIndex: longint; |