mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 17:17:52 +02:00
LCL: Move TCheckCombobox to LazControls
This commit is contained in:
parent
33c25303e6
commit
277ce7472c
603
components/lazcontrols/checkcombo.pas
Normal file
603
components/lazcontrols/checkcombo.pas
Normal file
@ -0,0 +1,603 @@
|
||||
{ Visual component TCheckComboBox
|
||||
|
||||
Copyright (C) 2014 Vojtěch Čihák, e-mail: cihakvjtch@seznam.cz
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under the terms of the
|
||||
GNU Library General Public License as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version with the following modification:
|
||||
|
||||
As a special exception, the copyright holders of this library give you permission to link this
|
||||
library with independent modules to produce an executable, regardless of the license terms of
|
||||
these independent modules,and to copy and distribute the resulting executable under terms of
|
||||
your choice, provided that you also meet, for each linked independent module, the terms and
|
||||
conditions of the license of that module. An independent module is a module which is not derived
|
||||
from or based on this library. If you modify this library, you may extend this exception to your
|
||||
version of the library, but you are not obligated to do so. If you do not wish to do so, delete
|
||||
this exception statement from your version.
|
||||
|
||||
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. See
|
||||
the GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License along with this
|
||||
library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth
|
||||
Floor, Boston, MA 02110-1335, USA.
|
||||
}
|
||||
|
||||
unit CheckCombo;
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, types,
|
||||
LCLIntf, LCLType, LMessages, LResources, LazLoggerBase,
|
||||
ImgList, Controls, StdCtrls, ComCtrls, ExtCtrls, Graphics, GraphUtil,
|
||||
Themes, Forms;
|
||||
|
||||
type
|
||||
{ Events }
|
||||
TCheckItemChange = procedure(Sender: TObject; AIndex: Integer) of object;
|
||||
|
||||
{ TCheckComboItemState }
|
||||
TCheckComboItemState = class
|
||||
public
|
||||
State: TCheckBoxState;
|
||||
Enabled: Boolean;
|
||||
Data: TObject;
|
||||
end;
|
||||
|
||||
{ TCustomCheckCombo }
|
||||
TCustomCheckCombo = class(TCustomComboBox)
|
||||
private
|
||||
FAllowGrayed: Boolean;
|
||||
FOnItemChange: TCheckItemChange;
|
||||
procedure AsyncCheckItemStates(Data: PtrInt);
|
||||
function GetChecked(AIndex: Integer): Boolean;
|
||||
function GetCount: Integer;
|
||||
function GetItemEnabled(AIndex: Integer): Boolean;
|
||||
function GetObject(AIndex: Integer): TObject;
|
||||
function GetState(AIndex: Integer): TCheckBoxState;
|
||||
procedure SetChecked(AIndex: Integer; AValue: Boolean);
|
||||
procedure SetItemEnabled(AIndex: Integer; AValue: Boolean);
|
||||
procedure SetObject(AIndex: Integer; AValue: TObject);
|
||||
procedure SetState(AIndex: Integer; AValue: TCheckBoxState);
|
||||
protected
|
||||
FCheckHighlight: Boolean;
|
||||
FCheckSize: TSize;
|
||||
FDropped: Boolean;
|
||||
FHilightedIndex: Integer;
|
||||
FHiLiteLeft: Integer;
|
||||
FHiLiteRight: Integer;
|
||||
FNeedMeasure: Boolean;
|
||||
FRejectDropDown: Boolean;
|
||||
FRejectToggleOnSelect: Boolean;
|
||||
FRightToLeft: Boolean;
|
||||
FTextHeight: SmallInt;
|
||||
procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
|
||||
procedure ClearItemStates;
|
||||
procedure CloseUp; override;
|
||||
procedure DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState); override;
|
||||
procedure DropDown; override;
|
||||
procedure FontChanged(Sender: TObject); override;
|
||||
procedure InitializeWnd; override;
|
||||
procedure InitItemStates;
|
||||
procedure CheckItemStates;
|
||||
procedure QueueCheckItemStates;
|
||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||
procedure Loaded; override;
|
||||
procedure MouseLeave; override;
|
||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
||||
procedure SetItemHeight(const AValue: Integer); override;
|
||||
procedure SetItems(const Value: TStrings); override;
|
||||
procedure Select; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure AddItem(const AItem: string; AState: TCheckBoxState; AEnabled: Boolean = True); reintroduce;
|
||||
procedure AssignItems(AItems: TStrings);
|
||||
procedure Clear; override;
|
||||
procedure DeleteItem(AIndex: Integer);
|
||||
procedure CheckAll(AState: TCheckBoxState; AAllowGrayed: Boolean = True; AAllowDisabled: Boolean = True);
|
||||
procedure Toggle(AIndex: Integer);
|
||||
property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed default False;
|
||||
property Count: Integer read GetCount;
|
||||
property Checked[AIndex: Integer]: Boolean read GetChecked write SetChecked;
|
||||
property ItemEnabled[AIndex: Integer]: Boolean read GetItemEnabled write SetItemEnabled;
|
||||
property Objects[AIndex: Integer]: TObject read GetObject write SetObject;
|
||||
property State[AIndex: Integer]: TCheckBoxState read GetState write SetState;
|
||||
property OnItemChange: TCheckItemChange read FOnItemChange write FOnItemChange;
|
||||
end;
|
||||
|
||||
{ TCheckComboBox }
|
||||
TCheckComboBox = class(TCustomCheckCombo)
|
||||
published
|
||||
property Align;
|
||||
property AllowGrayed;
|
||||
property Anchors;
|
||||
property ArrowKeysTraverseList;
|
||||
property AutoDropDown;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property BorderStyle;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property Count;
|
||||
property DragCursor;
|
||||
property DragKind;
|
||||
property DragMode;
|
||||
property DropDownCount;
|
||||
property Enabled;
|
||||
property Font;
|
||||
property ItemHeight;
|
||||
property ItemIndex;
|
||||
property Items;
|
||||
property ItemWidth;
|
||||
property MaxLength;
|
||||
property OnChange;
|
||||
property OnChangeBounds;
|
||||
property OnClick;
|
||||
property OnCloseUp;
|
||||
property OnContextPopup;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnEndDrag;
|
||||
property OnDropDown;
|
||||
property OnEditingDone;
|
||||
property OnEnter;
|
||||
property OnExit;
|
||||
property OnGetItems;
|
||||
property OnItemChange;
|
||||
property OnKeyDown;
|
||||
property OnKeyPress;
|
||||
property OnKeyUp;
|
||||
property OnMouseDown;
|
||||
property OnMouseEnter;
|
||||
property OnMouseLeave;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnMouseWheel;
|
||||
property OnMouseWheelDown;
|
||||
property OnMouseWheelUp;
|
||||
property OnStartDrag;
|
||||
property OnSelect;
|
||||
property OnUTF8KeyPress;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ShowHint;
|
||||
property Sorted;
|
||||
property TabOrder;
|
||||
property TabStop;
|
||||
property Text;
|
||||
property TextHint;
|
||||
property Visible;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{ TCustomCheckCombo }
|
||||
|
||||
constructor TCustomCheckCombo.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
TStringList(Items).Duplicates:=dupIgnore;
|
||||
Style:=csOwnerDrawFixed;
|
||||
FNeedMeasure:=True;
|
||||
FRejectToggleOnSelect:=True;
|
||||
end;
|
||||
|
||||
destructor TCustomCheckCombo.Destroy;
|
||||
begin
|
||||
ClearItemStates;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.AddItem(const AItem: string; AState: TCheckBoxState; AEnabled: Boolean);
|
||||
var pItemState: TCheckComboItemState;
|
||||
begin
|
||||
pItemState:=TCheckComboItemState.Create;
|
||||
pItemState.State:=aState;
|
||||
pItemState.Enabled:=AEnabled;
|
||||
pItemState.Data:=nil;
|
||||
inherited AddItem(AItem, pItemState);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.AssignItems(AItems: TStrings);
|
||||
begin
|
||||
ClearItemStates;
|
||||
Items.Assign(AItems);
|
||||
InitItemStates;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.CheckAll(AState: TCheckBoxState; AAllowGrayed: Boolean;
|
||||
AAllowDisabled: Boolean);
|
||||
var i: Integer;
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
begin
|
||||
if (AAllowGrayed or (State[i]<>cbGrayed)) and (AAllowDisabled or ItemEnabled[i])
|
||||
then State[i]:=AState;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.Clear;
|
||||
begin
|
||||
ClearItemStates;
|
||||
inherited Clear;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.ClearItemStates;
|
||||
var i: Integer;
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
begin
|
||||
Items.Objects[i].Free;
|
||||
Items.Objects[i]:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.CloseUp;
|
||||
begin
|
||||
FDropped:=False;
|
||||
if FRejectDropDown then
|
||||
begin
|
||||
FRejectDropDown:=False;
|
||||
Update;
|
||||
end else
|
||||
inherited CloseUp;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.CMBiDiModeChanged(var Message: TLMessage);
|
||||
begin
|
||||
inherited CMBiDiModeChanged(Message);
|
||||
FRightToLeft:=IsRightToLeft;
|
||||
FNeedMeasure:=True;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.DeleteItem(AIndex: Integer);
|
||||
begin
|
||||
if (AIndex>=0) and (AIndex<Items.Count) then
|
||||
begin
|
||||
Items.Objects[AIndex].Free;
|
||||
Items.Delete(AIndex);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
||||
{ Enabled, State, Highlighted }
|
||||
const caCheckThemes: array [Boolean, TCheckBoxState, Boolean] of TThemedButton =
|
||||
{ normal, highlighted }
|
||||
(((tbCheckBoxUncheckedDisabled, tbCheckBoxUncheckedDisabled), { disabled, unchecked }
|
||||
(tbCheckBoxCheckedDisabled, tbCheckBoxCheckedDisabled), { disabled, checked }
|
||||
(tbCheckBoxMixedDisabled, tbCheckBoxMixedDisabled)), { disabled, greyed }
|
||||
((tbCheckBoxUncheckedNormal, tbCheckBoxUncheckedHot), { enabled, unchecked }
|
||||
(tbCheckBoxCheckedNormal, tbCheckBoxCheckedHot), { enabled, checked }
|
||||
(tbCheckBoxMixedNormal, tbCheckBoxMixedHot))); { enabled, greyed }
|
||||
cCheckIndent: SmallInt = 2;
|
||||
cTextIndent: SmallInt = 5;
|
||||
var aDetail: TThemedElementDetails;
|
||||
aDropped: Boolean;
|
||||
aEnabled: Boolean;
|
||||
aFlags: Cardinal;
|
||||
aFocusedEditableMainItemNoDD: Boolean; { combo has edit-like line edit in csDropDownList (Win) and is closed (not DroppedDown }
|
||||
aGray: Byte;
|
||||
anyRect: TRect;
|
||||
aState: TCheckBoxState;
|
||||
ItemState: TCheckComboItemState;
|
||||
begin { do not call inherited ! }
|
||||
ItemState:=TCheckComboItemState(Items.Objects[Index]);
|
||||
if not (ItemState is TCheckComboItemState) then
|
||||
QueueCheckItemStates;
|
||||
aDropped:=DroppedDown;
|
||||
if aDropped and FRejectDropDown then
|
||||
begin
|
||||
DroppedDown:=False;
|
||||
exit; { Exit! }
|
||||
end;
|
||||
aEnabled:=IsEnabled;
|
||||
if not (csDesigning in ComponentState) then
|
||||
aEnabled:= (aEnabled and ItemState.Enabled);
|
||||
{$IF DEFINED(LCLWin32) or DEFINED(LCLWin64)}
|
||||
aFocusedEditableMainItemNoDD := (Focused and (ARect.Left>0) and not aDropped);
|
||||
{$ELSE}
|
||||
aFocusedEditableMainItemNoDD := False;
|
||||
{$ENDIF}
|
||||
if (ARect.Left=0) or aFocusedEditableMainItemNoDD then
|
||||
begin
|
||||
if odSelected in State then
|
||||
begin
|
||||
if not aEnabled then
|
||||
begin
|
||||
aGray:=ColorToGray(Canvas.Brush.Color);
|
||||
Canvas.Brush.Color:=RGBToColor(aGray, aGray, aGray);
|
||||
end;
|
||||
end else
|
||||
Canvas.Brush.Color:=clWindow;
|
||||
Canvas.Brush.Style:=bsSolid;
|
||||
Canvas.FillRect(ARect);
|
||||
end;
|
||||
if not (csDesigning in ComponentState)
|
||||
then aState:=ItemState.State
|
||||
else aState:=cbUnchecked;
|
||||
aDetail:=ThemeServices.GetElementDetails(caCheckThemes
|
||||
[aEnabled, aState, not aDropped and FCheckHighlight]);
|
||||
if FNeedMeasure then
|
||||
begin
|
||||
FCheckSize:=ThemeServices.GetDetailSize(aDetail);
|
||||
FTextHeight:=Canvas.TextHeight('ŠjÁÇ');
|
||||
if not aDropped then
|
||||
begin
|
||||
if not FRightToLeft then
|
||||
begin
|
||||
FHiLiteLeft:=-1;
|
||||
FHiLiteRight:=ARect.Right;
|
||||
end else
|
||||
begin
|
||||
FHiLiteLeft:=ARect.Left;
|
||||
FHiLiteRight:=ARect.Right;
|
||||
end;
|
||||
FNeedMeasure := False;
|
||||
end;
|
||||
end;
|
||||
if not FRightToLeft
|
||||
then anyRect.Left:=ARect.Left+cCheckIndent
|
||||
else anyRect.Left:=ARect.Right-cCheckIndent-FCheckSize.cx;
|
||||
anyRect.Right:=anyRect.Left+FCheckSize.cx;
|
||||
anyRect.Top:=(ARect.Bottom+ARect.Top-FCheckSize.cy) div 2;
|
||||
anyRect.Bottom:=anyRect.Top+FCheckSize.cy;
|
||||
ThemeServices.DrawElement(Canvas.Handle, aDetail, anyRect);
|
||||
Canvas.Brush.Style:=bsClear;
|
||||
if (not (odSelected in State) or not aDropped) and not aFocusedEditableMainItemNoDD
|
||||
then Canvas.Font.Color:=clWindowText
|
||||
else begin
|
||||
Canvas.Font.Color:=clHighlightText;
|
||||
FHilightedIndex:=Index;
|
||||
end;
|
||||
if aFocusedEditableMainItemNoDD then
|
||||
begin
|
||||
LCLIntf.SetBkColor(Canvas.Handle, ColorToRGB(clBtnFace));
|
||||
LCLIntf.DrawFocusRect(Canvas.Handle, aRect);
|
||||
end;
|
||||
aFlags:=DT_END_ELLIPSIS+DT_VCENTER+DT_SINGLELINE+DT_NOPREFIX;
|
||||
if not FRightToLeft then
|
||||
begin
|
||||
anyRect.Left:=ARect.Left+cCheckIndent+FCheckSize.cx+cTextIndent;
|
||||
anyRect.Right:=ARect.Right;
|
||||
end else
|
||||
begin
|
||||
anyRect.Right:=anyRect.Left-cTextIndent;
|
||||
anyRect.Left:=ARect.Left;
|
||||
aFlags:=aFlags or DT_RIGHT or DT_RTLREADING;
|
||||
end;
|
||||
anyRect.Top:=(ARect.Top+ARect.Bottom-FTextHeight) div 2;
|
||||
anyRect.Bottom:=anyRect.Top+FTextHeight;
|
||||
DrawText(Canvas.Handle, PChar(Items[Index]), Length(Items[Index]), anyRect, aFlags);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.DropDown;
|
||||
{$IF DEFINED(LCLWin32) or DEFINED(LCLWin64)}
|
||||
{$ELSE}
|
||||
var aCursorPos: TPoint;
|
||||
aRect: TRect;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IF DEFINED(LCLWin32) or DEFINED(LCLWin64)}
|
||||
FRejectDropDown:=False;
|
||||
{$ELSE}
|
||||
aCursorPos:=ScreenToControl(Mouse.CursorPos);
|
||||
aRect:=Rect(FHiLiteLeft, 0, FHiLiteRight, Height);
|
||||
FRejectDropDown:=PtInRect(aRect, aCursorPos);
|
||||
{$ENDIF}
|
||||
FDropped:=True;
|
||||
if not FRejectDropDown then
|
||||
begin
|
||||
inherited DropDown;
|
||||
FRejectToggleOnSelect:=False;
|
||||
end else
|
||||
if (ItemIndex>=0) and ItemEnabled[ItemIndex] then Toggle(ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.FontChanged(Sender: TObject);
|
||||
begin
|
||||
FNeedMeasure:=True;
|
||||
inherited FontChanged(Sender);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.InitializeWnd;
|
||||
begin
|
||||
InitItemStates;
|
||||
inherited InitializeWnd;
|
||||
CheckItemStates;
|
||||
FRightToLeft:=IsRightToLeft;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.InitItemStates;
|
||||
var i: Integer;
|
||||
pItemState: TCheckComboItemState;
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
if Items.Objects[i]=nil then begin
|
||||
pItemState:=TCheckComboItemState.Create;
|
||||
pItemState.Enabled:=True;
|
||||
pItemState.State:=cbUnchecked;
|
||||
pItemState.Data:=nil;
|
||||
Items.Objects[i]:=pItemState;
|
||||
end else if not (Items.Objects[i] is TCheckComboItemState) then
|
||||
raise Exception.Create(DbgSName(Self)+': Item '+IntToStr(i)+' is not a TCheckComboItemState');
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.CheckItemStates;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
if not (Items.Objects[i] is TCheckComboItemState) then
|
||||
raise Exception.Create(DbgSName(Self)+': Item '+IntToStr(i)+' is not a TCheckComboItemState');
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.QueueCheckItemStates;
|
||||
begin
|
||||
Application.QueueAsyncCall(@AsyncCheckItemStates,0);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.KeyDown(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
case Key of
|
||||
VK_RETURN:
|
||||
if FDropped then
|
||||
if (ItemIndex=FHilightedIndex) and ItemEnabled[ItemIndex] then Toggle(ItemIndex);
|
||||
VK_SPACE:
|
||||
if DroppedDown then
|
||||
if (ItemIndex>=0) and ItemEnabled[ItemIndex] then
|
||||
begin
|
||||
if ItemIndex<>FHilightedIndex then
|
||||
begin
|
||||
ItemIndex:=FHilightedIndex;
|
||||
inherited Select;
|
||||
end;
|
||||
Toggle(ItemIndex);
|
||||
DroppedDown:=False;
|
||||
end;
|
||||
end;
|
||||
inherited KeyDown(Key, Shift);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
InitItemStates;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.MouseLeave;
|
||||
begin
|
||||
FCheckHighlight:=False;
|
||||
inherited MouseLeave;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||
var aHighlight: Boolean;
|
||||
begin
|
||||
inherited MouseMove(Shift, X, Y);
|
||||
aHighlight:=((X>FHiLiteLeft) and (X<FHiLiteRight));
|
||||
if aHighlight<>FCheckHighlight then
|
||||
begin
|
||||
FCheckHighlight:=aHighlight;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.Select;
|
||||
begin
|
||||
inherited Select;
|
||||
{$IF DEFINED(LCLWin32) or DEFINED(LCLWin64)}
|
||||
if DroppedDown then FRejectToggleOnSelect:=True;
|
||||
{$ENDIF}
|
||||
if not FRejectToggleOnSelect then
|
||||
begin
|
||||
if (ItemIndex >= 0) and ItemEnabled[ItemIndex] then Toggle(ItemIndex);
|
||||
FRejectToggleOnSelect:=True;
|
||||
end;
|
||||
FDropped:=False;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetItemHeight(const AValue: Integer);
|
||||
begin
|
||||
inherited SetItemHeight(AValue);
|
||||
FNeedMeasure:=True;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetItems(const Value: TStrings);
|
||||
begin
|
||||
ClearItemStates;
|
||||
inherited SetItems(Value);
|
||||
InitItemStates;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.Toggle(AIndex: Integer);
|
||||
const caNewStateMap: array [TCheckBoxState, Boolean] of TCheckBoxState =
|
||||
{ False (AllowGrayed) True }
|
||||
((cbChecked, cbGrayed), { cbUnchecked }
|
||||
(cbUnChecked, cbUnChecked), { cbChecked }
|
||||
(cbChecked, cbChecked)); { cbGrayed }
|
||||
begin
|
||||
State[AIndex]:=caNewStateMap[State[AIndex], AllowGrayed];
|
||||
end;
|
||||
|
||||
{ TCustomCheckCombo.Getters and Setters }
|
||||
|
||||
function TCustomCheckCombo.GetChecked(AIndex: Integer): Boolean;
|
||||
begin
|
||||
Result:=(TCheckComboItemState(Items.Objects[AIndex]).State=cbChecked);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.AsyncCheckItemStates(Data: PtrInt);
|
||||
begin
|
||||
CheckItemStates;
|
||||
end;
|
||||
|
||||
function TCustomCheckCombo.GetCount: Integer;
|
||||
begin
|
||||
Result:=Items.Count;
|
||||
end;
|
||||
|
||||
function TCustomCheckCombo.GetItemEnabled(AIndex: Integer): Boolean;
|
||||
begin
|
||||
Result:=TCheckComboItemState(Items.Objects[AIndex]).Enabled;
|
||||
end;
|
||||
|
||||
function TCustomCheckCombo.GetObject(AIndex: Integer): TObject;
|
||||
begin
|
||||
Result:=TCheckComboItemState(Items.Objects[AIndex]).Data;
|
||||
end;
|
||||
|
||||
function TCustomCheckCombo.GetState(AIndex: Integer): TCheckBoxState;
|
||||
begin
|
||||
Result:=TCheckComboItemState(Items.Objects[AIndex]).State;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetChecked(AIndex: Integer; AValue: Boolean);
|
||||
begin
|
||||
if AValue=(TCheckComboItemState(Items.Objects[AIndex]).State=cbChecked) then exit;
|
||||
if AValue
|
||||
then TCheckComboItemState(Items.Objects[AIndex]).State:=cbChecked
|
||||
else TCheckComboItemState(Items.Objects[AIndex]).State:=cbUnchecked;
|
||||
if Assigned(FOnItemChange) then
|
||||
FOnItemChange(Self, AIndex);
|
||||
if AIndex=ItemIndex then
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetItemEnabled(AIndex: Integer; AValue: Boolean);
|
||||
begin
|
||||
if TCheckComboItemState(Items.Objects[AIndex]).Enabled=AValue then exit;
|
||||
TCheckComboItemState(Items.Objects[AIndex]).Enabled:=AValue;
|
||||
if AIndex=ItemIndex then
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetObject(AIndex: Integer; AValue: TObject);
|
||||
begin
|
||||
TCheckComboItemState(Items.Objects[AIndex]).Data:=AValue;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetState(AIndex: Integer; AValue: TCheckBoxState);
|
||||
begin
|
||||
if TCheckComboItemState(Items.Objects[AIndex]).State=AValue then exit;
|
||||
TCheckComboItemState(Items.Objects[AIndex]).State:=AValue;
|
||||
if Assigned(FOnItemChange) then
|
||||
FOnItemChange(self, AIndex);
|
||||
if AIndex=ItemIndex then
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, ExtendedTabControls, ComponentEditors, ObjInspStrConsts, PropEdits,
|
||||
ComCtrls, CheckBoxThemed, DividerBevel, ExtendedNotebook, ListFilterEdit,
|
||||
ComCtrls, CheckBoxThemed, CheckCombo, DividerBevel, ExtendedNotebook, ListFilterEdit,
|
||||
ListViewFilterEdit, LvlGraphCtrl, ShortPathEdit, SpinEx, TreeFilterEdit;
|
||||
|
||||
type
|
||||
@ -33,7 +33,7 @@ begin
|
||||
RegisterComponents('LazControls', [TCheckBoxThemed,
|
||||
TDividerBevel, TExtendedNotebook, TListFilterEdit, TListViewFilterEdit,
|
||||
TLvlGraphControl, TShortPathEdit, TSpinEditEx, TFloatSpinEditEx,
|
||||
TTreeFilterEdit, TExtendedTabControl]);
|
||||
TTreeFilterEdit, TExtendedTabControl, TCheckComboBox]);
|
||||
//RegisterPropertyEditor(TypeInfo(TCaption), TCheckBoxThemed, 'Caption', TStringMultilinePropertyEditor);
|
||||
RegisterNoIcon([TExtendedTabToolbar, TExtendedTabToolButton, TExtendedTabSheet]);
|
||||
RegisterComponentEditor(TExtendedTabControl, TExtendedTabControlComponentEditor);
|
||||
|
@ -1,6 +1,9 @@
|
||||
tcheckboxthemed.png
|
||||
tcheckboxthemed_150.png
|
||||
tcheckboxthemed_200.png
|
||||
tcheckcombobox.png
|
||||
tcheckcombobox_150.png
|
||||
tcheckcombobox_200.png
|
||||
tdividerbevel.png
|
||||
tdividerbevel_150.png
|
||||
tdividerbevel_200.png
|
||||
|
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 342 B |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 379 B |
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 454 B |
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Package Version="4">
|
||||
<Package Version="5">
|
||||
<PathDelim Value="\"/>
|
||||
<Name Value="LazControls"/>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
@ -19,7 +19,7 @@
|
||||
<Description Value="Some extra LCL controls needed by the IDE."/>
|
||||
<License Value="modified LGPL-2"/>
|
||||
<Version Major="1" Release="1"/>
|
||||
<Files Count="12">
|
||||
<Files Count="13">
|
||||
<Item1>
|
||||
<Filename Value="checkboxthemed.pas"/>
|
||||
<UnitName Value="CheckBoxThemed"/>
|
||||
@ -68,7 +68,12 @@
|
||||
<Filename Value="smallorderedseteditor.pas"/>
|
||||
<UnitName Value="SmallOrderedSetEditor"/>
|
||||
</Item12>
|
||||
<Item13>
|
||||
<Filename Value="checkcombo.pas"/>
|
||||
<UnitName Value="CheckCombo"/>
|
||||
</Item13>
|
||||
</Files>
|
||||
<CompatibilityMode Value="True"/>
|
||||
<LazDoc Paths="docs"/>
|
||||
<RequiredPkgs Count="1">
|
||||
<Item1>
|
||||
@ -80,7 +85,6 @@
|
||||
</UsageOptions>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
</PublishOptions>
|
||||
<CustomOptions Items="ExternHelp" Version="2">
|
||||
<_ExternHelp Items="Count"/>
|
||||
|
@ -10,7 +10,8 @@ interface
|
||||
uses
|
||||
CheckBoxThemed, DividerBevel, ExtendedNotebook, ListFilterEdit,
|
||||
ListViewFilterEdit, TreeFilterEdit, ShortPathEdit, LvlGraphCtrl,
|
||||
ExtendedTabControls, SpinEx, SmallOrderedSetEditor, LazarusPackageIntf;
|
||||
ExtendedTabControls, SpinEx, SmallOrderedSetEditor, CheckCombo,
|
||||
LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
Binary file not shown.
@ -84,12 +84,6 @@ msgstr "%s má cyklický symlink"
|
||||
msgid "insufficient memory"
|
||||
msgstr "nedostatek paměťi"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "Set znaků v masce \"%s\" není validní!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -201,3 +195,36 @@ msgstr "Není možné vytvořit konfigurační složku \"%s\""
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -84,12 +84,6 @@ msgstr ""
|
||||
msgid "insufficient memory"
|
||||
msgstr "zu wenig Speicher"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "Der Zeichensatz in Maske \"%s\" ist ungültig!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -201,3 +195,36 @@ msgstr "Kann Konfigurationsverzeichnis \"%s\" nicht anlegen"
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "Konvertierung von %s nach %s ist nicht möglich"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -83,12 +83,6 @@ msgstr "%s tiene un enlace simbólico circular"
|
||||
msgid "insufficient memory"
|
||||
msgstr "memoria insuficiente"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "El char set en máscara \"%s\" no es válido!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -200,3 +194,36 @@ msgstr "No se puede crear el directorio de configuración \"%s\""
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "Conversión de %s a %s no es posible"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -86,12 +86,6 @@ msgstr "%s a un lien symbolique circulaire"
|
||||
msgid "insufficient memory"
|
||||
msgstr "mémoire insuffisante"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "Le jeu de caractères placé dans le masque \"%s\" est incorrect !"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -203,3 +197,36 @@ msgstr "Impossible de créer le répertoire de configuration \"%s\""
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "Conversion de %s vers %s impossible"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -85,12 +85,6 @@ msgstr "A(z) %s körkörös szimbolikus hivatkozást tartalmaz"
|
||||
msgid "insufficient memory"
|
||||
msgstr "kevés a memória"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "A karakterkészlet a \"%s\" maszkban érvénytelen!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -202,3 +196,36 @@ msgstr "Nem lehet létrehozni a beállítások könyvtárát: \"%s\""
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "Az átalakítás nem lehetséges erről: %s, erre %s"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -84,12 +84,6 @@ msgstr "%s ha un link simbolico circolare"
|
||||
msgid "insufficient memory"
|
||||
msgstr "memoria insufficiente"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "Il charset nella maschera \"%s\" non è valido"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -201,3 +195,36 @@ msgstr "Impossibile creare la cartella di configurazione \"%s\""
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "Conversione da %s a %s impossibile"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -86,12 +86,6 @@ msgstr "%s turi uždarą simbolinį saitą"
|
||||
msgid "insufficient memory"
|
||||
msgstr "trūksta atminties"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "Klaidinga kaukės „%s“ koduotė!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -203,3 +197,36 @@ msgstr "Nepavyko sukurti aplanko „%s“ konfigūracijai"
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "„%s“ konvertuoti į „%s“ neįmanoma"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -86,12 +86,6 @@ msgstr "%s ma zapętlone dowązanie symboliczne"
|
||||
msgid "insufficient memory"
|
||||
msgstr "brak pamięci"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -201,3 +195,36 @@ msgstr ""
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "Konwersja z %s na %s jest niemożliwa"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -75,12 +75,6 @@ msgstr ""
|
||||
msgid "insufficient memory"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -192,3 +186,36 @@ msgstr ""
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -85,12 +85,6 @@ msgstr "%s tem uma referência circular em um vínculo simbólico"
|
||||
msgid "insufficient memory"
|
||||
msgstr "memória insuficiente"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "Conjunto de caracteres na máscara \"%s\" inválido!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -202,3 +196,36 @@ msgstr "Incapaz de criar diretório de configuração \"%s\""
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "Conversão impossível de %s para %s"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -85,12 +85,6 @@ msgstr "%s имеет циклическую символическую ссыл
|
||||
msgid "insufficient memory"
|
||||
msgstr "недостаточно памяти"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "Набор символов в маске \"%s\" некорректен!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -202,3 +196,36 @@ msgstr "Невозможно создать каталог настройки \"
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "Невозможно преобразовать %s в %s"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -86,12 +86,6 @@ msgstr "%s dairesel bir sembolik bağa sahip"
|
||||
msgid "insufficient memory"
|
||||
msgstr "yetersiz hafıza"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "\"%s\" maskesinde belirtilen karakter geçerli değil!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -203,3 +197,36 @@ msgstr "\"%s\" yapılandırma dizini oluşturulamıyor"
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "%s den %s ye dönüşüm mümkün değil"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -86,12 +86,6 @@ msgstr "%s має циклічне символьне посилання"
|
||||
msgid "insufficient memory"
|
||||
msgstr "нестача пам'яті"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "Невірний набір символів по масці \"%s\"!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -203,3 +197,36 @@ msgstr "Не вдалось створити теку конфігурації \
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "Перетворення з %s до %s неможливе"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
@ -86,12 +86,6 @@ msgstr "%s有一个循环符号链接(circular)"
|
||||
msgid "insufficient memory"
|
||||
msgstr "内存不足"
|
||||
|
||||
#: lazutilsstrconsts.lrsinvalidcharset
|
||||
#, object-pascal-format
|
||||
msgctxt "lazutilsstrconsts.lrsinvalidcharset"
|
||||
msgid "The char set in mask \"%s\" is not valid!"
|
||||
msgstr "字符集在掩码/扩展名\"%s\"不是有效的!"
|
||||
|
||||
#: lazutilsstrconsts.lrsisnotasymboliclink
|
||||
#, object-pascal-format
|
||||
msgid "%s is not a symbolic link"
|
||||
@ -203,3 +197,36 @@ msgstr "不能创建配置目录\"%s\""
|
||||
msgid "Conversion from %s to %s not possible"
|
||||
msgstr "不能从%s到%s转换"
|
||||
|
||||
#: lazutilsstrconsts.rsincompletemask
|
||||
msgid "Reached end of mask, but missing close/escape sequence."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinternalerror
|
||||
#, object-pascal-format
|
||||
msgid "Internal %s error."
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmask
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidcharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Invalid char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsinvalidescapechar
|
||||
msgid "Escape character must be ASCII <= 127"
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmask
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#: lazutilsstrconsts.rsmissingclosecharmaskat
|
||||
#, object-pascal-format
|
||||
msgid "Missing close char mask \"%s\" at %d"
|
||||
msgstr ""
|
||||
|
||||
|
Binary file not shown.
@ -43,9 +43,6 @@ components/tcalendardialog_200.png
|
||||
components/tcheckbox.png
|
||||
components/tcheckbox_150.png
|
||||
components/tcheckbox_200.png
|
||||
components/tcheckcombobox.png
|
||||
components/tcheckcombobox_150.png
|
||||
components/tcheckcombobox_200.png
|
||||
components/tcheckgroup.png
|
||||
components/tcheckgroup_150.png
|
||||
components/tcheckgroup_200.png
|
||||
|
142
lcl/comboex.pas
142
lcl/comboex.pas
@ -49,7 +49,6 @@ type
|
||||
TListItemsCompare = function (AList: TListControlItems; AItem1, AItem2: Integer): Integer;
|
||||
TListItemsSortType = TSortType;
|
||||
{ Events }
|
||||
TCheckItemChange = procedure(Sender: TObject; AIndex: Integer) of object;
|
||||
TListControlItem = class; { forward }
|
||||
TListCompareEvent = function(AList: TListControlItems; AItem1, AItem2: TListControlItem): Integer of object;
|
||||
|
||||
@ -258,145 +257,6 @@ type
|
||||
property Visible;
|
||||
end;
|
||||
|
||||
{ TCheckComboItemState }
|
||||
TCheckComboItemState = class
|
||||
public
|
||||
State: TCheckBoxState;
|
||||
Enabled: Boolean;
|
||||
Data: TObject;
|
||||
end;
|
||||
|
||||
{ TCustomCheckCombo }
|
||||
TCustomCheckCombo = class(TCustomComboBox)
|
||||
private
|
||||
FAllowGrayed: Boolean;
|
||||
FOnItemChange: TCheckItemChange;
|
||||
procedure AsyncCheckItemStates(Data: PtrInt);
|
||||
function GetChecked(AIndex: Integer): Boolean;
|
||||
function GetCount: Integer;
|
||||
function GetItemEnabled(AIndex: Integer): Boolean;
|
||||
function GetObject(AIndex: Integer): TObject;
|
||||
function GetState(AIndex: Integer): TCheckBoxState;
|
||||
procedure SetChecked(AIndex: Integer; AValue: Boolean);
|
||||
procedure SetItemEnabled(AIndex: Integer; AValue: Boolean);
|
||||
procedure SetObject(AIndex: Integer; AValue: TObject);
|
||||
procedure SetState(AIndex: Integer; AValue: TCheckBoxState);
|
||||
protected
|
||||
FCheckHighlight: Boolean;
|
||||
FCheckSize: TSize;
|
||||
FDropped: Boolean;
|
||||
FHilightedIndex: Integer;
|
||||
FHiLiteLeft: Integer;
|
||||
FHiLiteRight: Integer;
|
||||
FNeedMeasure: Boolean;
|
||||
FRejectDropDown: Boolean;
|
||||
FRejectToggleOnSelect: Boolean;
|
||||
FRightToLeft: Boolean;
|
||||
FTextHeight: SmallInt;
|
||||
procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
|
||||
procedure ClearItemStates;
|
||||
procedure CloseUp; override;
|
||||
procedure DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState); override;
|
||||
procedure DropDown; override;
|
||||
procedure FontChanged(Sender: TObject); override;
|
||||
procedure InitializeWnd; override;
|
||||
procedure InitItemStates;
|
||||
procedure CheckItemStates;
|
||||
procedure QueueCheckItemStates;
|
||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||
procedure Loaded; override;
|
||||
procedure MouseLeave; override;
|
||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
||||
procedure SetItemHeight(const AValue: Integer); override;
|
||||
procedure SetItems(const Value: TStrings); override;
|
||||
procedure Select; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure AddItem(const AItem: string; AState: TCheckBoxState; AEnabled: Boolean = True); reintroduce;
|
||||
procedure AssignItems(AItems: TStrings);
|
||||
procedure Clear; override;
|
||||
procedure DeleteItem(AIndex: Integer);
|
||||
procedure CheckAll(AState: TCheckBoxState; AAllowGrayed: Boolean = True; AAllowDisabled: Boolean = True);
|
||||
procedure Toggle(AIndex: Integer);
|
||||
property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed default False;
|
||||
property Count: Integer read GetCount;
|
||||
property Checked[AIndex: Integer]: Boolean read GetChecked write SetChecked;
|
||||
property ItemEnabled[AIndex: Integer]: Boolean read GetItemEnabled write SetItemEnabled;
|
||||
property Objects[AIndex: Integer]: TObject read GetObject write SetObject;
|
||||
property State[AIndex: Integer]: TCheckBoxState read GetState write SetState;
|
||||
property OnItemChange: TCheckItemChange read FOnItemChange write FOnItemChange;
|
||||
end;
|
||||
|
||||
{ TCheckComboBox }
|
||||
TCheckComboBox = class(TCustomCheckCombo)
|
||||
published
|
||||
property Align;
|
||||
property AllowGrayed;
|
||||
property Anchors;
|
||||
property ArrowKeysTraverseList;
|
||||
property AutoDropDown;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property BorderStyle;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property Count;
|
||||
property DragCursor;
|
||||
property DragKind;
|
||||
property DragMode;
|
||||
property DropDownCount;
|
||||
property Enabled;
|
||||
property Font;
|
||||
property ItemHeight;
|
||||
property ItemIndex;
|
||||
property Items;
|
||||
property ItemWidth;
|
||||
property MaxLength;
|
||||
property OnChange;
|
||||
property OnChangeBounds;
|
||||
property OnClick;
|
||||
property OnCloseUp;
|
||||
property OnContextPopup;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnEndDrag;
|
||||
property OnDropDown;
|
||||
property OnEditingDone;
|
||||
property OnEnter;
|
||||
property OnExit;
|
||||
property OnGetItems;
|
||||
property OnItemChange;
|
||||
property OnKeyDown;
|
||||
property OnKeyPress;
|
||||
property OnKeyUp;
|
||||
property OnMouseDown;
|
||||
property OnMouseEnter;
|
||||
property OnMouseLeave;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnMouseWheel;
|
||||
property OnMouseWheelDown;
|
||||
property OnMouseWheelUp;
|
||||
property OnStartDrag;
|
||||
property OnSelect;
|
||||
property OnUTF8KeyPress;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ShowHint;
|
||||
property Sorted;
|
||||
property TabOrder;
|
||||
property TabStop;
|
||||
property Text;
|
||||
property TextHint;
|
||||
property Visible;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
@ -405,7 +265,7 @@ implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Misc', [TComboBoxEx, TCheckComboBox]);
|
||||
RegisterComponents('Misc', [TComboBoxEx]);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -485,420 +485,4 @@ begin
|
||||
FStyleEx:=AValue;
|
||||
end;
|
||||
|
||||
{ TCustomCheckCombo }
|
||||
|
||||
constructor TCustomCheckCombo.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
TStringList(Items).Duplicates:=dupIgnore;
|
||||
Style:=csOwnerDrawFixed;
|
||||
FNeedMeasure:=True;
|
||||
FRejectToggleOnSelect:=True;
|
||||
end;
|
||||
|
||||
destructor TCustomCheckCombo.Destroy;
|
||||
begin
|
||||
ClearItemStates;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.AddItem(const AItem: string; AState: TCheckBoxState; AEnabled: Boolean);
|
||||
var pItemState: TCheckComboItemState;
|
||||
begin
|
||||
pItemState:=TCheckComboItemState.Create;
|
||||
pItemState.State:=aState;
|
||||
pItemState.Enabled:=AEnabled;
|
||||
pItemState.Data:=nil;
|
||||
inherited AddItem(AItem, pItemState);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.AssignItems(AItems: TStrings);
|
||||
begin
|
||||
ClearItemStates;
|
||||
Items.Assign(AItems);
|
||||
InitItemStates;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.CheckAll(AState: TCheckBoxState; AAllowGrayed: Boolean;
|
||||
AAllowDisabled: Boolean);
|
||||
var i: Integer;
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
begin
|
||||
if (AAllowGrayed or (State[i]<>cbGrayed)) and (AAllowDisabled or ItemEnabled[i])
|
||||
then State[i]:=AState;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.Clear;
|
||||
begin
|
||||
ClearItemStates;
|
||||
inherited Clear;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.ClearItemStates;
|
||||
var i: Integer;
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
begin
|
||||
Items.Objects[i].Free;
|
||||
Items.Objects[i]:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.CloseUp;
|
||||
begin
|
||||
FDropped:=False;
|
||||
if FRejectDropDown then
|
||||
begin
|
||||
FRejectDropDown:=False;
|
||||
Update;
|
||||
end else
|
||||
inherited CloseUp;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.CMBiDiModeChanged(var Message: TLMessage);
|
||||
begin
|
||||
inherited CMBiDiModeChanged(Message);
|
||||
FRightToLeft:=IsRightToLeft;
|
||||
FNeedMeasure:=True;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.DeleteItem(AIndex: Integer);
|
||||
begin
|
||||
if (AIndex>=0) and (AIndex<Items.Count) then
|
||||
begin
|
||||
Items.Objects[AIndex].Free;
|
||||
Items.Delete(AIndex);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
||||
{ Enabled, State, Highlighted }
|
||||
const caCheckThemes: array [Boolean, TCheckBoxState, Boolean] of TThemedButton =
|
||||
{ normal, highlighted }
|
||||
(((tbCheckBoxUncheckedDisabled, tbCheckBoxUncheckedDisabled), { disabled, unchecked }
|
||||
(tbCheckBoxCheckedDisabled, tbCheckBoxCheckedDisabled), { disabled, checked }
|
||||
(tbCheckBoxMixedDisabled, tbCheckBoxMixedDisabled)), { disabled, greyed }
|
||||
((tbCheckBoxUncheckedNormal, tbCheckBoxUncheckedHot), { enabled, unchecked }
|
||||
(tbCheckBoxCheckedNormal, tbCheckBoxCheckedHot), { enabled, checked }
|
||||
(tbCheckBoxMixedNormal, tbCheckBoxMixedHot))); { enabled, greyed }
|
||||
cCheckIndent: SmallInt = 2;
|
||||
cTextIndent: SmallInt = 5;
|
||||
var aDetail: TThemedElementDetails;
|
||||
aDropped: Boolean;
|
||||
aEnabled: Boolean;
|
||||
aFlags: Cardinal;
|
||||
aFocusedEditableMainItemNoDD: Boolean; { combo has edit-like line edit in csDropDownList (Win) and is closed (not DroppedDown }
|
||||
aGray: Byte;
|
||||
anyRect: TRect;
|
||||
aState: TCheckBoxState;
|
||||
ItemState: TCheckComboItemState;
|
||||
begin { do not call inherited ! }
|
||||
ItemState:=TCheckComboItemState(Items.Objects[Index]);
|
||||
if not (ItemState is TCheckComboItemState) then
|
||||
QueueCheckItemStates;
|
||||
aDropped:=DroppedDown;
|
||||
if aDropped and FRejectDropDown then
|
||||
begin
|
||||
DroppedDown:=False;
|
||||
exit; { Exit! }
|
||||
end;
|
||||
aEnabled:=IsEnabled;
|
||||
if not (csDesigning in ComponentState) then
|
||||
aEnabled:= (aEnabled and ItemState.Enabled);
|
||||
{$IF DEFINED(LCLWin32) or DEFINED(LCLWin64)}
|
||||
aFocusedEditableMainItemNoDD := (Focused and (ARect.Left>0) and not aDropped);
|
||||
{$ELSE}
|
||||
aFocusedEditableMainItemNoDD := False;
|
||||
{$ENDIF}
|
||||
if (ARect.Left=0) or aFocusedEditableMainItemNoDD then
|
||||
begin
|
||||
if odSelected in State then
|
||||
begin
|
||||
if not aEnabled then
|
||||
begin
|
||||
aGray:=ColorToGray(Canvas.Brush.Color);
|
||||
Canvas.Brush.Color:=RGBToColor(aGray, aGray, aGray);
|
||||
end;
|
||||
end else
|
||||
Canvas.Brush.Color:=clWindow;
|
||||
Canvas.Brush.Style:=bsSolid;
|
||||
Canvas.FillRect(ARect);
|
||||
end;
|
||||
if not (csDesigning in ComponentState)
|
||||
then aState:=ItemState.State
|
||||
else aState:=cbUnchecked;
|
||||
aDetail:=ThemeServices.GetElementDetails(caCheckThemes
|
||||
[aEnabled, aState, not aDropped and FCheckHighlight]);
|
||||
if FNeedMeasure then
|
||||
begin
|
||||
FCheckSize:=ThemeServices.GetDetailSize(aDetail);
|
||||
FTextHeight:=Canvas.TextHeight('ŠjÁÇ');
|
||||
if not aDropped then
|
||||
begin
|
||||
if not FRightToLeft then
|
||||
begin
|
||||
FHiLiteLeft:=-1;
|
||||
FHiLiteRight:=ARect.Right;
|
||||
end else
|
||||
begin
|
||||
FHiLiteLeft:=ARect.Left;
|
||||
FHiLiteRight:=ARect.Right;
|
||||
end;
|
||||
FNeedMeasure := False;
|
||||
end;
|
||||
end;
|
||||
if not FRightToLeft
|
||||
then anyRect.Left:=ARect.Left+cCheckIndent
|
||||
else anyRect.Left:=ARect.Right-cCheckIndent-FCheckSize.cx;
|
||||
anyRect.Right:=anyRect.Left+FCheckSize.cx;
|
||||
anyRect.Top:=(ARect.Bottom+ARect.Top-FCheckSize.cy) div 2;
|
||||
anyRect.Bottom:=anyRect.Top+FCheckSize.cy;
|
||||
ThemeServices.DrawElement(Canvas.Handle, aDetail, anyRect);
|
||||
Canvas.Brush.Style:=bsClear;
|
||||
if (not (odSelected in State) or not aDropped) and not aFocusedEditableMainItemNoDD
|
||||
then Canvas.Font.Color:=clWindowText
|
||||
else begin
|
||||
Canvas.Font.Color:=clHighlightText;
|
||||
FHilightedIndex:=Index;
|
||||
end;
|
||||
if aFocusedEditableMainItemNoDD then
|
||||
begin
|
||||
LCLIntf.SetBkColor(Canvas.Handle, ColorToRGB(clBtnFace));
|
||||
LCLIntf.DrawFocusRect(Canvas.Handle, aRect);
|
||||
end;
|
||||
aFlags:=DT_END_ELLIPSIS+DT_VCENTER+DT_SINGLELINE+DT_NOPREFIX;
|
||||
if not FRightToLeft then
|
||||
begin
|
||||
anyRect.Left:=ARect.Left+cCheckIndent+FCheckSize.cx+cTextIndent;
|
||||
anyRect.Right:=ARect.Right;
|
||||
end else
|
||||
begin
|
||||
anyRect.Right:=anyRect.Left-cTextIndent;
|
||||
anyRect.Left:=ARect.Left;
|
||||
aFlags:=aFlags or DT_RIGHT or DT_RTLREADING;
|
||||
end;
|
||||
anyRect.Top:=(ARect.Top+ARect.Bottom-FTextHeight) div 2;
|
||||
anyRect.Bottom:=anyRect.Top+FTextHeight;
|
||||
DrawText(Canvas.Handle, PChar(Items[Index]), Length(Items[Index]), anyRect, aFlags);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.DropDown;
|
||||
{$IF DEFINED(LCLWin32) or DEFINED(LCLWin64)}
|
||||
{$ELSE}
|
||||
var aCursorPos: TPoint;
|
||||
aRect: TRect;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IF DEFINED(LCLWin32) or DEFINED(LCLWin64)}
|
||||
FRejectDropDown:=False;
|
||||
{$ELSE}
|
||||
aCursorPos:=ScreenToControl(Mouse.CursorPos);
|
||||
aRect:=Rect(FHiLiteLeft, 0, FHiLiteRight, Height);
|
||||
FRejectDropDown:=PtInRect(aRect, aCursorPos);
|
||||
{$ENDIF}
|
||||
FDropped:=True;
|
||||
if not FRejectDropDown then
|
||||
begin
|
||||
inherited DropDown;
|
||||
FRejectToggleOnSelect:=False;
|
||||
end else
|
||||
if (ItemIndex>=0) and ItemEnabled[ItemIndex] then Toggle(ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.FontChanged(Sender: TObject);
|
||||
begin
|
||||
FNeedMeasure:=True;
|
||||
inherited FontChanged(Sender);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.InitializeWnd;
|
||||
begin
|
||||
InitItemStates;
|
||||
inherited InitializeWnd;
|
||||
CheckItemStates;
|
||||
FRightToLeft:=IsRightToLeft;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.InitItemStates;
|
||||
var i: Integer;
|
||||
pItemState: TCheckComboItemState;
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
if Items.Objects[i]=nil then begin
|
||||
pItemState:=TCheckComboItemState.Create;
|
||||
pItemState.Enabled:=True;
|
||||
pItemState.State:=cbUnchecked;
|
||||
pItemState.Data:=nil;
|
||||
Items.Objects[i]:=pItemState;
|
||||
end else if not (Items.Objects[i] is TCheckComboItemState) then
|
||||
raise Exception.Create(DbgSName(Self)+': Item '+IntToStr(i)+' is not a TCheckComboItemState');
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.CheckItemStates;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to Items.Count-1 do
|
||||
if not (Items.Objects[i] is TCheckComboItemState) then
|
||||
raise Exception.Create(DbgSName(Self)+': Item '+IntToStr(i)+' is not a TCheckComboItemState');
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.QueueCheckItemStates;
|
||||
begin
|
||||
Application.QueueAsyncCall(@AsyncCheckItemStates,0);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.KeyDown(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
case Key of
|
||||
VK_RETURN:
|
||||
if FDropped then
|
||||
if (ItemIndex=FHilightedIndex) and ItemEnabled[ItemIndex] then Toggle(ItemIndex);
|
||||
VK_SPACE:
|
||||
if DroppedDown then
|
||||
if (ItemIndex>=0) and ItemEnabled[ItemIndex] then
|
||||
begin
|
||||
if ItemIndex<>FHilightedIndex then
|
||||
begin
|
||||
ItemIndex:=FHilightedIndex;
|
||||
inherited Select;
|
||||
end;
|
||||
Toggle(ItemIndex);
|
||||
DroppedDown:=False;
|
||||
end;
|
||||
end;
|
||||
inherited KeyDown(Key, Shift);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
InitItemStates;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.MouseLeave;
|
||||
begin
|
||||
FCheckHighlight:=False;
|
||||
inherited MouseLeave;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||
var aHighlight: Boolean;
|
||||
begin
|
||||
inherited MouseMove(Shift, X, Y);
|
||||
aHighlight:=((X>FHiLiteLeft) and (X<FHiLiteRight));
|
||||
if aHighlight<>FCheckHighlight then
|
||||
begin
|
||||
FCheckHighlight:=aHighlight;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.Select;
|
||||
begin
|
||||
inherited Select;
|
||||
{$IF DEFINED(LCLWin32) or DEFINED(LCLWin64)}
|
||||
if DroppedDown then FRejectToggleOnSelect:=True;
|
||||
{$ENDIF}
|
||||
if not FRejectToggleOnSelect then
|
||||
begin
|
||||
if (ItemIndex >= 0) and ItemEnabled[ItemIndex] then Toggle(ItemIndex);
|
||||
FRejectToggleOnSelect:=True;
|
||||
end;
|
||||
FDropped:=False;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetItemHeight(const AValue: Integer);
|
||||
begin
|
||||
inherited SetItemHeight(AValue);
|
||||
FNeedMeasure:=True;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetItems(const Value: TStrings);
|
||||
begin
|
||||
ClearItemStates;
|
||||
inherited SetItems(Value);
|
||||
InitItemStates;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.Toggle(AIndex: Integer);
|
||||
const caNewStateMap: array [TCheckBoxState, Boolean] of TCheckBoxState =
|
||||
{ False (AllowGrayed) True }
|
||||
((cbChecked, cbGrayed), { cbUnchecked }
|
||||
(cbUnChecked, cbUnChecked), { cbChecked }
|
||||
(cbChecked, cbChecked)); { cbGrayed }
|
||||
begin
|
||||
State[AIndex]:=caNewStateMap[State[AIndex], AllowGrayed];
|
||||
end;
|
||||
|
||||
{ TCustomCheckCombo.Getters and Setters }
|
||||
|
||||
function TCustomCheckCombo.GetChecked(AIndex: Integer): Boolean;
|
||||
begin
|
||||
Result:=(TCheckComboItemState(Items.Objects[AIndex]).State=cbChecked);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.AsyncCheckItemStates(Data: PtrInt);
|
||||
begin
|
||||
CheckItemStates;
|
||||
end;
|
||||
|
||||
function TCustomCheckCombo.GetCount: Integer;
|
||||
begin
|
||||
Result:=Items.Count;
|
||||
end;
|
||||
|
||||
function TCustomCheckCombo.GetItemEnabled(AIndex: Integer): Boolean;
|
||||
begin
|
||||
Result:=TCheckComboItemState(Items.Objects[AIndex]).Enabled;
|
||||
end;
|
||||
|
||||
function TCustomCheckCombo.GetObject(AIndex: Integer): TObject;
|
||||
begin
|
||||
Result:=TCheckComboItemState(Items.Objects[AIndex]).Data;
|
||||
end;
|
||||
|
||||
function TCustomCheckCombo.GetState(AIndex: Integer): TCheckBoxState;
|
||||
begin
|
||||
Result:=TCheckComboItemState(Items.Objects[AIndex]).State;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetChecked(AIndex: Integer; AValue: Boolean);
|
||||
begin
|
||||
if AValue=(TCheckComboItemState(Items.Objects[AIndex]).State=cbChecked) then exit;
|
||||
if AValue
|
||||
then TCheckComboItemState(Items.Objects[AIndex]).State:=cbChecked
|
||||
else TCheckComboItemState(Items.Objects[AIndex]).State:=cbUnchecked;
|
||||
if Assigned(FOnItemChange) then
|
||||
FOnItemChange(Self, AIndex);
|
||||
if AIndex=ItemIndex then
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetItemEnabled(AIndex: Integer; AValue: Boolean);
|
||||
begin
|
||||
if TCheckComboItemState(Items.Objects[AIndex]).Enabled=AValue then exit;
|
||||
TCheckComboItemState(Items.Objects[AIndex]).Enabled:=AValue;
|
||||
if AIndex=ItemIndex then
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetObject(AIndex: Integer; AValue: TObject);
|
||||
begin
|
||||
TCheckComboItemState(Items.Objects[AIndex]).Data:=AValue;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.SetState(AIndex: Integer; AValue: TCheckBoxState);
|
||||
begin
|
||||
if TCheckComboItemState(Items.Objects[AIndex]).State=AValue then exit;
|
||||
TCheckComboItemState(Items.Objects[AIndex]).State:=AValue;
|
||||
if Assigned(FOnItemChange) then
|
||||
FOnItemChange(self, AIndex);
|
||||
if AIndex=ItemIndex then
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user