mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-28 10:17:16 +01:00
removed TLabel fontchanged hook and added TCheckList.OnClickChecked event from Darek
git-svn-id: trunk@9403 -
This commit is contained in:
parent
294a82eb9a
commit
88a04ff101
@ -33,15 +33,20 @@ uses
|
|||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TCustomCheckListBox }
|
{ TCustomCheckListBox }
|
||||||
|
|
||||||
TCustomCheckListBox = class(TCustomListBox)
|
TCustomCheckListBox = class(TCustomListBox)
|
||||||
private
|
private
|
||||||
FItemDataOffset: Integer;
|
FItemDataOffset: Integer;
|
||||||
|
FOnClickChecked : tNotifyEvent;
|
||||||
function GetChecked(const AIndex: Integer): Boolean;
|
function GetChecked(const AIndex: Integer): Boolean;
|
||||||
function GetCount: integer;
|
function GetCount: integer;
|
||||||
procedure SetChecked(const AIndex: Integer; const AValue: Boolean);
|
procedure SetChecked(const AIndex: Integer; const AValue: Boolean);
|
||||||
procedure SendItemChecked(const AIndex: Integer; const AChecked: Boolean);
|
procedure SendItemChecked(const AIndex: Integer; const AChecked: Boolean);
|
||||||
|
procedure DoChange(var Msg); message LM_CHANGED;
|
||||||
|
procedure KeyPress(var Key: char); override;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); override;
|
procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); override;
|
||||||
procedure AssignCacheToItemData(const AIndex: Integer; const AData: Pointer); override;
|
procedure AssignCacheToItemData(const AIndex: Integer; const AData: Pointer); override;
|
||||||
@ -49,10 +54,12 @@ type
|
|||||||
procedure DefineProperties(Filer: TFiler); override;
|
procedure DefineProperties(Filer: TFiler); override;
|
||||||
procedure ReadData(Stream: TStream);
|
procedure ReadData(Stream: TStream);
|
||||||
procedure WriteData(Stream: TStream);
|
procedure WriteData(Stream: TStream);
|
||||||
|
procedure ClickChecked;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
property Checked[const AIndex: Integer]: Boolean read GetChecked write SetChecked;
|
property Checked[const AIndex: Integer]: Boolean read GetChecked write SetChecked;
|
||||||
property Count: integer read GetCount;
|
property Count: integer read GetCount;
|
||||||
|
property OnClickChecked:tNotifyEvent read FOnClickChecked write FOnClickChecked;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -132,6 +139,12 @@ begin
|
|||||||
FItemDataOffset := inherited GetCachedDataSize;
|
FItemDataOffset := inherited GetCachedDataSize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TCustomCheckListBox.DoChange(var Msg);
|
||||||
|
begin
|
||||||
|
clickChecked;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomCheckListBox.GetCachedDataSize: Integer;
|
function TCustomCheckListBox.GetCachedDataSize: Integer;
|
||||||
begin
|
begin
|
||||||
FItemDataOffset := inherited GetCachedDataSize;
|
FItemDataOffset := inherited GetCachedDataSize;
|
||||||
@ -153,6 +166,15 @@ begin
|
|||||||
Result := Items.Count;
|
Result := Items.Count;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCheckListBox.KeyPress(var Key: char);
|
||||||
|
begin
|
||||||
|
if Key = ' ' then begin
|
||||||
|
Checked[ItemIndex]:=not Checked[ItemIndex];
|
||||||
|
end;
|
||||||
|
inherited KeyPress(Key);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCustomCheckListBox.SendItemChecked(const AIndex: Integer;
|
procedure TCustomCheckListBox.SendItemChecked(const AIndex: Integer;
|
||||||
const AChecked: Boolean);
|
const AChecked: Boolean);
|
||||||
begin
|
begin
|
||||||
@ -170,6 +192,11 @@ begin
|
|||||||
else PCachedItemData(GetCachedData(AIndex) + FItemDataOffset)^ := AValue;
|
else PCachedItemData(GetCachedData(AIndex) + FItemDataOffset)^ := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCheckListBox.ClickChecked;
|
||||||
|
begin
|
||||||
|
if Assigned(fOnClickChecked) then FOnClickChecked(self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomCheckListBox.DefineProperties(Filer: TFiler);
|
procedure TCustomCheckListBox.DefineProperties(Filer: TFiler);
|
||||||
begin
|
begin
|
||||||
inherited DefineProperties(Filer);
|
inherited DefineProperties(Filer);
|
||||||
|
|||||||
@ -169,7 +169,6 @@ end;
|
|||||||
constructor TCustomLabel.Create(TheOwner: TComponent);
|
constructor TCustomLabel.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
Font.OnChange := @FontChange;
|
|
||||||
ControlStyle := [csSetCaption, csClickEvents, csDoubleClicks, csReplicatable];
|
ControlStyle := [csSetCaption, csClickEvents, csDoubleClicks, csReplicatable];
|
||||||
setInitialBounds(0,0,65,17);
|
setInitialBounds(0,0,65,17);
|
||||||
FShowAccelChar := True;
|
FShowAccelChar := True;
|
||||||
@ -408,12 +407,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TCustomLabel.FontChange(Sender : TObject);
|
|
||||||
begin
|
|
||||||
If Caption <> '' then
|
|
||||||
Invalidate;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCustomLabel.SetOptimalFill(const AValue: Boolean);
|
procedure TCustomLabel.SetOptimalFill(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if FOptimalFill=AValue then exit;
|
if FOptimalFill=AValue then exit;
|
||||||
|
|||||||
@ -2527,7 +2527,7 @@ begin
|
|||||||
|
|
||||||
if not HandleAllocated then Exit;
|
if not HandleAllocated then Exit;
|
||||||
|
|
||||||
//DebugLn('TWinControl.UpdateShowing A ',Name,':',ClassName,' FShowing=',FShowing,' bShow=',bShow);
|
//DebugLn('TWinControl.UpdateShowing A ',Name,':',ClassName,' FShowing=',dbgs(FShowing),' bShow=',dbgs(bShow));
|
||||||
if FShowing = bShow then Exit;
|
if FShowing = bShow then Exit;
|
||||||
|
|
||||||
FShowing := bShow;
|
FShowing := bShow;
|
||||||
@ -2896,7 +2896,7 @@ procedure TWinControl.PaintHandler(var TheMessage: TLMPaint);
|
|||||||
function ControlMustBeClipped(AControl: TControl): boolean;
|
function ControlMustBeClipped(AControl: TControl): boolean;
|
||||||
begin
|
begin
|
||||||
with AControl do
|
with AControl do
|
||||||
Result:=IsVisible and (csOpaque in ControlStyle);
|
Result:=(csOpaque in ControlStyle) and IsVisible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -5158,7 +5158,7 @@ begin
|
|||||||
Assert(False, Format('Trace:[TWinControl.InitializeWnd] %s', [ClassName]));
|
Assert(False, Format('Trace:[TWinControl.InitializeWnd] %s', [ClassName]));
|
||||||
// set all cached properties
|
// set all cached properties
|
||||||
|
|
||||||
//DebugLn('[TWinControl.InitializeWnd] ',Name,':',ClassName,':', FCaption,' ',Left,',',Top,',',Width,',',Height);
|
//DebugLn('[TWinControl.InitializeWnd] ',Name,':',ClassName,':', FCaption,' ',dbgs(Left),',',dbgs(Top),',',dbgs(Width),',',dbgs(Height));
|
||||||
|
|
||||||
//First set the WinControl property.
|
//First set the WinControl property.
|
||||||
//The win32 interface depends on it to determine where to send call backs.
|
//The win32 interface depends on it to determine where to send call backs.
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Gtk2, GLib2, GtkDef,
|
|||||||
// To get as little as posible circles,
|
// To get as little as posible circles,
|
||||||
// uncomment only when needed for registration
|
// uncomment only when needed for registration
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
CheckLst, Controls, LCLType, Classes,
|
CheckLst, Controls, LCLType, Classes, LMessages,
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
WSCheckLst, WSLCLClasses,
|
WSCheckLst, WSLCLClasses,
|
||||||
Gtk2WSStdCtrls;
|
Gtk2WSStdCtrls;
|
||||||
@ -64,14 +64,18 @@ uses GtkWSControls, GtkProc;
|
|||||||
|
|
||||||
{ TGtk2WSCheckListBox }
|
{ TGtk2WSCheckListBox }
|
||||||
|
|
||||||
procedure Gtk2WS_CheckListBoxToggle(cellrenderertoggle : PGtkCellRendererToggle; arg1 : PGChar;
|
procedure Gtk2WS_CheckListBoxToggle(cellrenderertoggle : PGtkCellRendererToggle;
|
||||||
WidgetInfo: PWidgetInfo); cdecl;
|
arg1 : PGChar; WidgetInfo: PWidgetInfo); cdecl;
|
||||||
var
|
var
|
||||||
aWidget : PGTKWidget;
|
aWidget : PGTKWidget;
|
||||||
aTreeModel : PGtkTreeModel;
|
aTreeModel : PGtkTreeModel;
|
||||||
aTreeIter : TGtkTreeIter;
|
aTreeIter : TGtkTreeIter;
|
||||||
value : pgValue;
|
value : pgValue;
|
||||||
|
Mess: TLMessage;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF EventTrace}
|
||||||
|
EventTrace('Gtk2WS_CheckListBoxToggle', WidgetInfo^.LCLObject);
|
||||||
|
{$ENDIF}
|
||||||
aWidget := WidgetInfo^.CoreWidget;
|
aWidget := WidgetInfo^.CoreWidget;
|
||||||
aTreeModel := gtk_tree_view_get_model (GTK_TREE_VIEW(aWidget));
|
aTreeModel := gtk_tree_view_get_model (GTK_TREE_VIEW(aWidget));
|
||||||
if (gtk_tree_model_get_iter_from_string (aTreeModel, @aTreeIter, arg1)) then begin
|
if (gtk_tree_model_get_iter_from_string (aTreeModel, @aTreeIter, arg1)) then begin
|
||||||
@ -85,10 +89,13 @@ begin
|
|||||||
g_value_unset(value);
|
g_value_unset(value);
|
||||||
g_free(value);
|
g_free(value);
|
||||||
end;
|
end;
|
||||||
|
Mess.Msg := LM_CHANGED;
|
||||||
|
Mess.Result := 0;
|
||||||
|
DeliverMessage(widgetInfo^.lclObject, Mess);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Gtk2WS_CheckListBoxRowActivate(treeview : PGtkTreeView; arg1 : PGtkTreePath;
|
procedure Gtk2WS_CheckListBoxRowActivate(treeview : PGtkTreeView;
|
||||||
arg2 : PGtkTreeViewColumn; WidgetInfo: PWidgetInfo); cdecl;
|
arg1 : PGtkTreePath; arg2 : PGtkTreeViewColumn; WidgetInfo: PWidgetInfo); cdecl;
|
||||||
var
|
var
|
||||||
aTreeModel : PGtkTreeModel;
|
aTreeModel : PGtkTreeModel;
|
||||||
aTreeIter : TGtkTreeIter;
|
aTreeIter : TGtkTreeIter;
|
||||||
|
|||||||
@ -248,7 +248,9 @@ procedure Gtk2WS_ListBoxChange(Selection: PGtkTreeSelection; WidgetInfo: PWidget
|
|||||||
var
|
var
|
||||||
Mess: TLMessage;
|
Mess: TLMessage;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF EventTrace}
|
||||||
EventTrace('Gtk2WS_ListBoxChange', WidgetInfo^.LCLObject);
|
EventTrace('Gtk2WS_ListBoxChange', WidgetInfo^.LCLObject);
|
||||||
|
{$ENDIF}
|
||||||
FillChar(Mess,SizeOf(Mess),0);
|
FillChar(Mess,SizeOf(Mess),0);
|
||||||
Mess.msg := LM_SelChange;
|
Mess.msg := LM_SelChange;
|
||||||
DeliverMessage(WidgetInfo^.LCLObject, Mess);
|
DeliverMessage(WidgetInfo^.LCLObject, Mess);
|
||||||
|
|||||||
@ -938,6 +938,7 @@ type
|
|||||||
property DragKind;
|
property DragKind;
|
||||||
property DragMode;
|
property DragMode;
|
||||||
property Enabled;
|
property Enabled;
|
||||||
|
property Font;
|
||||||
property Hint;
|
property Hint;
|
||||||
property OnChange;
|
property OnChange;
|
||||||
property OnChangeBounds;
|
property OnChangeBounds;
|
||||||
@ -1143,7 +1144,6 @@ type
|
|||||||
FShowAccelChar: Boolean;
|
FShowAccelChar: Boolean;
|
||||||
FWordWrap: Boolean;
|
FWordWrap: Boolean;
|
||||||
FLayout: TTextLayout;
|
FLayout: TTextLayout;
|
||||||
Procedure FontChange(Sender: TObject);
|
|
||||||
procedure SetOptimalFill(const AValue: Boolean);
|
procedure SetOptimalFill(const AValue: Boolean);
|
||||||
protected
|
protected
|
||||||
function CanTab: boolean; override;
|
function CanTab: boolean; override;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user