summaryrefslogtreecommitdiff
path: root/examples/gui/customstyles/customstyles.lpr
blob: 419e645627f31b6d9610d1037c466a5c2c776d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
    fpGUI  -  Free Pascal GUI Toolkit

    Copyright (C) 2006 - 2011 See the file AUTHORS.txt, included in this
    distribution, for details of the copyright.

    See the file COPYING.modifiedLGPL, included in this distribution,
    for details about redistributing fpGUI.

    This program 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.

    Description:
      This example demonstrates how to define a new theme/style and how
      to use it. Styles can be changed at runtime via the --style parameter.
      eg:

        $ ./customestyle --style 'Demo Style'
        $ ./customestyle --style Win2000
        $ ./customestyle --style 'demo style'

      Note that the style name is not case sensitive. Also if the style
      name consists of more than one word, in needs to be between single
      quotes.
}


program customstyles;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
  ,fpg_main
  ,fpg_cmdlineparams
  ,fpg_stylemanager
  ,frm_test
  ,mystyle
  ;


procedure MainProc;
var
  frm: TTestForm;
begin
  fpgApplication.Initialize;

  { Set our new style as the default (before we create any forms), unless
    a the end-user specified a different style via the command line. }
  if not gCommandLineParams.IsParam('style') then
    if fpgStyleManager.SetStyle('Demo Style') then
      fpgStyle := fpgStyleManager.Style;

  frm := TTestForm.Create(nil);
  try
    frm.Show;
    fpgApplication.Run;
  finally
    frm.Free;
  end;
end;

begin
  MainProc;
end.