mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-30 19:02:49 +02:00
customdrawncontrols: Adds disabled looks for button and edit and adds partial code for the spin
git-svn-id: trunk@35037 -
This commit is contained in:
parent
28fbd2b34c
commit
26d2cf7352
@ -116,6 +116,11 @@ type
|
||||
AState: TCDControlState; AStateEx: TCDCTabControlStateEx); override;
|
||||
procedure DrawTab(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
|
||||
AState: TCDControlState; AStateEx: TCDCTabControlStateEx); override;
|
||||
// ===================================
|
||||
// Misc Tab
|
||||
// ===================================
|
||||
procedure DrawSpinEdit(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
|
||||
AState: TCDControlState; AStateEx: TCDSpinStateEx); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -126,6 +131,10 @@ const
|
||||
WIN2000_FRAME_GRAY = $0099A8AC;
|
||||
WIN2000_FRAME_DARK_GRAY = $00646F71;
|
||||
|
||||
WIN2000_DISABLED_TEXT = WIN2000_FRAME_GRAY;
|
||||
|
||||
WIN2000_SELECTION_BACKGROUND = $00C56A31;
|
||||
|
||||
WIN2000_SCROLLBAR_BACKGROUND = $00ECF4F6;
|
||||
|
||||
WIN2000_PROGRESSBAR_BLUE = $00C56A31;
|
||||
@ -680,12 +689,28 @@ begin
|
||||
lTextOutPos.Y := (ASize.cy - ADest.TextHeight(Str)) div 2;
|
||||
ADest.Brush.Style := bsClear;
|
||||
ADest.Pen.Style := psSolid;
|
||||
if csfSunken in AState then
|
||||
if csfEnabled in AState then
|
||||
begin
|
||||
if csfSunken in AState then
|
||||
begin
|
||||
Inc(lTextOutPos.X);
|
||||
Inc(lTextOutPos.Y);
|
||||
end;
|
||||
ADest.TextOut(lTextOutPos.X, lTextOutPos.Y, Str)
|
||||
end
|
||||
else
|
||||
begin
|
||||
// The disabled text is composed by a white shadow under it and a grey text
|
||||
ADest.Font.Color := clWhite;
|
||||
Inc(lTextOutPos.X);
|
||||
Inc(lTextOutPos.Y);
|
||||
ADest.TextOut(lTextOutPos.X, lTextOutPos.Y, Str);
|
||||
//
|
||||
ADest.Font.Color := WIN2000_DISABLED_TEXT;
|
||||
Dec(lTextOutPos.X);
|
||||
Dec(lTextOutPos.Y);
|
||||
ADest.TextOut(lTextOutPos.X, lTextOutPos.Y, Str);
|
||||
end;
|
||||
ADest.TextOut(lTextOutPos.X, lTextOutPos.Y, Str)
|
||||
end;
|
||||
|
||||
procedure TCDDrawerCommon.DrawEditBackground(ADest: TCanvas;
|
||||
@ -751,7 +776,14 @@ var
|
||||
lTextWidth: Integer;
|
||||
lControlTextLen: PtrInt;
|
||||
lTextLeftSpacing, lTextRightSpacing, lTextTopSpacing, lTextBottomSpacing: Integer;
|
||||
lTextColor: TColor;
|
||||
begin
|
||||
// Configure the text color
|
||||
if csfEnabled in AState then
|
||||
lTextColor := AStateEx.Font.Color
|
||||
else
|
||||
lTextColor := WIN2000_DISABLED_TEXT;
|
||||
|
||||
// Background
|
||||
DrawEditBackground(ADest, Point(0, 0), ASize, AState, AStateEx);
|
||||
|
||||
@ -759,6 +791,7 @@ begin
|
||||
lControlTextLen := UTF8Length(AStateEx.Caption);
|
||||
ADest.Brush.Style := bsClear;
|
||||
ADest.Font.Assign(AStateEx.Font);
|
||||
ADest.Font.Color := lTextColor;
|
||||
lTextLeftSpacing := GetMeasures(TCDEDIT_LEFT_TEXT_SPACING);
|
||||
lTextRightSpacing := GetMeasures(TCDEDIT_RIGHT_TEXT_SPACING);
|
||||
lTextTopSpacing := GetMeasures(TCDEDIT_TOP_TEXT_SPACING);
|
||||
@ -794,7 +827,7 @@ begin
|
||||
// The selection background
|
||||
lVisibleText := UTF8Copy(lControlText, lSelLeftPos+1, lSelLength);
|
||||
lTextWidth := ADest.TextWidth(lVisibleText);
|
||||
ADest.Brush.Color := clBlue;
|
||||
ADest.Brush.Color := WIN2000_SELECTION_BACKGROUND;
|
||||
ADest.Brush.Style := bsSolid;
|
||||
ADest.Rectangle(lSelLeftPixelPos, lTextTopSpacing, lSelLeftPixelPos+lTextWidth, ASize.cy-lTextBottomSpacing);
|
||||
ADest.Brush.Style := bsClear;
|
||||
@ -806,7 +839,7 @@ begin
|
||||
|
||||
// Text right of the selection
|
||||
ADest.Brush.Color := clWhite;
|
||||
ADest.Font.Color := AStateEx.Font.Color;
|
||||
ADest.Font.Color := lTextColor;
|
||||
lVisibleText := UTF8Copy(lControlText, lSelLeftPos+lSelLength+1, lControlTextLen);
|
||||
ADest.TextOut(lSelLeftPixelPos, lTextTopSpacing, lVisibleText);
|
||||
end;
|
||||
@ -1605,6 +1638,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCDDrawerCommon.DrawSpinEdit(ADest: TCanvas; ADestPos: TPoint;
|
||||
ASize: TSize; AState: TCDControlState; AStateEx: TCDSpinStateEx);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{ TCDListViewDrawerCommon }
|
||||
|
||||
initialization
|
||||
|
@ -215,6 +215,14 @@ type
|
||||
CurStartLeftPos: Integer;
|
||||
end;
|
||||
|
||||
TCDSpinStateEx = class(TCDPositionedCStateEx)
|
||||
public
|
||||
Min: integer;
|
||||
Increment: integer;
|
||||
FloatMin: Double;
|
||||
FloatIncrement: Double;
|
||||
end;
|
||||
|
||||
TCDControlID = (
|
||||
cidControl,
|
||||
// Standard
|
||||
@ -363,6 +371,11 @@ type
|
||||
AState: TCDControlState; AStateEx: TCDCTabControlStateEx); virtual; abstract;
|
||||
procedure DrawTab(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
|
||||
AState: TCDControlState; AStateEx: TCDCTabControlStateEx); virtual; abstract;
|
||||
// ===================================
|
||||
// Misc Tab
|
||||
// ===================================
|
||||
procedure DrawSpinEdit(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
|
||||
AState: TCDControlState; AStateEx: TCDSpinStateEx); virtual; abstract;
|
||||
end;
|
||||
|
||||
procedure RegisterDrawer(ADrawer: TCDDrawer; AStyle: TCDDrawStyle);
|
||||
|
@ -6,6 +6,7 @@
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
|
@ -2,7 +2,7 @@ program cd_test_all;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$R *.res}
|
||||
//{$R *.res}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
|
Binary file not shown.
@ -10,10 +10,10 @@ object Form1: TForm1
|
||||
LCLVersion = '0.9.31'
|
||||
object comboControls: TComboBox
|
||||
Left = 80
|
||||
Height = 27
|
||||
Height = 21
|
||||
Top = 12
|
||||
Width = 136
|
||||
ItemHeight = 0
|
||||
ItemHeight = 13
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'TCDMenu'
|
||||
@ -39,6 +39,7 @@ object Form1: TForm1
|
||||
'TCDUpDown'
|
||||
'TCDPageControl'
|
||||
'TCDTabControl'
|
||||
'TCDSpinEdit'
|
||||
)
|
||||
OnChange = comboControlsChange
|
||||
TabOrder = 0
|
||||
@ -60,7 +61,7 @@ object Form1: TForm1
|
||||
Height = 240
|
||||
Top = 40
|
||||
Width = 463
|
||||
PageIndex = 2
|
||||
PageIndex = 23
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 2
|
||||
TabStop = True
|
||||
@ -132,6 +133,26 @@ object Form1: TForm1
|
||||
TabOrder = 5
|
||||
TabStop = True
|
||||
end
|
||||
object Button3: TButton
|
||||
Left = 7
|
||||
Height = 25
|
||||
Top = 48
|
||||
Width = 75
|
||||
Caption = 'Disabled'
|
||||
Enabled = False
|
||||
TabOrder = 6
|
||||
end
|
||||
object CDButton7: TCDButton
|
||||
Left = 232
|
||||
Height = 25
|
||||
Top = 88
|
||||
Width = 75
|
||||
Caption = 'Disabled'
|
||||
DrawStyle = dsWin2000
|
||||
Enabled = False
|
||||
TabOrder = 7
|
||||
TabStop = True
|
||||
end
|
||||
end
|
||||
object pageEdits: TPage
|
||||
object CDEdit1: TCDEdit
|
||||
@ -166,6 +187,24 @@ object Form1: TForm1
|
||||
DrawStyle = dsWinXP
|
||||
Text = 'editWinXP'
|
||||
end
|
||||
object Edit2: TEdit
|
||||
Left = 8
|
||||
Height = 21
|
||||
Top = 56
|
||||
Width = 80
|
||||
Enabled = False
|
||||
TabOrder = 4
|
||||
Text = 'disabled'
|
||||
end
|
||||
object CDEdit3: TCDEdit
|
||||
Left = 224
|
||||
Height = 25
|
||||
Top = 26
|
||||
Width = 80
|
||||
DrawStyle = dsDefault
|
||||
Enabled = False
|
||||
Text = 'disabled'
|
||||
end
|
||||
end
|
||||
object pageEditMultiline: TPage
|
||||
object Memo1: TMemo
|
||||
@ -331,16 +370,16 @@ object Form1: TForm1
|
||||
Height = 19
|
||||
Top = 47
|
||||
Width = 93
|
||||
DrawStyle = dsDefault
|
||||
Caption = 'dsCommon'
|
||||
DrawStyle = dsDefault
|
||||
end
|
||||
object CDRadioButton1: TCDRadioButton
|
||||
Left = 14
|
||||
Height = 19
|
||||
Top = 7
|
||||
Width = 93
|
||||
DrawStyle = dsCommon
|
||||
Caption = 'dsCommon'
|
||||
DrawStyle = dsCommon
|
||||
TabStop = False
|
||||
end
|
||||
object CDRadioButton3: TCDRadioButton
|
||||
@ -348,9 +387,9 @@ object Form1: TForm1
|
||||
Height = 19
|
||||
Top = 27
|
||||
Width = 93
|
||||
Caption = 'dsCommon'
|
||||
Checked = True
|
||||
DrawStyle = dsDefault
|
||||
Caption = 'dsCommon'
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -471,8 +510,8 @@ object Form1: TForm1
|
||||
Top = 13
|
||||
Width = 100
|
||||
AutoSize = True
|
||||
DrawStyle = dsCommon
|
||||
Caption = 'dsCommon'
|
||||
DrawStyle = dsCommon
|
||||
end
|
||||
object CDGroupBox2: TCDGroupBox
|
||||
Left = 279
|
||||
@ -480,8 +519,8 @@ object Form1: TForm1
|
||||
Top = 13
|
||||
Width = 100
|
||||
AutoSize = True
|
||||
DrawStyle = dsWinCE
|
||||
Caption = 'dsWinCE'
|
||||
DrawStyle = dsWinCE
|
||||
end
|
||||
end
|
||||
object pagePanels: TPage
|
||||
@ -793,8 +832,8 @@ object Form1: TForm1
|
||||
Height = 20
|
||||
Top = 31
|
||||
Width = 70
|
||||
DrawStyle = dsCommon
|
||||
Caption = 'dsCommon'
|
||||
DrawStyle = dsCommon
|
||||
end
|
||||
end
|
||||
object pageTrackBars: TPage
|
||||
@ -1229,6 +1268,27 @@ object Form1: TForm1
|
||||
TabIndex = 0
|
||||
end
|
||||
end
|
||||
object pageSpins: TPage
|
||||
object SpinEdit1: TSpinEdit
|
||||
Left = 13
|
||||
Height = 21
|
||||
Top = 24
|
||||
Width = 85
|
||||
TabOrder = 0
|
||||
Value = 1
|
||||
end
|
||||
object FloatSpinEdit1: TFloatSpinEdit
|
||||
Left = 13
|
||||
Height = 21
|
||||
Top = 104
|
||||
Width = 85
|
||||
Increment = 0.1
|
||||
MaxValue = 100
|
||||
MinValue = 0
|
||||
TabOrder = 1
|
||||
Value = 1.1
|
||||
end
|
||||
end
|
||||
end
|
||||
object memoLog: TMemo
|
||||
AnchorSideLeft.Control = Owner
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, customdrawncontrols, customdrawndrawers, Forms,
|
||||
Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons;
|
||||
Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons, Spin;
|
||||
|
||||
type
|
||||
|
||||
@ -16,12 +16,14 @@ type
|
||||
BitBtn1: TBitBtn;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Button3: TButton;
|
||||
CDButton1: TCDButton;
|
||||
CDButton2: TCDButton;
|
||||
CDButton3: TCDButton;
|
||||
CDButton4: TCDButton;
|
||||
CDButton5: TCDButton;
|
||||
CDButton6: TCDButton;
|
||||
CDButton7: TCDButton;
|
||||
CDCheckBox1: TCDCheckBox;
|
||||
CDCheckBox2: TCDCheckBox;
|
||||
CDCheckBox3: TCDCheckBox;
|
||||
@ -32,9 +34,14 @@ type
|
||||
CDCheckBox8: TCDCheckBox;
|
||||
CDEdit1: TCDEdit;
|
||||
CDEdit2: TCDEdit;
|
||||
CDEdit3: TCDEdit;
|
||||
CDTabControl1: TCDTabControl;
|
||||
Edit2: TEdit;
|
||||
FloatSpinEdit1: TFloatSpinEdit;
|
||||
pageSpins: TPage;
|
||||
sbCommon1: TCDScrollBar;
|
||||
sbCommon2: TCDScrollBar;
|
||||
SpinEdit1: TSpinEdit;
|
||||
TabControl1: TTabControl;
|
||||
trackScrollBarPageSize: TCDTrackBar;
|
||||
CheckBox2: TCheckBox;
|
||||
|
Loading…
Reference in New Issue
Block a user