diff options
author | Graeme Geldenhuys <graemeg@users.sourceforge.net> | 2007-04-05 12:07:37 +0000 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@users.sourceforge.net> | 2007-04-05 12:07:37 +0000 |
commit | 57848ff4bf8b9acf2d610a3eee6776fc6d57f0bc (patch) | |
tree | e04847dc1804ed20ab09b7d9a7f762ce17928f0d | |
parent | 38020d5baa685bb03910b02f057c2179db149723 (diff) | |
download | fpGUI-57848ff4bf8b9acf2d610a3eee6776fc6d57f0bc.tar.xz |
* Fixed bug in gfx_gdi with DoDrawImageRect. Only the first palette color could be set, then an AV occured.
* Fixed many include file headers
* Reimplemented the images for CheckBox, RadiouButton and button Arrows in the TBasicStyle class. X11 stil has some palette issues, so manual drawing still occurs.
-rw-r--r-- | examples/gfx/imgtest/imgtest.pas | 4 | ||||
-rw-r--r-- | gfx/gdi/fpgfxpackage.lpk | 3 | ||||
-rw-r--r-- | gfx/gdi/gfx_gdi.pas | 7 | ||||
-rw-r--r-- | gfx/geldirty.pas | 5 | ||||
-rw-r--r-- | gfx/gelimage.pas | 4 | ||||
-rw-r--r-- | gfx/x11/gfx_x11.pas | 6 | ||||
-rw-r--r-- | gfx/x11/gfxinterface.pas | 4 | ||||
-rw-r--r-- | gui/bin.inc | 2 | ||||
-rw-r--r-- | gui/buttons.inc | 2 | ||||
-rw-r--r-- | gui/checkbox.inc | 2 | ||||
-rw-r--r-- | gui/combobox.inc | 2 | ||||
-rw-r--r-- | gui/container.inc | 2 | ||||
-rw-r--r-- | gui/dialogs.inc | 2 | ||||
-rw-r--r-- | gui/edit.inc | 2 | ||||
-rw-r--r-- | gui/form.inc | 2 | ||||
-rw-r--r-- | gui/fpgui.pas | 5 | ||||
-rw-r--r-- | gui/grid.inc | 2 | ||||
-rw-r--r-- | gui/groupbox.inc | 2 | ||||
-rw-r--r-- | gui/label.inc | 2 | ||||
-rw-r--r-- | gui/layouts.inc | 2 | ||||
-rw-r--r-- | gui/listbox.inc | 2 | ||||
-rw-r--r-- | gui/menus.inc | 2 | ||||
-rw-r--r-- | gui/panel.inc | 2 | ||||
-rw-r--r-- | gui/popupwindow.inc | 2 | ||||
-rw-r--r-- | gui/progressbar.inc | 2 | ||||
-rw-r--r-- | gui/radiobutton.inc | 2 | ||||
-rw-r--r-- | gui/scrollbar.inc | 2 | ||||
-rw-r--r-- | gui/scrollbox.inc | 2 | ||||
-rw-r--r-- | gui/separator.inc | 2 | ||||
-rw-r--r-- | gui/style.inc | 124 | ||||
-rw-r--r-- | gui/widget.inc | 2 |
31 files changed, 168 insertions, 38 deletions
diff --git a/examples/gfx/imgtest/imgtest.pas b/examples/gfx/imgtest/imgtest.pas index 329f9cbf..06b5b3f3 100644 --- a/examples/gfx/imgtest/imgtest.pas +++ b/examples/gfx/imgtest/imgtest.pas @@ -16,6 +16,10 @@ program ImgTest; +{$ifdef fpc} + {$mode objfpc}{$H+} +{$endif} + uses cmem, Classes, diff --git a/gfx/gdi/fpgfxpackage.lpk b/gfx/gdi/fpgfxpackage.lpk index eaf16609..79be55a2 100644 --- a/gfx/gdi/fpgfxpackage.lpk +++ b/gfx/gdi/fpgfxpackage.lpk @@ -10,13 +10,10 @@ <SearchPaths> <OtherUnitFiles Value="..\;..\emulayer\"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> - <LCLWidgetType Value="wince"/> <SrcPath Value="$(TargetOS)\"/> </SearchPaths> <CodeGeneration> <Generate Value="Faster"/> - <TargetCPU Value="arm"/> - <TargetOS Value="WinCE"/> </CodeGeneration> <Other> <CompilerPath Value="$(CompPath)"/> diff --git a/gfx/gdi/gfx_gdi.pas b/gfx/gdi/gfx_gdi.pas index 763fe8e3..ddbc1d1b 100644 --- a/gfx/gdi/gfx_gdi.pas +++ b/gfx/gdi/gfx_gdi.pas @@ -746,7 +746,7 @@ procedure TGDICanvas.DoDrawImageRect(AImage: TFCustomBitmap; ASourceRect: TRect; var MemDC: HDC; OldBitmap: HBITMAP; - GDIPal: array of PRGBQUAD; + GDIPal: array of RGBQUAD; i: Integer; begin ASSERT(AImage.InheritsFrom(TGDIBitmap)); @@ -760,7 +760,7 @@ begin // Set the color palette, if present if Assigned(AImage.Palette) then begin - GetMem(GDIPal, AImage.Palette.EntryCount * SizeOf(RGBQUAD)); + SetLength(GDIPal,AImage.Palette.EntryCount * SizeOf(RGBQUAD)); for i := 0 to AImage.Palette.EntryCount - 1 do with AImage.Palette.Entries[i] do begin @@ -769,8 +769,7 @@ begin GDIPal[i].rgbBlue := Blue div 257; GDIPal[i].rgbReserved := 0; end; - Windows.SetDIBColorTable(MemDC, 0, AImage.Palette.EntryCount, GDIPal[0]^); - FreeMem(GDIPal); + Windows.SetDIBColorTable(MemDC, 0, AImage.Palette.EntryCount, GDIPal[0]); end; with ASourceRect do diff --git a/gfx/geldirty.pas b/gfx/geldirty.pas index 5ffb70d2..f552399a 100644 --- a/gfx/geldirty.pas +++ b/gfx/geldirty.pas @@ -18,7 +18,10 @@ unit GELDirty; {$IFDEF Debug} {$ASSERTIONS On} {$ENDIF} -{$mode objfpc}{$H+} + +{$ifdef fpc} + {$mode objfpc}{$H+} +{$endif} interface uses diff --git a/gfx/gelimage.pas b/gfx/gelimage.pas index 78a5246f..2a578e4e 100644 --- a/gfx/gelimage.pas +++ b/gfx/gelimage.pas @@ -19,7 +19,9 @@ unit GELImage; {$ASSERTIONS On} {$ENDIF} -{$mode objfpc}{$H+} +{$ifdef fpc} + {$mode objfpc}{$H+} +{$endif} interface diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas index 75ce1da8..015f1508 100644 --- a/gfx/x11/gfx_x11.pas +++ b/gfx/x11/gfx_x11.pas @@ -19,7 +19,9 @@ unit GFX_X11; {$ASSERTIONS On} {$ENDIF} -{$mode objfpc}{$H+} +{$ifdef fpc} + {$mode objfpc}{$H+} +{$endif} { Disable this, if you do not want Xft to be used for drawing text } {$Define XftSupport} @@ -788,7 +790,7 @@ begin ASourceRect.Right - ASourceRect.Left, ASourceRect.Bottom - ASourceRect.Top, 8, 0); - WriteLn('Size allocated: ', Image^.bytes_per_line * (ASourceRect.Bottom - ASourceRect.Top) + 1); +// WriteLn('Size allocated: ', Image^.bytes_per_line * (ASourceRect.Bottom - ASourceRect.Top) + 1); { Here its necessary to alloc an extra byte, otherwise it will fail on 32-bits machines, but still work on 64-bits machines. The cause of this is unknown. } diff --git a/gfx/x11/gfxinterface.pas b/gfx/x11/gfxinterface.pas index c35db50c..f6df234c 100644 --- a/gfx/x11/gfxinterface.pas +++ b/gfx/x11/gfxinterface.pas @@ -15,6 +15,10 @@ } unit gfxinterface; +{$ifdef fpc} + {$mode objfpc}{$H+} +{$endif} + interface uses diff --git a/gui/bin.inc b/gui/bin.inc index 6cc80049..d30e20e7 100644 --- a/gui/bin.inc +++ b/gui/bin.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/buttons.inc b/gui/buttons.inc index 9e1465cb..9375b8e5 100644 --- a/gui/buttons.inc +++ b/gui/buttons.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/checkbox.inc b/gui/checkbox.inc index ce61d36c..2ca18c96 100644 --- a/gui/checkbox.inc +++ b/gui/checkbox.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/combobox.inc b/gui/combobox.inc index 1d67773c..241c13c2 100644 --- a/gui/combobox.inc +++ b/gui/combobox.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/container.inc b/gui/container.inc index 7218e064..56ae76d6 100644 --- a/gui/container.inc +++ b/gui/container.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/dialogs.inc b/gui/dialogs.inc index dd0ad91b..f0fdd54e 100644 --- a/gui/dialogs.inc +++ b/gui/dialogs.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/edit.inc b/gui/edit.inc index 2e6c0f40..ce00f4d9 100644 --- a/gui/edit.inc +++ b/gui/edit.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/form.inc b/gui/form.inc index 7193db44..3dd4b80a 100644 --- a/gui/form.inc +++ b/gui/form.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/fpgui.pas b/gui/fpgui.pas index cb12c6b8..9314e352 100644 --- a/gui/fpgui.pas +++ b/gui/fpgui.pas @@ -29,7 +29,10 @@ unit fpGUI; {$IFDEF Debug} {$ASSERTIONS On} {$ENDIF} -{$mode objfpc}{$h+} + +{$IFDEF FPC} + {$mode objfpc}{$h+} +{$ENDIF} interface diff --git a/gui/grid.inc b/gui/grid.inc index a051b20e..c7fb6ef3 100644 --- a/gui/grid.inc +++ b/gui/grid.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/groupbox.inc b/gui/groupbox.inc index 53e69a8b..07489bfd 100644 --- a/gui/groupbox.inc +++ b/gui/groupbox.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/label.inc b/gui/label.inc index b83e2811..43ce5b70 100644 --- a/gui/label.inc +++ b/gui/label.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/layouts.inc b/gui/layouts.inc index 786ae9cd..cba0ed93 100644 --- a/gui/layouts.inc +++ b/gui/layouts.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/listbox.inc b/gui/listbox.inc index febcf140..91db2be1 100644 --- a/gui/listbox.inc +++ b/gui/listbox.inc @@ -1,4 +1,4 @@ -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} { Listbox widget implementation } diff --git a/gui/menus.inc b/gui/menus.inc index 511f790d..8024a161 100644 --- a/gui/menus.inc +++ b/gui/menus.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} { All menu and menu item implementations diff --git a/gui/panel.inc b/gui/panel.inc index 0473dbe8..99015c7d 100644 --- a/gui/panel.inc +++ b/gui/panel.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} { Panel implementation. I mixture of Delphi's TPanel and TBevel. The class diff --git a/gui/popupwindow.inc b/gui/popupwindow.inc index 8194fd0f..324316d8 100644 --- a/gui/popupwindow.inc +++ b/gui/popupwindow.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/progressbar.inc b/gui/progressbar.inc index 93b28ddb..19a4de34 100644 --- a/gui/progressbar.inc +++ b/gui/progressbar.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} { Progress Bar implementation diff --git a/gui/radiobutton.inc b/gui/radiobutton.inc index a88be9e4..5d452181 100644 --- a/gui/radiobutton.inc +++ b/gui/radiobutton.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/scrollbar.inc b/gui/scrollbar.inc index 41369e5d..c6a128d8 100644 --- a/gui/scrollbar.inc +++ b/gui/scrollbar.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/scrollbox.inc b/gui/scrollbox.inc index fc8c98d1..dc4782c9 100644 --- a/gui/scrollbox.inc +++ b/gui/scrollbox.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} { Scrolling support implementation } diff --git a/gui/separator.inc b/gui/separator.inc index e4b690fa..74538c24 100644 --- a/gui/separator.inc +++ b/gui/separator.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} diff --git a/gui/style.inc b/gui/style.inc index 66b216bc..c3acf3dd 100644 --- a/gui/style.inc +++ b/gui/style.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} { Default style implementation @@ -91,10 +91,15 @@ { TDefaultStyle } TBasicStyle = class(TStyleAbs) + private + FImageCanvas: TFCanvas; + FMaskCanvas: TFCanvas; protected procedure DrawDirectionArrows(ACanvas: TFCanvas; const ARect: TRect; ADirection: TArrowDirection); procedure DrawCheckBoxCheck(ACanvas: TFCanvas; const ARect: TRect; AFlags: TCheckboxFlags); public + constructor Create; override; + destructor Destroy; override; // Colors function GetGUIColor(Color: TColor): TGfxColor; override; // General @@ -285,6 +290,113 @@ begin end; end; +constructor TBasicStyle.Create; +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 + ); + + // 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, + $33, $33, $33, $33, $33, $33, $33, $33, $33, $31, $13, $33, $33, $31, $13, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $32, $25, $33, $33, $22, $33, $33, + $33, $31, $33, $33, $11, $11, $11, $13, $33, $11, $13, $33, $33, $31, $11, $33, $33, $32, $33, $33, $22, $22, $22, $23, $33, $22, $25, $33, $33, $22, $23, $33, + $33, $11, $13, $33, $31, $11, $11, $33, $31, $11, $13, $33, $33, $31, $11, $13, $33, $22, $23, $33, $32, $22, $22, $55, $32, $22, $25, $33, $33, $22, $22, $33, + $31, $11, $11, $33, $33, $11, $13, $33, $33, $11, $13, $33, $33, $31, $11, $33, $32, $22, $22, $33, $33, $22, $25, $53, $33, $22, $25, $33, $33, $22, $25, $53, + $11, $11, $11, $13, $33, $31, $33, $33, $33, $31, $13, $33, $33, $31, $13, $33, $22, $22, $22, $23, $33, $32, $55, $33, $33, $32, $25, $33, $33, $22, $55, $33, + $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $13, $33, $33, $31, $33, $33, $35, $55, $55, $55, $33, $33, $53, $33, $33, $33, $25, $33, $33, $25, $53, $33, + $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $35, $33, $33, $35, $33, $33 + ); + +var + PalData: array[0..7] of TGfxColor; + Palette: TGfxPalette; + Bitmap: TFBitmap; +begin + inherited Create; + + FImageCanvas := TFCanvas(GFScreen.CreateBitmapCanvas(65, 33)); + FMaskCanvas := TFCanvas(GFScreen.CreateMonoBitmapCanvas(12, 12)); + + PalData[0] := colMagenta; + PalData[1] := GetGUIColor(cl3DDkShadow); + PalData[2] := GetGUIColor(cl3DShadow); + PalData[3] := GetGUIColor(cl3DFace); + PalData[4] := GetGUIColor(cl3DLight); + PalData[5] := GetGUIColor(cl3DHighlight); + PalData[6] := GetGUIColor(clWindowText); + PalData[7] := GetGUIColor(clWindow); + Palette := TGfxPalette.Create(8, @PalData); + + Bitmap := TFBitmap.Create(60, 12, PixelFormatPal4A); + BitMap.Palette := Palette; + BitMap.SetPixelsFromData(@RadioBitmapData, 30); + FImageCanvas.DrawImage(Bitmap, Point(0,0)); + Bitmap.Free; + + Bitmap := TFBitmap.Create(12, 12, PixelFormatMono); + Bitmap.SetPixelsFromData(@RadioMaskData, 2); + FMaskCanvas.DrawImage(Bitmap, Point(0, 0)); + Bitmap.Free; + + Palette := TGfxPalette.Create(8, @PalData); + Bitmap := TFBitmap.Create(66, 13, PixelFormatPal4); + BitMap.Palette := Palette; + BitMap.SetPixelsFromData(@CheckBoxBitmapData, 33); + FImageCanvas.DrawImage(Bitmap, Point(0, 12)); + Bitmap.Free; + + Palette := TGfxPalette.Create(8, @PalData); + Bitmap := TFBitmap.Create(64, 8, PixelFormatPal4); + BitMap.Palette := Palette; + BitMap.SetPixelsFromData(@ArrowBitmapData, 32); + FImageCanvas.DrawImage(Bitmap, Point(0, 25)); + Bitmap.Free; + + Palette.Release; +end; + +destructor TBasicStyle.Destroy; +begin + FImageCanvas.Free; + FMaskCanvas.Free; + inherited Destroy; +end; + // helper functions @@ -557,7 +669,8 @@ var Index, BtnY: Integer; r: TRect; begin -{ + {$Note This is only while I fix the Palette issue under Linux/X11 } + {$IFDEF MSWINDOWS} with ARect do begin BtnY := Top + (Bottom - Top - 12) div 2; @@ -568,11 +681,13 @@ begin Inc(Index, 2); end else Index := 2 + Ord(cbIsChecked in Flags) * 2; - Canvas.MaskedCopyRect(ImageCanvas, MaskCanvas, + + Canvas.MaskedCopyRect(FImageCanvas, FMaskCanvas, Rect(Index * 12, 0, (Index + 1) * 12, 12), Point(0, 0), Point(Left, BtnY)); end; -} + {$ELSE} + // cl3DLight, cl3DHighlight, cl3DDkShadow, cl3DShadow SetUIColor(Canvas, clLtGray); r.Left := ARect.Left; @@ -602,6 +717,7 @@ begin OffsetRect(r, -1, -1); Canvas.FillRect(r); end; + {$ENDIF} if cbHasFocus in Flags then with LabelRect do diff --git a/gui/widget.inc b/gui/widget.inc index f6d58742..cd3df2e6 100644 --- a/gui/widget.inc +++ b/gui/widget.inc @@ -14,7 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. } -{%mainunit fpgui.pp} +{%mainunit fpgui.pas} {$IFDEF read_interface} |