customdrawn: Starts the Android checkbox drawing

git-svn-id: trunk@33508 -
This commit is contained in:
sekelsenmat 2011-11-13 18:46:15 +00:00
parent 59ecf5009a
commit 697746f2e9
9 changed files with 155 additions and 8 deletions

6
.gitattributes vendored
View File

@ -637,6 +637,7 @@ components/compilers/javascript/examples/ReadJSClassesXML.lpi svneol=native#text
components/compilers/javascript/examples/ReadJSClassesXML.lpr svneol=native#text/plain
components/compilers/javascript/examples/jsclassxmlread.pas svneol=native#text/plain
components/custom/README.txt svneol=native#text/plain
components/customdrawn/build_resources.sh svneol=native#text/plain
components/customdrawn/customdrawn.lpk svneol=native#text/plain
components/customdrawn/customdrawn.pas svneol=native#text/pascal
components/customdrawn/customdrawn_android.pas svneol=native#text/plain
@ -650,6 +651,11 @@ components/customdrawn/customdrawn_winxp.pas svneol=native#text/plain
components/customdrawn/customdrawncontrols.pas svneol=native#text/pascal
components/customdrawn/customdrawndrawers.pas svneol=native#text/plain
components/customdrawn/customdrawnextras.pas svneol=native#text/plain
components/customdrawn/customdrawnimages/android_checkbox.png -text svneol=unset#image/png
components/customdrawn/customdrawnimages/android_checkbox_checked_ldpi.bmp -text
components/customdrawn/customdrawnimages/android_checkbox_checked_vldpi.bmp -text
components/customdrawn/customdrawnimages/android_checkbox_vldpi.bmp -text
components/customdrawn/customdrawnimages/android_vldpi.lrs svneol=native#text/plain
components/customdrawn/customdrawnutils.pas svneol=native#text/pascal
components/customform/custforms.pp svneol=native#text/plain
components/customform/demo/appform.pas svneol=native#text/plain

View File

@ -0,0 +1 @@
../../tools/lazres customdrawnimages/android_vldpi.lrs customdrawnimages/android_checkbox_vldpi.bmp customdrawnimages/android_checkbox_checked_vldpi.bmp

View File

@ -6,23 +6,47 @@ interface
uses
// RTL
Classes, SysUtils,
Classes, SysUtils, Types,
// fpimage
fpcanvas, fpimgcanv, fpimage,
// LCL -> Use only TForm, TWinControl, TCanvas and TLazIntfImage
Graphics, Controls, LCLType, LCLIntf, IntfGraphics,
Graphics, Controls, LCLType, LCLIntf, IntfGraphics, LResources,
//
customdrawncontrols, customdrawnutils;
customdrawndrawers, customdrawn_common;
{type
TCDButtonDrawerAndroid = class(TCDButtonDrawer)
type
{ TCDDrawerAndroid }
TCDDrawerAndroid = class(TCDDrawerCommon)
public
procedure DrawToIntfImage(ADest: TFPImageCanvas; CDButton: TCDButton); override;
procedure DrawToCanvas(ADest: TCanvas; CDButton: TCDButton); override;
end;}
// General drawing routines
{procedure DrawFocusRect(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); override;
procedure DrawRaisedFrame(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); override;
procedure DrawSunkenFrame(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); override;
procedure DrawShallowSunkenFrame(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); override;}
procedure DrawTickmark(ADest: TCanvas; ADestPos: TPoint); override;
{procedure DrawSlider(ADest: TCanvas; ADestPos: TPoint; ASize: TSize; AState: TCDControlState); override;
procedure DrawCompactArrow(ADest: TCanvas; ADestPos: TPoint; ADirection: TCDControlState); override;}
// ===================================
// Standard Tab
// ===================================
// TCDButton
{ procedure DrawButton(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
// TCDEdit
procedure DrawEditBackground(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
AState: TCDControlState; AStateEx: TCDEditStateEx); override;}
// TCDCheckBox
procedure DrawCheckBoxSquare(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
end;
implementation
const
ANDROID_DPI = 'vldpi';
{procedure TCDButtonDrawerAndroid.DrawToIntfImage(ADest: TFPImageCanvas;
CDButton: TCDButton);
begin
@ -67,5 +91,40 @@ end;
initialization
RegisterButtonDrawer(TCDButtonDrawerAndroid.Create, dsAndroid);}
{ TCDDrawerAndroid }
procedure TCDDrawerAndroid.DrawTickmark(ADest: TCanvas; ADestPos: TPoint);
begin
end;
procedure TCDDrawerAndroid.DrawCheckBoxSquare(ADest: TCanvas; ADestPos: TPoint;
ASize: TSize; AState: TCDControlState; AStateEx: TCDControlStateEx);
var
Bitmap: TBitmap;
begin
Bitmap := TBitmap.Create;
try
if csfOn in AState then
Bitmap.LoadFromLazarusResource('android_checkbox_checked_'+ANDROID_DPI)
else
Bitmap.LoadFromLazarusResource('android_checkbox_'+ANDROID_DPI);
ADest.Draw(0, 0, Bitmap);
finally
Bitmap.Free;
end;
end;
initialization
//{$if defined(Android)}
// Use ldpi when in the real Android OS
// {$I android_ldpi.lrs}
//{$else}
// of vldpi for desktop targets
{$I customdrawnimages/android_vldpi.lrs}
//{$endif}
RegisterDrawer(TCDDrawerAndroid.Create, dsAndroid);
end.

View File

@ -148,6 +148,7 @@ begin
lTmpText := UTF8Copy(lControlText, 1, AStateEx.CaretPos.X-AStateEx.VisibleTextStart.X+1);
lCaretPixelPos := ADest.TextWidth(lTmpText) + 3;
ADest.Pen.Color := clBlack;
ADest.Pen.Style := psSolid;
ADest.Line(lCaretPixelPos, lTextTopSpacing, lCaretPixelPos, lTextTopSpacing+lCaptionHeight);
ADest.Line(lCaretPixelPos+1, lTextTopSpacing, lCaretPixelPos+1, lTextTopSpacing+lCaptionHeight);
end;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

View File

@ -0,0 +1,80 @@
LazarusResources.Add('android_checkbox_vldpi','BMP',[
'BM'#6#3#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#15#0#0#0#15#0#0#0#1#0#24#0#0#0#0#0#208
+#2#0#0#19#11#0#0#19#11#0#0#0#0#0#0#0#0#0#0#188#189#188#188#189#188#188#189
+#188#188#188#188#188#188#188#188#188#188#188#188#188#188#188#188#188#189#188
+#188#189#188#188#189#188#188#188#188#188#188#188#188#188#188#194#192#193#0#0
+#0#188#189#188#188#185#188#183#185#183#188#187#188#186#188#186#188#188#188
+#193#191#192#188#190#187#188#186#187#181#183#181#188#186#187#184#186#183#188
+#187#188#187#188#187#187#188#187#0#0#0#188#189#188#188#186#187#188#186#187
+#188#187#188#188#187#188#177#173#177#169#171#168#196#195#196#188#190#187#188
+#186#187#188#186#187#188#187#188#188#187#188#188#187#188#188#188#188#0#0#0
+#192#191#192#192#191#192#188#189#188#190#189#190#182#182#182#171#172#171#176
+#178#177#176#175#176#203#203#203#188#189#188#191#189#190#188#189#188#189#189
+#189#188#189#188#191#191#191#0#0#0#195#197#196#194#194#194#193#194#193#186
+#189#187#175#173#174#181#182#181#180#181#180#184#179#183#179#178#178#212#206
+#211#193#194#194#192#194#191#191#193#190#190#193#191#196#194#195#0#0#0#203
+#202#202#203#198#202#196#198#197#175#176#175#187#185#186#180#183#181#187#185
+#188#184#184#184#185#181#185#189#186#189#206#205#205#197#198#197#197#198#197
+#197#198#197#197#198#197#0#0#0#202#201#201#202#201#201#180#181#180#186#185
+#186#186#187#186#162#160#161#164#165#164#175#174#174#188#188#188#183#184#183
+#201#202#201#206#205#206#199#200#199#197#199#197#203#202#202#0#0#0#208#206
+#207#205#204#205#179#175#177#188#188#188#168#168#169#192#192#192#204#204#203
+#174#173#174#176#176#176#192#191#192#185#184#184#209#208#209#207#207#207#204
+#204#204#204#205#204#0#0#0#208#210#207#207#208#207#176#177#176#161#160#161
+#197#195#196#212#210#212#211#209#210#210#209#210#175#175#175#184#184#184#193
+#195#192#189#191#188#217#216#217#212#210#212#212#210#212#0#0#0#214#214#214
+#214#214#213#213#214#213#213#214#213#213#214#213#213#214#213#213#214#213#213
+#214#213#213#214#213#173#174#173#184#189#185#200#200#200#196#197#196#220#225
+#221#219#217#219#0#0#0#221#221#221#221#222#221#221#221#221#220#221#220#221
+#221#220#219#221#219#221#220#220#220#219#219#221#218#220#220#221#220#181#183
+#182#192#191#191#201#203#201#204#206#204#222#224#221#0#0#0#225#226#225#225
+#226#225#225#227#225#225#227#225#225#227#226#226#226#225#225#226#225#225#226
+#225#225#226#225#225#226#225#225#226#225#189#189#189#193#194#193#190#189#190
+#228#227#228#0#0#0#230#232#230#230#230#230#230#230#230#230#230#230#230#231
+#230#230#231#230#230#230#230#230#230#230#230#230#230#230#230#230#230#230#230
+#230#229#229#190#192#190#204#206#204#230#231#230#0#0#0#236#237#237#236#234
+#236#235#234#234#233#234#233#232#234#232#230#234#231#232#234#232#234#234#234
+#235#234#235#237#234#236#235#234#235#234#234#234#232#234#233#231#233#231#238
+#234#237#0#0#0#243#240#242#243#240#242#237#239#237#240#239#240#237#238#237
+#237#238#238#239#238#239#237#239#237#242#240#241#236#240#237#242#240#241#237
+#239#237#239#238#239#238#238#238#238#238#238#0#0#0
]);
LazarusResources.Add('android_checkbox_checked_vldpi','BMP',[
'BM'#6#3#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#15#0#0#0#15#0#0#0#1#0#24#0#0#0#0#0#208
+#2#0#0#19#11#0#0#19#11#0#0#0#0#0#0#0#0#0#0#188#189#188#188#189#188#188#189
+#188#188#188#188#188#188#188#188#188#188#188#188#188#188#188#188#188#189#188
+#188#189#188#188#189#188#188#188#188#188#188#188#188#188#188#194#192#193#0#0
+#0#188#189#188#188#185#188#183#185#183#188#187#188#186#188#186#188#188#188
+#194#191#194#188#190#187#188#186#187#181#185#181#188#186#187#184#186#183#188
+#187#188#187#188#187#187#188#187#0#0#0#188#189#188#188#186#187#188#186#187
+#188#187#188#188#187#188'k'#164'j*'#170'Q'#168#190#168#188#190#187#188#186
+#187#188#186#187#188#187#188#188#187#188#188#187#188#188#188#188#0#0#0#192
+#191#192#192#191#192#188#189#188#190#189#190#137#172#136'*'#183'X.'#199'`('
+#171'R'#192#197#192#188#189#188#192#189#192#188#189#188#189#189#189#188#189
+#188#192#191#192#0#0#0#196#197#196#194#194#194#193#194#193#163#181#163'%'#168
+'P/'#204'b2'#213'g-'#195'^?'#168'O'#211#206#212#194#194#194#193#194#193#191
+#193#190#190#193#190#197#193#197#0#0#0#203#201#202#203#198#203#197#198#197'%'
+#168'P/'#201'a1'#207'd/'#203'b1'#209'e,'#193']h'#168'h'#206#204#206#197#198
+#197#197#198#197#197#198#197#197#198#197#0#0#0#202#201#202#202#201#202'9'#171
+'Q.'#198'_.'#200'` '#149'F?'#142'B'''#174'S1'#207'd*'#184'X'#159#188#160#206
+#205#206#199#201#198#197#201#197#203#202#203#0#0#0#208#205#208#205#204#205'%'
+#168'P-'#195'^!'#154'I'#165#180#165#204#204#204'X'#155'X'''#174'S/'#204'b'''
+#174'S'#181#201#180#207#206#207#204#204#204#204#205#204#0#0#0#208#210#207#207
+#208#207'k'#154'k'''#133'>'#164#181#163#212#210#212#211#209#210#210#209#210
+'W'#153'V('#176'T.'#199'`+'#174'S'#208#212#208#212#210#212#212#210#212#0#0#0
+#214#214#214#214#214#214#213#214#213#213#214#213#213#214#213#213#214#213#213
+#214#213#213#214#213#213#214#213'S'#139'S('#177'U,'#193']C'#169'O'#220#223
+#220#219#217#219#0#0#0#221#221#221#221#222#221#221#221#221#220#221#220#221
+#221#221#219#221#219#221#220#221#220#219#220#221#218#221#220#220#220'['#154
+'Z'''#174'S+'#188'[q'#180'q'#222#224#221#0#0#0#225#226#225#225#226#225#225
+#226#225#225#227#225#225#227#225#226#226#226#225#226#225#225#226#225#225#226
+#225#225#226#225#225#226#225'P'#159'Q&'#170'Q#'#160'L'#223#223#223#0#0#0#230
+#232#230#230#230#230#230#230#230#230#230#230#230#231#230#230#231#230#230#230
+#230#230#230#230#230#230#230#230#230#230#230#230#230#226#226#226'~'#165'~'
+#157#186#158#230#231#230#0#0#0#236#237#236#236#234#236#235#234#235#233#234
+#233#232#234#232#230#234#230#232#234#232#234#234#234#235#234#235#237#234#237
+#235#234#235#234#234#234#232#234#232#231#234#231#238#234#238#0#0#0#243#240
+#243#243#240#243#237#239#237#240#239#240#237#238#237#237#238#237#239#238#239
+#237#239#237#242#240#242#236#240#236#242#240#242#237#239#237#239#238#239#238
+#238#238#238#238#238#0#0#0
]);