mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 10:20:19 +02:00
wiki test: started options
git-svn-id: trunk@35793 -
This commit is contained in:
parent
46191839c5
commit
d49fc859ad
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -2875,6 +2875,8 @@ components/wiki/test/wikisearchdemo.lpr svneol=native#text/plain
|
||||
components/wiki/test/wikisearchdemo.res -text
|
||||
components/wiki/test/wikisearchmain.lfm svneol=native#text/plain
|
||||
components/wiki/test/wikisearchmain.pas svneol=native#text/plain
|
||||
components/wiki/test/wikisearchoptions.lfm svneol=native#text/plain
|
||||
components/wiki/test/wikisearchoptions.pas svneol=native#text/plain
|
||||
components/wiki/wikiconvert.lpi svneol=native#text/plain
|
||||
components/wiki/wikiconvert.lpr svneol=native#text/plain
|
||||
components/wiki/wikiget.lpi svneol=native#text/plain
|
||||
|
42
components/wiki/test/wikisearchoptions.lfm
Normal file
42
components/wiki/test/wikisearchoptions.lfm
Normal file
@ -0,0 +1,42 @@
|
||||
object WikiSearchOptsWnd: TWikiSearchOptsWnd
|
||||
Left = 364
|
||||
Height = 308
|
||||
Top = 392
|
||||
Width = 364
|
||||
Caption = 'WikiSearchOptsWnd'
|
||||
ClientHeight = 308
|
||||
ClientWidth = 364
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.31'
|
||||
object LanguagesGroupBox: TGroupBox
|
||||
Left = 0
|
||||
Height = 308
|
||||
Top = 0
|
||||
Width = 159
|
||||
Align = alLeft
|
||||
Caption = 'LanguagesGroupBox'
|
||||
ClientHeight = 292
|
||||
ClientWidth = 155
|
||||
TabOrder = 0
|
||||
object LanguagesTreeView: TTreeView
|
||||
Left = 0
|
||||
Height = 292
|
||||
Top = 0
|
||||
Width = 155
|
||||
Align = alClient
|
||||
DefaultItemHeight = 16
|
||||
ReadOnly = True
|
||||
ShowLines = False
|
||||
ShowRoot = False
|
||||
TabOrder = 0
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoToolTips, tvoThemedDraw]
|
||||
end
|
||||
end
|
||||
object LanguagesSplitter: TSplitter
|
||||
Left = 159
|
||||
Height = 308
|
||||
Top = 0
|
||||
Width = 5
|
||||
end
|
||||
end
|
102
components/wiki/test/wikisearchoptions.pas
Normal file
102
components/wiki/test/wikisearchoptions.pas
Normal file
@ -0,0 +1,102 @@
|
||||
{ Search options offline wiki
|
||||
|
||||
Copyright (C) 2012 Mattias Gaertner mattias@freepascal.org
|
||||
|
||||
This source is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This code is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
details.
|
||||
|
||||
A copy of the GNU General Public License is available on the World Wide Web
|
||||
at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing
|
||||
to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
}
|
||||
unit WikiSearchOptions;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, WikiHelpManager, Forms, Controls, Graphics,
|
||||
Dialogs, ExtCtrls, StdCtrls, ComCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TWikiSearchOptsWnd }
|
||||
|
||||
TWikiSearchOptsWnd = class(TForm)
|
||||
LanguagesGroupBox: TGroupBox;
|
||||
LanguagesSplitter: TSplitter;
|
||||
LanguagesTreeView: TTreeView;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
FLanguages: string;
|
||||
procedure SetLanguages(AValue: string);
|
||||
public
|
||||
property Languages: string read FLanguages write SetLanguages;
|
||||
procedure UpdateAvailableLanguages;
|
||||
procedure UpdateSelectedLanguages;
|
||||
end;
|
||||
|
||||
var
|
||||
WikiSearchOptsWnd: TWikiSearchOptsWnd = nil;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TWikiSearchOptsWnd }
|
||||
|
||||
procedure TWikiSearchOptsWnd.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Caption:='Wiki Search Options';
|
||||
LanguagesGroupBox.Caption:='Languages';
|
||||
end;
|
||||
|
||||
procedure TWikiSearchOptsWnd.SetLanguages(AValue: string);
|
||||
begin
|
||||
if FLanguages=AValue then Exit;
|
||||
FLanguages:=AValue;
|
||||
end;
|
||||
|
||||
procedure TWikiSearchOptsWnd.UpdateAvailableLanguages;
|
||||
var
|
||||
Langs: TStrings;
|
||||
i: Integer;
|
||||
TVNode: TTreeNode;
|
||||
begin
|
||||
Langs:=WikiHelp.CollectAllLanguages(true);
|
||||
LanguagesTreeView.BeginUpdate;
|
||||
try
|
||||
for i:=0 to Langs.Count-1 do begin
|
||||
if i<LanguagesTreeView.Items.TopLvlCount then begin
|
||||
TVNode:=LanguagesTreeView.Items.TopLvlItems[i];
|
||||
TVNode.Text:=Langs[i];
|
||||
end else begin
|
||||
TVNode:=LanguagesTreeView.Items.Add(nil,Langs[i]);
|
||||
end;
|
||||
end;
|
||||
while LanguagesTreeView.Items.TopLvlCount>Langs.Count do
|
||||
LanguagesTreeView.Items.TopLvlItems[LanguagesTreeView.Items.TopLvlCount-1].Delete;
|
||||
finally
|
||||
LanguagesTreeView.EndUpdate;
|
||||
Langs.Free;
|
||||
end;
|
||||
UpdateSelectedLanguages;
|
||||
end;
|
||||
|
||||
procedure TWikiSearchOptsWnd.UpdateSelectedLanguages;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user