summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--images/checkboxes.bmpbin0 -> 2602 bytes
-rw-r--r--images/radiobuttons.bmpbin0 -> 2214 bytes
-rwxr-xr-ximages/stdimg_update.sh2
-rwxr-xr-ximages/stdimg_updatew.bat2
-rw-r--r--images/updatestdimgs.pas18
-rw-r--r--prototypes/fpgui2/tests/edittest.dpr259
-rw-r--r--prototypes/fpgui2/tests/edittest.lpi7
-rw-r--r--src/corelib/gfx_stdimages.pas56
-rw-r--r--src/corelib/gfx_widget.pas6
-rw-r--r--src/corelib/stdimages.inc291
-rw-r--r--src/gui/fpgui_package.lpk6
-rw-r--r--src/gui/fpgui_package.pas2
-rw-r--r--src/gui/gui_checkbox.pas44
-rw-r--r--src/gui/gui_radiobutton.pas238
14 files changed, 740 insertions, 191 deletions
diff --git a/images/checkboxes.bmp b/images/checkboxes.bmp
new file mode 100644
index 00000000..55be5dbd
--- /dev/null
+++ b/images/checkboxes.bmp
Binary files differ
diff --git a/images/radiobuttons.bmp b/images/radiobuttons.bmp
new file mode 100644
index 00000000..6523aa61
--- /dev/null
+++ b/images/radiobuttons.bmp
Binary files differ
diff --git a/images/stdimg_update.sh b/images/stdimg_update.sh
index c93744c9..677136da 100755
--- a/images/stdimg_update.sh
+++ b/images/stdimg_update.sh
@@ -1,3 +1,3 @@
#!/bin/sh
chmod +x updatestdimgs
-./updatestdimgs > ../source/core/stdimages.inc \ No newline at end of file
+./updatestdimgs > ../src/corelib/stdimages.inc
diff --git a/images/stdimg_updatew.bat b/images/stdimg_updatew.bat
index 35c410f2..64996667 100755
--- a/images/stdimg_updatew.bat
+++ b/images/stdimg_updatew.bat
@@ -1 +1 @@
-updatestdimgs > ../source/core/stdimages.inc \ No newline at end of file
+updatestdimgs > ../src/corelib/stdimages.inc
diff --git a/images/updatestdimgs.pas b/images/updatestdimgs.pas
index e476539f..2b3f9926 100644
--- a/images/updatestdimgs.pas
+++ b/images/updatestdimgs.pas
@@ -1,13 +1,23 @@
+{
+ This program searches for *.bmp files in the current directory and
+ outputs to stdout the bmp files found as byte array constants.
+}
program updatestdimgs;
{$IFDEF FPC}
- {$mode delphi}
- {$H+}
+ {$mode delphi}{$H+}
{$ELSE}
-{$APPTYPE CONSOLE}
+ {$APPTYPE CONSOLE}
{$ENDIF}
-uses SysUtils, {$ifdef Win32}Windows{$else}linux{$endif};
+uses
+ SysUtils
+ {$ifdef Win32}
+ ,Windows
+ {$else}
+ ,linux
+ {$endif}
+ ;
var
sr : TSearchRec;
diff --git a/prototypes/fpgui2/tests/edittest.dpr b/prototypes/fpgui2/tests/edittest.dpr
index 54dc2188..59b8e4af 100644
--- a/prototypes/fpgui2/tests/edittest.dpr
+++ b/prototypes/fpgui2/tests/edittest.dpr
@@ -17,7 +17,8 @@ uses
gui_memo,
gui_dialogs,
gui_listbox,
- gui_checkbox;
+ gui_checkbox,
+ gui_radiobutton;
type
@@ -53,6 +54,7 @@ type
procedure btnCloseClick(Sender: TObject);
procedure btnDisplayBMP(Sender: TObject);
procedure btn3Click(Sender: TObject);
+ procedure checkboxChanged(Sender: TObject);
public
label1: TfpgLabel;
label2: TfpgLabel;
@@ -70,6 +72,9 @@ type
xp2: TXPButton;
xpsilver: TXPButton;
checkbox: TfpgCheckBox;
+ radiobtn1: TfpgRadioButton;
+ radiobtn2: TfpgRadioButton;
+ radiobtn3: TfpgRadioButton;
procedure AfterCreate; override;
end;
@@ -245,134 +250,146 @@ begin
end;
- { TMainForm }
+{ TMainForm }
- procedure TMainForm.btnCloseClick(Sender: TObject);
- begin
- Close;
- end;
+procedure TMainForm.btnCloseClick(Sender: TObject);
+begin
+ Close;
+end;
- procedure TMainForm.btnDisplayBMP(Sender: TObject);
- var
- bmp: TfpgImage;
- begin
- bmp := LoadImage_BMP(SetDirSeparators('../../../images/themes/luna/button.bmp'));
- bmp.CreateMaskFromSample(0, 0);
- bmp.UpdateImage;
-
- Canvas.BeginDraw;
- Canvas.ClearClipRect;
- // For some reason, under Windows if I don't call this
- // the forms background goes black.
- Canvas.Clear(clWindowBackground);
-
- Canvas.DrawImage(10, 200, bmp);
- Canvas.DrawImagePart(10, 240, bmp, 0, 0, 32, 21);
- Canvas.DrawImagePart(50, 240, bmp, 32, 0, 32, 21);
-
- Canvas.EndDraw;
- bmp.Free;
- end;
+procedure TMainForm.btnDisplayBMP(Sender: TObject);
+var
+ bmp: TfpgImage;
+begin
+ exit;
+ bmp := LoadImage_BMP(SetDirSeparators('../../../images/themes/luna/button.bmp'));
+ bmp.CreateMaskFromSample(0, 0);
+ bmp.UpdateImage;
- procedure TMainForm.btn3Click(Sender: TObject);
- begin
- ShowMessage('Do you really want to quit this application?' + #10 +
- 'We can always keep playing and quite at a later date.' +
- #10#10 +
- 'This is a very long line that has to must be split automatically ' +
- 'and it should have done so. If not there is a bug in the code. It ' +
- 'has also been optimized to wordwrap and not split words in half.'
- , 'My cool message title');
- end;
+ Canvas.BeginDraw;
+ Canvas.ClearClipRect;
+ // For some reason, under Windows if I don't call this
+ // the forms background goes black.
+ Canvas.Clear(clWindowBackground);
+ Canvas.DrawImage(10, 200, bmp);
+ Canvas.DrawImagePart(10, 240, bmp, 0, 0, 32, 21);
+ Canvas.DrawImagePart(50, 240, bmp, 32, 0, 32, 21);
- procedure TMainForm.AfterCreate;
- var
- i: integer;
- bmp: TfpgImage;
- begin
- SetPosition(200, 200, 500, 350);
- WindowTitle := 'Test Russian text -> Òåñò';
-
- label1 := CreateLabel(self, 5, 5, 'Hello world!');
- label2 := CreateLabel(self, 5, 20, 'Hello world in Bold!');
- label2.FontDesc := 'Sans-12:bold:underline';
-
- edit1 := CreateEdit(self, 10, 40, 120, 22);
- edit1.Text := 'Hello world. Hello world. Hello world.';
- edit2 := CreateEdit(self, 10, 70, 200, 22);
- edit2.Text := 'Test Russian text -> Òåñò';
- // left to right and right to left text in one
- // fpGUI doesn't handle this correctly yet.
- // See http://www.catch22.net/tuts/editor18.asp for how it needs to display and work
+ Canvas.EndDraw;
+ bmp.Free;
+end;
+
+procedure TMainForm.btn3Click(Sender: TObject);
+begin
+ ShowMessage('Do you really want to quit this application?' + #10 +
+ 'We can always keep playing and quite at a later date.' +
+ #10#10 +
+ 'This is a very long line that has to must be split automatically ' +
+ 'and it should have done so. If not there is a bug in the code. It ' +
+ 'has also been optimized to wordwrap and not split words in half.'
+ , 'My cool message title');
+end;
+
+procedure TMainForm.checkboxChanged(Sender: TObject);
+begin
+ radiobtn1.Enabled := not checkbox.Checked;
+ radiobtn2.Enabled := not checkbox.Checked;
+ radiobtn3.Enabled := not checkbox.Checked;
+end;
+
+procedure TMainForm.AfterCreate;
+var
+ i: integer;
+ bmp: TfpgImage;
+begin
+ SetPosition(200, 200, 500, 350);
+ WindowTitle := 'Test Russian text -> Òåñò';
+
+ label1 := CreateLabel(self, 5, 5, 'Hello world!');
+ label2 := CreateLabel(self, 5, 20, 'Hello world in Bold!');
+ label2.FontDesc := 'Sans-12:bold:underline';
+
+ edit1 := CreateEdit(self, 10, 40, 120, 22);
+ edit1.Text := 'Hello world. Hello world. Hello world.';
+ edit2 := CreateEdit(self, 10, 70, 200, 22);
+ edit2.Text := 'Test Russian text -> Òåñò';
+ // left to right and right to left text in one
+ // fpGUI doesn't handle this correctly yet.
+ // See http://www.catch22.net/tuts/editor18.asp for how it needs to display and work
// edit2.Text := 'HelloيُساوِيWorld';
- btn2 := CreateButton(self, 10, 100, 75, 'Normal', nil);
- btn2.OnClick := @btnDisplayBMP;
+ btn2 := CreateButton(self, 10, 100, 75, 'Normal', nil);
+ btn2.OnClick := @btnDisplayBMP;
// btn2.Enabled := False;
-
- btn3 := CreateButton(self, 100, 100, 75, 'Embedded', nil);
- btn3.Embedded := True;
- btn3.OnClick := @btn3Click;
-
- btn := CreateButton(self, 10, 130, 75, 'Close', @btnCloseClick);
- btn.ImageName := 'stdimg.close';
- btn.ShowImage := True;
-
- combo1 := CreateComboBox(self, 10, 160, 120, nil);
- for i := 1 to 5 do
- combo1.Items.Add(Format('Items %.2d', [i]));
- combo2 := CreateComboBox(self, 10, 190, 120, nil);
- for i := 1 to 20 do
- combo2.Items.Add(Format('Items %.2d', [i]));
-
- memo := TfpgMemo.Create(self);
- memo.Top := 10;
- memo.Left := 250;
- memo.Width := 200;
- memo.Height := 80;
-
- listbox := TfpgListBox.Create(self);
- listbox.Top := 100;
- listbox.Left := 250;
- listbox.Width := 200;
- listbox.Height := 80;
- for i := 1 to 20 do
- listbox.Items.Add(Format('Items %.2d', [i]));
- listbox.FocusItem := 3;
-
-
- sbar := TfpgScrollBar.Create(self);
- sbar.Top := 160;
- sbar.Left := 150;
- sbar.Height := 100;
- sbar.Max := 15;
-
- xpluna := TXPButton.Create(self);
- xpluna.Left := 250;
- xpluna.Top := 200;
- xpluna.Width := 75;
- xpluna.Text := 'XP Luna';
-
- xp2 := TXPButton.Create(self);
- xp2.Left := 335;
- xp2.Top := 200;
- xp2.Width := 75;
- xp2.Text := 'XP Button2';
- xp2.Enabled := False;
-
- xpsilver := TXPButton.Create(self);
- xpsilver.Left := 250;
- xpsilver.Top := 230;
- xpsilver.Width := 75;
- xpsilver.Text := 'XP Silver';
- bmp := LoadImage_BMP(SetDirSeparators('../../../images/themes/silver/button.bmp'));
- bmp.CreateMaskFromSample(0, 0);
- bmp.UpdateImage;
- xpsilver.ThemeImage := bmp;
-
- checkbox := CreateCheckBox(self, 10, 220, 'Checkbox One');
- end;
+
+ btn3 := CreateButton(self, 100, 100, 75, 'Embedded', nil);
+ btn3.Embedded := True;
+ btn3.OnClick := @btn3Click;
+
+ btn := CreateButton(self, 10, 130, 75, 'Close', @btnCloseClick);
+ btn.ImageName := 'stdimg.close';
+ btn.ShowImage := True;
+
+ combo1 := CreateComboBox(self, 10, 160, 120, nil);
+ for i := 1 to 5 do
+ combo1.Items.Add(Format('Items %.2d', [i]));
+ combo2 := CreateComboBox(self, 10, 190, 120, nil);
+ for i := 1 to 20 do
+ combo2.Items.Add(Format('Items %.2d', [i]));
+
+ memo := TfpgMemo.Create(self);
+ memo.Top := 10;
+ memo.Left := 250;
+ memo.Width := 200;
+ memo.Height := 80;
+
+ listbox := TfpgListBox.Create(self);
+ listbox.Top := 100;
+ listbox.Left := 250;
+ listbox.Width := 200;
+ listbox.Height := 80;
+ for i := 1 to 20 do
+ listbox.Items.Add(Format('Items %.2d', [i]));
+ listbox.FocusItem := 3;
+
+
+ sbar := TfpgScrollBar.Create(self);
+ sbar.Top := 160;
+ sbar.Left := 150;
+ sbar.Height := 100;
+ sbar.Max := 15;
+
+ xpluna := TXPButton.Create(self);
+ xpluna.Left := 250;
+ xpluna.Top := 200;
+ xpluna.Width := 75;
+ xpluna.Text := 'XP Luna';
+
+ xp2 := TXPButton.Create(self);
+ xp2.Left := 335;
+ xp2.Top := 200;
+ xp2.Width := 75;
+ xp2.Text := 'XP Button2';
+ xp2.Enabled := False;
+
+ xpsilver := TXPButton.Create(self);
+ xpsilver.Left := 250;
+ xpsilver.Top := 230;
+ xpsilver.Width := 75;
+ xpsilver.Text := 'XP Silver';
+ bmp := LoadImage_BMP(SetDirSeparators('../../../images/themes/silver/button.bmp'));
+ bmp.CreateMaskFromSample(0, 0);
+ bmp.UpdateImage;
+ xpsilver.ThemeImage := bmp;
+
+ checkbox := CreateCheckBox(self, 10, 220, 'Disable Radios');
+ checkbox.OnChange := @checkboxChanged;
+ radiobtn1 := CreateRadioButton(self, 10, 245, 'Radio One');
+ radiobtn2 := CreateRadioButton(self, 10, 265, 'Radio Two');
+ radiobtn3 := CreateRadioButton(self, 10, 285, 'Radio Three');
+ radiobtn1.Checked := True;
+end;
procedure MainProc;
var
diff --git a/prototypes/fpgui2/tests/edittest.lpi b/prototypes/fpgui2/tests/edittest.lpi
index b609d403..1ecb384f 100644
--- a/prototypes/fpgui2/tests/edittest.lpi
+++ b/prototypes/fpgui2/tests/edittest.lpi
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="\"/>
+ <PathDelim Value="/"/>
<Version Value="5"/>
<General>
<Flags>
@@ -9,7 +9,7 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value=".\"/>
+ <IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<VersionInfo>
@@ -23,7 +23,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
@@ -42,7 +42,6 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
- <PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
diff --git a/src/corelib/gfx_stdimages.pas b/src/corelib/gfx_stdimages.pas
index 27d0ab6c..7ed9fdb4 100644
--- a/src/corelib/gfx_stdimages.pas
+++ b/src/corelib/gfx_stdimages.pas
@@ -19,43 +19,26 @@ implementation
Const
// 60x12 pixel 4bpp bitmap
- RadioBitmapData: array[0..359] of Byte = (
- $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00,
- $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00,
- $02, $11, $77, $77, $11, $50, $02, $11, $77, $77, $11, $50, $02, $11, $33, $33, $11, $50, $02, $11, $33, $33, $11, $50, $02, $11, $33, $33, $11, $50,
- $02, $17, $77, $77, $74, $50, $02, $17, $77, $77, $74, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50,
- $21, $77, $77, $77, $77, $45, $21, $77, $76, $67, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $36, $63, $33, $45, $21, $33, $32, $23, $33, $45,
- $21, $77, $77, $77, $77, $45, $21, $77, $66, $66, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $66, $66, $33, $45, $21, $33, $22, $22, $33, $45,
- $21, $77, $77, $77, $77, $45, $21, $77, $66, $66, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $66, $66, $33, $45, $21, $33, $22, $22, $33, $45,
- $21, $77, $77, $77, $77, $45, $21, $77, $76, $67, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $36, $63, $33, $45, $21, $33, $32, $23, $33, $45,
- $02, $17, $77, $77, $74, $50, $02, $17, $77, $77, $74, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50,
- $02, $44, $77, $77, $44, $50, $02, $44, $77, $77, $44, $50, $02, $44, $33, $33, $44, $50, $02, $44, $33, $33, $44, $50, $02, $44, $33, $33, $44, $50,
- $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00,
- $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00
- );
+ //RadioBitmapData: array[0..359] of Byte = (
+ //$00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00,
+ //$00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00,
+ //$02, $11, $77, $77, $11, $50, $02, $11, $77, $77, $11, $50, $02, $11, $33, $33, $11, $50, $02, $11, $33, $33, $11, $50, $02, $11, $33, $33, $11, $50,
+ //$02, $17, $77, $77, $74, $50, $02, $17, $77, $77, $74, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50,
+ //$21, $77, $77, $77, $77, $45, $21, $77, $76, $67, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $36, $63, $33, $45, $21, $33, $32, $23, $33, $45,
+ //$21, $77, $77, $77, $77, $45, $21, $77, $66, $66, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $66, $66, $33, $45, $21, $33, $22, $22, $33, $45,
+ //$21, $77, $77, $77, $77, $45, $21, $77, $66, $66, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $66, $66, $33, $45, $21, $33, $22, $22, $33, $45,
+ //$21, $77, $77, $77, $77, $45, $21, $77, $76, $67, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $36, $63, $33, $45, $21, $33, $32, $23, $33, $45,
+ //$02, $17, $77, $77, $74, $50, $02, $17, $77, $77, $74, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50,
+ //$02, $44, $77, $77, $44, $50, $02, $44, $77, $77, $44, $50, $02, $44, $33, $33, $44, $50, $02, $44, $33, $33, $44, $50, $02, $44, $33, $33, $44, $50,
+ //$00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00,
+ //$00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00
+ //);
// 12x12 pixel monochrome bitmap
RadioMaskData: array[0..23] of Byte = ($0f, $00, $3f, $c0, $7f, $e0, $7f,
$e0, $ff, $f0, $ff, $f0, $ff, $f0, $ff, $f0, $7f, $e0, $7f, $e0, $3f, $c0,
$0f, $00);
- // 65x13 pixel 4bpp bitmap
- CheckBoxBitmapData: array[0..428] of Byte = (
- $22, $22, $22, $22, $22, $22, $52, $22, $22, $22, $22, $22, $25, $22, $22, $22, $22, $22, $22, $52, $22, $22, $22, $22, $22, $25, $22, $22, $22, $22, $22, $22, $50,
- $21, $11, $11, $11, $11, $14, $52, $11, $11, $11, $11, $11, $45, $21, $11, $11, $11, $11, $14, $52, $11, $11, $11, $11, $11, $45, $21, $11, $11, $11, $11, $14, $50,
- $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $33, $33, $45, $21, $33, $33, $33, $33, $34, $50,
- $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $77, $67, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $33, $63, $45, $21, $33, $33, $33, $32, $34, $50,
- $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $76, $67, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $36, $63, $45, $21, $33, $33, $33, $22, $34, $50,
- $21, $77, $77, $77, $77, $74, $52, $17, $67, $77, $66, $67, $45, $21, $33, $33, $33, $33, $34, $52, $13, $63, $33, $66, $63, $45, $21, $32, $33, $32, $22, $34, $50,
- $21, $77, $77, $77, $77, $74, $52, $17, $66, $76, $66, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $66, $36, $66, $33, $45, $21, $32, $23, $22, $23, $34, $50,
- $21, $77, $77, $77, $77, $74, $52, $17, $66, $66, $67, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $66, $66, $63, $33, $45, $21, $32, $22, $22, $33, $34, $50,
- $21, $77, $77, $77, $77, $74, $52, $17, $76, $66, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $36, $66, $33, $33, $45, $21, $33, $22, $23, $33, $34, $50,
- $21, $77, $77, $77, $77, $74, $52, $17, $77, $67, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $63, $33, $33, $45, $21, $33, $32, $33, $33, $34, $50,
- $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $33, $33, $45, $21, $33, $33, $33, $33, $34, $50,
- $24, $44, $44, $44, $44, $44, $52, $44, $44, $44, $44, $44, $45, $24, $44, $44, $44, $44, $44, $52, $44, $44, $44, $44, $44, $45, $24, $44, $44, $44, $44, $44, $50,
- $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $50
- );
-
// 64x8 pixel 4bpp bitmap
ArrowBitmapData: array[0..255] of Byte = (
$33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $13, $33, $33, $31, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $23, $33, $33, $23, $33, $33,
@@ -96,7 +79,16 @@ begin
@stdimg_arrow_right,
sizeof(stdimg_arrow_right) );
- // Add RadioButton, CheckBox images as well.
+ img := fpgImages.AddMaskedBMP( // 60x12 in total. 5 images of 12x12 each.
+ 'sys.radiobuttons',
+ @stdimg_radiobuttons,
+ sizeof(stdimg_radiobuttons),
+ 0,0);
+
+ img := fpgImages.AddBMP( // 65x13 pixels. 5 images of 13x13 each.
+ 'sys.checkboxes',
+ @stdimg_checkboxes,
+ sizeof(stdimg_checkboxes));
// General purpose images:
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index 221c2686..0323eb40 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -274,6 +274,9 @@ procedure TfpgWidget.MsgMouseDown(var msg: TfpgMessageRec);
var
mb: TMouseButton;
begin
+ if not FEnabled then
+ exit; // Do we want this here?
+
case msg.Params.mouse.Buttons of
MOUSE_LEFT:
begin
@@ -299,6 +302,9 @@ procedure TfpgWidget.MsgMouseUp(var msg: TfpgMessageRec);
var
mb: TMouseButton;
begin
+ if not FEnabled then
+ exit; // Do we want this here?
+
case msg.Params.mouse.Buttons of
MOUSE_LEFT:
begin
diff --git a/src/corelib/stdimages.inc b/src/corelib/stdimages.inc
index b195625c..a063d5b3 100644
--- a/src/corelib/stdimages.inc
+++ b/src/corelib/stdimages.inc
@@ -851,6 +851,163 @@ Const
255,255,255,255,255,255);
Const
+ stdimg_checkboxes : Array[0..2601] of byte = (
+ 66, 77, 42, 10, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 65, 0, 0, 0, 13, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 244, 9, 0, 0,196, 14, 0, 0,196, 14, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,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,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,
+ 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,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255, 0,127,127,127,191,191,
+ 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
+ 191,191,191,191,191,191,191,191,191,191,191,191,191,191,255,255,255,
+ 127,127,127,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
+ 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
+ 191,191,255,255,255,127,127,127,191,191,191,191,191,191,191,191,191,
+ 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
+ 191,191,191,191,191,191,191,255,255,255,127,127,127,191,191,191,191,
+ 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
+ 191,191,191,191,191,191,191,191,191,191,191,191,255,255,255,127,127,
+ 127,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
+ 191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
+ 255,255,255, 0,127,127,127, 0, 0, 0,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,191,191,191,255,255,255,127,127,127, 0, 0, 0,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,191,191,191,255,255,255,127,127,127,
+ 0, 0, 0,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,191,191,191,255,
+ 255,255,127,127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,191,191,191,255,255,255, 0,127,127,127, 0,
+ 0, 0,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,191,191,191,255,255,
+ 255,127,127,127, 0, 0, 0,255,255,255,255,255,255, 0, 0, 0,255,
+ 255,255,255,255,255,255,255,255, 0, 0, 0,255,255,255,255,255,255,
+ 191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,191,191,191,255,255,255,127,127,127, 0, 0, 0,
+ 127,127,127,127,127,127, 0, 0, 0,127,127,127,127,127,127,127,127,
+ 127, 0, 0, 0,127,127,127,127,127,127,191,191,191,255,255,255,127,
+ 127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,191,191,
+ 191,255,255,255, 0,127,127,127, 0, 0, 0,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,191,191,191,255,255,255,127,127,127, 0, 0, 0,255,
+ 255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,255,255,255,191,191,191,255,255,255,127,127,
+ 127, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,191,191,191,
+ 255,255,255,127,127,127, 0, 0, 0,127,127,127, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,127,127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0,127,
+ 127,127,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,191,191,191,255,255,255, 0,127,127,127,
+ 0, 0, 0,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,191,191,191,255,
+ 255,255,127,127,127, 0, 0, 0,255,255,255,255,255,255, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,
+ 255,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,191,191,191,255,255,255,127,127,127, 0, 0,
+ 0,127,127,127,127,127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,127,127,127,127,127,127,191,191,191,255,255,255,
+ 127,127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,191,
+ 191,191,255,255,255, 0,127,127,127, 0, 0, 0,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,191,191,191,255,255,255,127,127,127, 0, 0, 0,
+ 255,255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,255,255,255,255,255,255,255,255,255,191,191,191,255,255,255,127,
+ 127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,191,191,
+ 191,255,255,255,127,127,127, 0, 0, 0,127,127,127,127,127,127,127,
+ 127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0,127,127,127,127,127,127,
+ 127,127,127,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,191,191,191,255,255,255, 0,127,127,
+ 127, 0, 0, 0,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,191,191,191,
+ 255,255,255,127,127,127, 0, 0, 0,255,255,255,255,255,255, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,
+ 255,255,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,191,191,191,255,255,255,127,127,127, 0,
+ 0, 0,127,127,127,127,127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,127,127,127,127,127,127,191,191,191,255,255,
+ 255,127,127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 191,191,191,255,255,255, 0,127,127,127, 0, 0, 0,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,191,191,191,255,255,255,127,127,127, 0, 0,
+ 0,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,191,191,191,255,255,255,
+ 127,127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,191,
+ 191,191,255,255,255,127,127,127, 0, 0, 0,127,127,127, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,127,127,127, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,127,127,127,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,191,191,191,255,255,255, 0,127,
+ 127,127, 0, 0, 0,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,191,191,
+ 191,255,255,255,127,127,127, 0, 0, 0,255,255,255,255,255,255, 0,
+ 0, 0,255,255,255,255,255,255,255,255,255, 0, 0, 0,255,255,255,
+ 255,255,255,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,191,191,191,255,255,255,127,127,127,
+ 0, 0, 0,127,127,127,127,127,127, 0, 0, 0,127,127,127,127,127,
+ 127,127,127,127, 0, 0, 0,127,127,127,127,127,127,191,191,191,255,
+ 255,255,127,127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,191,191,191,255,255,255, 0,127,127,127, 0, 0, 0,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,191,191,191,255,255,255,127,127,127, 0,
+ 0, 0,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,191,191,191,255,255,
+ 255,127,127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,191,191,191,255,255,255,127,127,127, 0, 0, 0,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,191,191,191,255,255,255, 0,
+ 127,127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,191,
+ 191,191,255,255,255,127,127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,191,191,191,255,255,255,127,127,127, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,191,191,191,255,255,255,127,127,
+ 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,191,191,191,
+ 255,255,255,127,127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,191,191,191,255,255,255, 0,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,255,255,255,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,255,
+ 255,255,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,255,255,255,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,255,255,255,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,255,255,255,
+ 0);
+
+Const
stdimg_arrow_left : Array[0..89] of byte = (
66, 77, 90, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 40, 0, 0,
0, 4, 0, 0, 0, 7, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
@@ -972,6 +1129,140 @@ Const
255,255,255,255,255,255);
Const
+ stdimg_radiobuttons : Array[0..2213] of byte = (
+ 66, 77,166, 8, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 60, 0, 0, 0, 12, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 112, 8, 0, 0,196, 14, 0, 0,196, 14, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,255,
+ 255,255,255,255,255,255,255,255,255,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,255,255,255,255,255,255,255,255,255,255,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,255,255,255,255,255,255,255,255,255,255,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,255,255,255,255,255,255,255,255,255,255,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,255,255,255,255,255,255,255,255,255,255,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255,255,255,255,255,255,191,191,191,191,191,191,191,191,191,
+ 191,191,191,255,255,255,255,255,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255,255,255,255,255,255,191,191,191,191,191,191,191,
+ 191,191,191,191,191,255,255,255,255,255,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255,255,255,255,255,255,191,191,191,191,191,
+ 191,191,191,191,191,191,191,255,255,255,255,255,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255,255,255,255,255,255,191,191,191,
+ 191,191,191,191,191,191,191,191,191,255,255,255,255,255,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255,255,255,255,255,255,191,
+ 191,191,191,191,191,191,191,191,191,191,191,255,255,255,255,255,255,
+ 255, 0,255,255, 0,255,255, 0,255,127,127,127,191,191,191,191,191,
+ 191,255,255,255,255,255,255,255,255,255,255,255,255,191,191,191,191,
+ 191,191,255,255,255,255, 0,255,255, 0,255,127,127,127,191,191,191,
+ 191,191,191,255,255,255,255,255,255,255,255,255,255,255,255,191,191,
+ 191,191,191,191,255,255,255,255, 0,255,255, 0,255,127,127,127,191,
+ 191,191,191,191,191,127,127,127,127,127,127,127,127,127,127,127,127,
+ 191,191,191,191,191,191,255,255,255,255, 0,255,255, 0,255,127,127,
+ 127,191,191,191,191,191,191,127,127,127,127,127,127,127,127,127,127,
+ 127,127,191,191,191,191,191,191,255,255,255,255, 0,255,255, 0,255,
+ 127,127,127,191,191,191,191,191,191,127,127,127,127,127,127,127,127,
+ 127,127,127,127,191,191,191,191,191,191,255,255,255,255, 0,255,255,
+ 0,255,127,127,127, 0, 0, 0,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,191,191,191,255,255,255,255, 0,
+ 255,255, 0,255,127,127,127, 0, 0, 0,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,191,191,191,255,255,255,
+ 255, 0,255,255, 0,255,127,127,127, 0, 0, 0,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,191,191,191,255,
+ 255,255,255, 0,255,255, 0,255,127,127,127, 0, 0, 0,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,191,191,
+ 191,255,255,255,255, 0,255,255, 0,255,127,127,127, 0, 0, 0,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 191,191,191,255,255,255,255, 0,255,127,127,127, 0, 0, 0,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,191,191,191,255,255,255,127,127,127, 0, 0, 0,
+ 255,255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0,255,255,
+ 255,255,255,255,255,255,255,191,191,191,255,255,255,127,127,127, 0,
+ 0, 0,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,191,191,191,255,255,255,127,127,
+ 127, 0, 0, 0,127,127,127,127,127,127,127,127,127, 0, 0, 0, 0,
+ 0, 0,127,127,127,127,127,127,127,127,127,191,191,191,255,255,255,
+ 127,127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,191,191,191,255,
+ 255,255,127,127,127, 0, 0, 0,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,191,191,
+ 191,255,255,255,127,127,127, 0, 0, 0,255,255,255,255,255,255, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,
+ 191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,127,
+ 127,127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,127,127,
+ 127,127,127,127,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,191,191,191,255,255,255,127,127,127, 0, 0,
+ 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,191,191,191,255,255,255,127,127,127,
+ 0, 0, 0,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,255,255,255,255,255,255,191,191,191,255,255,255,127,
+ 127,127, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,191,191,191,255,255,
+ 255,127,127,127, 0, 0, 0,127,127,127,127,127,127, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,127,127,127,127,127,127,191,191,191,
+ 255,255,255,127,127,127, 0, 0, 0,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,191,
+ 191,191,255,255,255,127,127,127, 0, 0, 0,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,191,191,191,255,255,255,127,127,127, 0, 0, 0,255,255,255,255,
+ 255,255,255,255,255, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,
+ 255,255,255,191,191,191,255,255,255,127,127,127, 0, 0, 0,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,191,191,191,255,255,255,127,127,127, 0, 0, 0,
+ 127,127,127,127,127,127,127,127,127, 0, 0, 0, 0, 0, 0,127,127,
+ 127,127,127,127,127,127,127,191,191,191,255,255,255,127,127,127, 0,
+ 0, 0,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,191,191,191,255,255,255,255, 0,
+ 255,127,127,127, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,191,191,191,255,255,255,255, 0,255,
+ 255, 0,255,127,127,127, 0, 0, 0,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,191,191,191,255,255,255,255,
+ 0,255,255, 0,255,127,127,127, 0, 0, 0,127,127,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,191,191,191,255,255,
+ 255,255, 0,255,255, 0,255,127,127,127, 0, 0, 0,127,127,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,191,191,191,
+ 255,255,255,255, 0,255,255, 0,255,127,127,127, 0, 0, 0,127,127,
+ 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,191,
+ 191,191,255,255,255,255, 0,255,255, 0,255,127,127,127, 0, 0, 0,
+ 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0,
+ 0, 0, 0, 0,255,255,255,255, 0,255,255, 0,255,127,127,127, 0,
+ 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,
+ 0, 0, 0, 0, 0, 0,255,255,255,255, 0,255,255, 0,255,127,127,
+ 127, 0, 0, 0, 0, 0, 0,127,127,127,127,127,127,127,127,127,127,
+ 127,127, 0, 0, 0, 0, 0, 0,255,255,255,255, 0,255,255, 0,255,
+ 127,127,127, 0, 0, 0, 0, 0, 0,127,127,127,127,127,127,127,127,
+ 127,127,127,127, 0, 0, 0, 0, 0, 0,255,255,255,255, 0,255,255,
+ 0,255,127,127,127, 0, 0, 0, 0, 0, 0,127,127,127,127,127,127,
+ 127,127,127,127,127,127, 0, 0, 0, 0, 0, 0,255,255,255,255, 0,
+ 255,255, 0,255,255, 0,255,127,127,127,127,127,127, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,127,127,127,127,127,127,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,127,127,127,127,127,127, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,127,127,127,127,127,127,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,127,127,127,127,127,127,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,127,127,127,127,127,
+ 127,255, 0,255,255, 0,255,255, 0,255,255, 0,255,127,127,127,127,
+ 127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,127,127,127,
+ 127,127,127,255, 0,255,255, 0,255,255, 0,255,255, 0,255,127,127,
+ 127,127,127,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,127,
+ 127,127,127,127,127,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,127,127,127,127,127,127,127,127,127,127,127,
+ 127,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,127,127,127,127,127,127,127,127,127,
+ 127,127,127,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,127,127,127,127,127,127,127,
+ 127,127,127,127,127,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255,255, 0,255,255, 0,255,127,127,127,127,127,
+ 127,127,127,127,127,127,127,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,127,127,127,
+ 127,127,127,127,127,127,127,127,127,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255);
+
+Const
stdimg_edit : Array[0..821] of byte = (
66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
diff --git a/src/gui/fpgui_package.lpk b/src/gui/fpgui_package.lpk
index cbd1dbe6..acc1e43b 100644
--- a/src/gui/fpgui_package.lpk
+++ b/src/gui/fpgui_package.lpk
@@ -18,7 +18,7 @@
<Description Value="fpGUI - multi-handle redesign"/>
<License Value="Modified LGPL"/>
<Version Minor="5"/>
- <Files Count="12">
+ <Files Count="13">
<Item1>
<Filename Value="gui_button.pas"/>
<UnitName Value="gui_button"/>
@@ -67,6 +67,10 @@
<Filename Value="gui_checkbox.pas"/>
<UnitName Value="gui_checkbox"/>
</Item12>
+ <Item13>
+ <Filename Value="gui_radiobutton.pas"/>
+ <UnitName Value="gui_radiobutton"/>
+ </Item13>
</Files>
<RequiredPkgs Count="2">
<Item1>
diff --git a/src/gui/fpgui_package.pas b/src/gui/fpgui_package.pas
index 0c9d2c4d..5903ea3e 100644
--- a/src/gui/fpgui_package.pas
+++ b/src/gui/fpgui_package.pas
@@ -9,7 +9,7 @@ interface
uses
gui_button, gui_combobox, gui_dialogs, gui_edit, gui_form, gui_label,
gui_listbox, gui_memo, gui_popupwindow, gui_scrollbar, gui_bevel,
- gui_checkbox;
+ gui_checkbox, gui_radiobutton;
implementation
diff --git a/src/gui/gui_checkbox.pas b/src/gui/gui_checkbox.pas
index 85149b71..4bfc18c0 100644
--- a/src/gui/gui_checkbox.pas
+++ b/src/gui/gui_checkbox.pas
@@ -29,7 +29,7 @@ type
protected
procedure HandlePaint; override;
procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
- procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
+ procedure HandleKeyRelease(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -50,10 +50,10 @@ implementation
function CreateCheckBox(AOwner: TComponent; x, y: TfpgCoord; AText: string): TfpgCheckBox;
begin
Result := TfpgCheckBox.Create(AOwner);
- Result.Top := y;
- Result.Left := x;
- Result.Text := AText;
- Result.Width := Result.Font.TextWidth(Result.Text) + 24;
+ Result.Top := y;
+ Result.Left := x;
+ Result.Text := AText;
+ Result.Width := Result.Font.TextWidth(Result.Text) + 24;
end;
{ TfpgCheckBox }
@@ -99,6 +99,8 @@ var
r: TfpgRect;
ty: integer;
tx: integer;
+ ix: integer;
+ img: TfpgImage;
begin
Canvas.BeginDraw;
inherited HandlePaint;
@@ -119,27 +121,17 @@ begin
if r.top < 0 then
r.top := 0;
- // paint box for check mark
- Canvas.SetColor(clBoxColor);
- Canvas.FillRectangle(r);
- Canvas.DrawControlFrame(r.Left, r.Top, r.width, r.height);
-
- // set colors and paint the check (in this case a X)
- Canvas.SetColor(clText1);
+ // paint the check (in this case a X)
tx := r.right + 8;
- inc(r.left, 3);
- inc(r.top, 3);
- dec(r.width, 6);
- dec(r.height, 6);
- Canvas.SetLineStyle(2, lsSolid);
- if FChecked then
- begin
- {$Note We will replace this with a image soon. }
- Canvas.DrawLine(r.left, r.top, r.right, r.bottom);
- Canvas.DrawLine(r.Right, r.top, r.left, r.bottom);
- end;
+ inc(r.left, 2);
+ inc(r.top, 1);
+ img := fpgImages.GetImage('sys.checkboxes');
+ if FChecked then // which image index?
+ ix := 1
+ else
+ ix := 0;
+ Canvas.DrawImagePart(r.Left, r.Top, img, ix*13, 0, 13, 13);
- Canvas.SetLineStyle(1, lsSolid);
ty := (Height div 2) - (Font.Height div 2);
if ty < 0 then
ty := 0;
@@ -156,7 +148,7 @@ begin
FOnChange(self);
end;
-procedure TfpgCheckBox.HandleKeyPress(var keycode: word;
+procedure TfpgCheckBox.HandleKeyRelease(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
begin
if (keycode = keySpace) or (keycode = keyReturn) then
@@ -170,7 +162,7 @@ begin
if consumed then
Exit; //==>
- inherited HandleKeyPress(keycode, shiftstate, consumed);
+ inherited HandleKeyRelease(keycode, shiftstate, consumed);
end;
constructor TfpgCheckBox.Create(AOwner: TComponent);
diff --git a/src/gui/gui_radiobutton.pas b/src/gui/gui_radiobutton.pas
new file mode 100644
index 00000000..db3a8e16
--- /dev/null
+++ b/src/gui/gui_radiobutton.pas
@@ -0,0 +1,238 @@
+unit gui_radiobutton;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes,
+ SysUtils,
+ fpgfx,
+ gfxbase,
+ gfx_widget;
+
+type
+
+ TfpgRadioButton = class(TfpgWidget)
+ private
+ FBackgroundColor: TfpgColor;
+ FChecked: boolean;
+ FFont: TfpgFont;
+ FGroupIndex: integer;
+ FOnChange: TNotifyEvent;
+ FText: string;
+ FBoxSize: integer;
+ FIsPressed: boolean;
+ function GetFontName: string;
+ procedure SetBackgroundColor(const AValue: TfpgColor);
+ procedure SetChecked(const AValue: boolean);
+ procedure SetFontName(const AValue: string);
+ procedure SetText(const AValue: string);
+ protected
+ procedure HandlePaint; override;
+ procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleKeyRelease(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
+ public
+ constructor Create(AOwner: TComponent); override;
+ destructor Destroy; override;
+ property Font: TfpgFont read FFont;
+ published
+ property Checked: boolean read FChecked write SetChecked;
+ property Text: string read FText write SetText;
+ property FontName: string read GetFontName write SetFontName;
+ property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
+ property GroupIndex: integer read FGroupIndex write FGroupIndex;
+ property OnChange: TNotifyEvent read FOnChange write FOnChange;
+ end;
+
+
+function CreateRadioButton(AOwner: TComponent; x, y: TfpgCoord; AText: string): TfpgRadioButton;
+
+implementation
+
+function CreateRadioButton(AOwner: TComponent; x, y: TfpgCoord; AText: string): TfpgRadioButton;
+begin
+ Result := TfpgRadioButton.Create(AOwner);
+ Result.Top := y;
+ Result.Left := x;
+ Result.Text := AText;
+ Result.Width := Result.Font.TextWidth(Result.Text) + 24;
+end;
+
+{ TfpgRadioButton }
+
+function TfpgRadioButton.GetFontName: string;
+begin
+ Result := FFont.FontDesc;
+end;
+
+procedure TfpgRadioButton.SetBackgroundColor(const AValue: TfpgColor);
+begin
+ if FBackgroundColor = AValue then
+ Exit; //==>
+ FBackgroundColor := AValue;
+ RePaint;
+end;
+
+procedure TfpgRadioButton.SetChecked(const AValue: boolean);
+var
+ i: integer;
+ wg: TfpgWidget;
+begin
+ if FChecked = AValue then
+ Exit; //==>
+ FChecked := AValue;
+
+ // Clear other radio buttons in the same group
+ if FChecked and (Parent <> nil) then
+ begin
+ for i := 0 to Parent.ComponentCount-1 do
+ begin
+ wg := TfpgWidget(Parent.Components[i]);
+ if (wg <> nil) and (wg <> self) and (wg is TfpgRadioButton) and
+ (TfpgRadioButton(wg).GroupIndex = GroupIndex) then
+ begin
+ TfpgRadioButton(wg).Checked := False;
+ end;
+ end; { for }
+ end; { if }
+
+ RePaint;
+end;
+
+procedure TfpgRadioButton.SetFontName(const AValue: string);
+begin
+ FFont.Free;
+ FFont := fpgGetFont(AValue);
+ RePaint;
+end;
+
+procedure TfpgRadioButton.SetText(const AValue: string);
+begin
+ if FText = AValue then
+ Exit; //==>
+ FText := AValue;
+ RePaint;
+end;
+
+procedure TfpgRadioButton.HandlePaint;
+var
+ r: TfpgRect;
+ ty: integer;
+ tx: integer;
+ img: TfpgImage;
+ ix: integer;
+begin
+ Canvas.BeginDraw;
+ inherited HandlePaint;
+
+ Canvas.SetColor(FBackgroundColor);
+ Canvas.FillRectangle(0, 0, Width, Height);
+ Canvas.SetFont(Font);
+
+ if FFocused then
+ begin
+ Canvas.SetColor(clText1);
+ Canvas.SetLineStyle(1, lsDot);
+ Canvas.DrawRectangle(1, 1, Width-1, Height-1);
+ end;
+ Canvas.SetLineStyle(1, lsSolid);
+
+ r.SetRect(2, (Height div 2) - (FBoxSize div 2), FBoxSize, FBoxSize);
+ if r.top < 0 then
+ r.top := 0;
+
+ // calculate which image to paint.
+ if Enabled then
+ begin
+ ix := Ord(FChecked);
+ if FIsPressed then
+ Inc(ix, 2);
+ end
+ else
+ ix := (2 + (Ord(FChecked) * 2)) - Ord(FChecked);
+
+ // paint the radio button
+ tx := r.right + 8;
+ inc(r.left, 2);
+ inc(r.top, 1);
+ img := fpgImages.GetImage('sys.radiobuttons');
+ Canvas.DrawImagePart(r.Left, r.Top, img, ix*12, 0, 12, 12);
+
+ ty := (Height div 2) - (Font.Height div 2);
+ if ty < 0 then
+ ty := 0;
+ if Enabled then
+ Canvas.SetTextColor(clText1)
+ else
+ Canvas.SetTextColor(clShadow1);
+ Canvas.DrawString(tx, ty, FText);
+
+ Canvas.EndDraw;
+end;
+
+procedure TfpgRadioButton.HandleLMouseDown(x, y: integer;
+ shiftstate: TShiftState);
+begin
+ inherited HandleLMouseDown(x, y, shiftstate);
+ FIsPressed := True;
+ Repaint;
+end;
+
+procedure TfpgRadioButton.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
+begin
+ inherited HandleLMouseUp(x, y, shiftstate);
+ FIsPressed := False;
+ if not Checked then
+ begin
+ Checked := not FChecked;
+ if Assigned(FOnChange) then
+ FOnChange(self);
+ end
+ else
+ RePaint;
+end;
+
+procedure TfpgRadioButton.HandleKeyRelease(var keycode: word;
+ var shiftstate: TShiftState; var consumed: boolean);
+begin
+ if (keycode = keySpace) then
+ begin
+ consumed := True;
+ Checked := not FChecked;
+ if Assigned(FOnChange) then
+ FOnChange(self);
+ end;
+
+ if consumed then
+ Exit; //==>
+
+ inherited HandleKeyRelease(keycode, shiftstate, consumed);
+end;
+
+constructor TfpgRadioButton.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ FText := 'RadioButton';
+ FFont := fpgGetFont('#Label1');
+ FHeight := FFont.Height + 4;
+ FWidth := 120;
+
+ FBackgroundColor := clWindowBackground;
+ FFocusable := True;
+ FBoxSize := 12;
+ FChecked := False;
+ FGroupIndex := 0;
+ FIsPressed := False;
+ FOnChange := nil;
+end;
+
+destructor TfpgRadioButton.Destroy;
+begin
+ FFont.Free;
+ inherited Destroy;
+end;
+
+end.
+