mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 03:00:24 +02:00
gtk2: implement color changing for TListView and TListBox (issue #0013914)
git-svn-id: trunk@20454 -
This commit is contained in:
parent
6938b6b821
commit
00b1b0bbb3
@ -143,6 +143,7 @@ type
|
|||||||
class function GetVisibleRowCount(const ALV: TCustomListView): Integer; override;
|
class function GetVisibleRowCount(const ALV: TCustomListView): Integer; override;
|
||||||
|
|
||||||
class procedure SetAllocBy(const ALV: TCustomListView; const AValue: Integer); override;
|
class procedure SetAllocBy(const ALV: TCustomListView; const AValue: Integer); override;
|
||||||
|
class procedure SetColor(const AWinControl: TWinControl); override;
|
||||||
class procedure SetDefaultItemHeight(const ALV: TCustomListView; const AValue: Integer); override;
|
class procedure SetDefaultItemHeight(const ALV: TCustomListView; const AValue: Integer); override;
|
||||||
class procedure SetHotTrackStyles(const ALV: TCustomListView; const AValue: TListHotTrackStyles); override;
|
class procedure SetHotTrackStyles(const ALV: TCustomListView; const AValue: TListHotTrackStyles); override;
|
||||||
class procedure SetHoverTime(const ALV: TCustomListView; const AValue: Integer); override;
|
class procedure SetHoverTime(const ALV: TCustomListView; const AValue: Integer); override;
|
||||||
|
@ -1306,6 +1306,20 @@ begin
|
|||||||
then Exit;
|
then Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TGtk2WSCustomListView.SetColor(const AWinControl: TWinControl);
|
||||||
|
var
|
||||||
|
AWidget: PGTKWidget;
|
||||||
|
begin
|
||||||
|
if not WSCheckHandleAllocated(AWinControl, 'SetColor') then
|
||||||
|
Exit;
|
||||||
|
AWidget := PGtkWidget(AWinControl.Handle);
|
||||||
|
AWidget := GetWidgetInfo(AWidget, True)^.CoreWidget;
|
||||||
|
Gtk2WidgetSet.SetWidgetColor(AWidget,
|
||||||
|
AWinControl.Font.Color,
|
||||||
|
AWinControl.Color,
|
||||||
|
[GTK_STATE_NORMAL, GTK_STATE_ACTIVE, GTK_STATE_PRELIGHT, GTK_STYLE_BASE]);
|
||||||
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSCustomListView.SetDefaultItemHeight(
|
class procedure TGtk2WSCustomListView.SetDefaultItemHeight(
|
||||||
const ALV: TCustomListView; const AValue: Integer);
|
const ALV: TCustomListView; const AValue: Integer);
|
||||||
begin
|
begin
|
||||||
|
@ -166,11 +166,16 @@ end;
|
|||||||
|
|
||||||
class procedure TGtk2WSCustomMemo.SetColor(const AWinControl: TWinControl);
|
class procedure TGtk2WSCustomMemo.SetColor(const AWinControl: TWinControl);
|
||||||
var
|
var
|
||||||
AWidget : PGTKWidget;
|
AWidget: PGTKWidget;
|
||||||
begin
|
begin
|
||||||
AWidget:=PGtkWidget(AWinControl.Handle);
|
if not WSCheckHandleAllocated(AWinControl, 'SetColor') then
|
||||||
AWidget:=GetWidgetInfo(AWidget, True)^.CoreWidget;
|
Exit;
|
||||||
Gtk2WidgetSet.SetWidgetColor(AWidget, AWinControl.font.color, AWinControl.color,[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED,GTK_STYLE_BASE]);
|
AWidget := PGtkWidget(AWinControl.Handle);
|
||||||
|
AWidget := GetWidgetInfo(AWidget, True)^.CoreWidget;
|
||||||
|
Gtk2WidgetSet.SetWidgetColor(AWidget,
|
||||||
|
AWinControl.Font.Color,
|
||||||
|
AWinControl.Color,
|
||||||
|
[GTK_STATE_NORMAL, GTK_STATE_ACTIVE, GTK_STATE_PRELIGHT, GTK_STYLE_BASE]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSCustomMemo.SetFont(const AWinControl: TWinControl;
|
class procedure TGtk2WSCustomMemo.SetFont(const AWinControl: TWinControl;
|
||||||
|
@ -163,6 +163,7 @@ type
|
|||||||
|
|
||||||
class procedure SelectItem(const ACustomListBox: TCustomListBox; AnIndex: integer; ASelected: boolean); override;
|
class procedure SelectItem(const ACustomListBox: TCustomListBox; AnIndex: integer; ASelected: boolean); override;
|
||||||
class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
|
class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
|
||||||
|
class procedure SetColor(const AWinControl: TWinControl); override;
|
||||||
class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); override;
|
class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); override;
|
||||||
class procedure SetSelectionMode(const ACustomListBox: TCustomListBox; const AExtendedSelect,
|
class procedure SetSelectionMode(const ACustomListBox: TCustomListBox; const AExtendedSelect,
|
||||||
AMultiSelect: boolean); override;
|
AMultiSelect: boolean); override;
|
||||||
@ -453,6 +454,20 @@ begin
|
|||||||
BorderStyleShadowMap[ACustomListBox.BorderStyle]);
|
BorderStyleShadowMap[ACustomListBox.BorderStyle]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TGtk2WSCustomListBox.SetColor(const AWinControl: TWinControl);
|
||||||
|
var
|
||||||
|
AWidget: PGTKWidget;
|
||||||
|
begin
|
||||||
|
if not WSCheckHandleAllocated(AWinControl, 'SetColor') then
|
||||||
|
Exit;
|
||||||
|
AWidget := PGtkWidget(AWinControl.Handle);
|
||||||
|
AWidget := GetWidgetInfo(AWidget, True)^.CoreWidget;
|
||||||
|
Gtk2WidgetSet.SetWidgetColor(AWidget,
|
||||||
|
AWinControl.Font.Color,
|
||||||
|
AWinControl.Color,
|
||||||
|
[GTK_STATE_NORMAL, GTK_STATE_ACTIVE, GTK_STATE_PRELIGHT, GTK_STYLE_BASE]);
|
||||||
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSCustomListBox.SetItemIndex(
|
class procedure TGtk2WSCustomListBox.SetItemIndex(
|
||||||
const ACustomListBox: TCustomListBox; const AIndex: integer);
|
const ACustomListBox: TCustomListBox; const AIndex: integer);
|
||||||
var
|
var
|
||||||
@ -1519,6 +1534,8 @@ var
|
|||||||
WidgetInfo: PWidgetInfo;
|
WidgetInfo: PWidgetInfo;
|
||||||
Child: PGtkWidget; // can be GtkCellRenderer or GtkEntry
|
Child: PGtkWidget; // can be GtkCellRenderer or GtkEntry
|
||||||
begin
|
begin
|
||||||
|
if not WSCheckHandleAllocated(AWinControl, 'SetColor') then
|
||||||
|
Exit;
|
||||||
WidgetInfo := GetWidgetInfo(Pointer(AWinControl.Handle));
|
WidgetInfo := GetWidgetInfo(Pointer(AWinControl.Handle));
|
||||||
|
|
||||||
Child := GTK_BIN(WidgetInfo^.CoreWidget)^.child;
|
Child := GTK_BIN(WidgetInfo^.CoreWidget)^.child;
|
||||||
@ -1957,6 +1974,8 @@ class procedure TGtk2WSButton.SetColor(const AWinControl: TWinControl);
|
|||||||
var
|
var
|
||||||
BtnWidget: PGTKWidget;
|
BtnWidget: PGTKWidget;
|
||||||
begin
|
begin
|
||||||
|
if not WSCheckHandleAllocated(AWinControl, 'SetColor') then
|
||||||
|
Exit;
|
||||||
BtnWidget := PGTKWidget(GetButtonWidget(PGtkEventBox(AWinControl.Handle)));
|
BtnWidget := PGTKWidget(GetButtonWidget(PGtkEventBox(AWinControl.Handle)));
|
||||||
Gtk2WidgetSet.SetWidgetColor(BtnWidget, clNone, AWinControl.Color,
|
Gtk2WidgetSet.SetWidgetColor(BtnWidget, clNone, AWinControl.Color,
|
||||||
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
|
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
|
||||||
|
Loading…
Reference in New Issue
Block a user