mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 10:59:11 +02:00
implement border style for gtk TListBox and added generic way for setting border style for all scrollables
git-svn-id: trunk@13363 -
This commit is contained in:
parent
9cff00c297
commit
f7f99f038e
@ -36,7 +36,7 @@ uses
|
|||||||
GtkFontCache, Gtk1WSPrivate,
|
GtkFontCache, Gtk1WSPrivate,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
InterfaceBase, WSStdCtrls, WSLCLClasses, WSProc, WSControls,
|
InterfaceBase, WSStdCtrls, WSLCLClasses, WSProc, WSControls,
|
||||||
GtkInt, GtkDef, GTKWinApiWindow, gtkglobals, gtkproc, gtkExtra, GtkWSPrivate;
|
GtkInt, GtkDef, GTKWinApiWindow, GtkGlobals, GtkProc, GtkExtra, GtkWSPrivate;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -639,11 +639,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Handle := ACustomListBox.Handle;
|
Handle := ACustomListBox.Handle;
|
||||||
Widget:= PGtkWidget(PGtkBin(Handle)^.child);
|
Widget:= PGtkWidget(PGtkBin(Handle)^.child);
|
||||||
if ACustomListBox.BorderStyle = TBorderStyle(bsSingle)
|
gtk_viewport_set_shadow_type(PGtkViewPort(Widget), BorderStyleShadowMap[ACustomListBox.BorderStyle]);
|
||||||
then
|
|
||||||
gtk_viewport_set_shadow_type(PGtkViewPort(Widget), GTK_SHADOW_IN)
|
|
||||||
else
|
|
||||||
gtk_viewport_set_shadow_type(PGtkViewPort(Widget), GTK_SHADOW_NONE);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtkWSCustomListBox.SetItemIndex(const ACustomListBox: TCustomListBox;
|
class procedure TGtkWSCustomListBox.SetItemIndex(const ACustomListBox: TCustomListBox;
|
||||||
|
@ -35,9 +35,9 @@ uses
|
|||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
Controls,
|
Controls,
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
Gtk2, Gdk2, Glib2,
|
Gtk2, Gdk2, Glib2, GtkGlobals,
|
||||||
GtkWsControls,
|
GtkWsControls,
|
||||||
WSControls, WSLCLClasses;
|
WSControls, WSLCLClasses, WSProc;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -66,6 +66,7 @@ type
|
|||||||
public
|
public
|
||||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||||
class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
|
class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
|
||||||
|
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtk2WSGraphicControl }
|
{ TGtk2WSGraphicControl }
|
||||||
@ -162,6 +163,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TGtk2WSWinControl.SetBorderStyle(
|
||||||
|
const AWinControl: TWinControl; const ABorderStyle: TBorderStyle);
|
||||||
|
var
|
||||||
|
Widget: PGtkWidget;
|
||||||
|
begin
|
||||||
|
if not WSCheckHandleAllocated(AWinControl, 'SetBorderStyle')
|
||||||
|
then Exit;
|
||||||
|
|
||||||
|
Widget := PGtkWidget(AWinControl.Handle);
|
||||||
|
if GTK_IS_SCROLLED_WINDOW(Widget) then
|
||||||
|
gtk_scrolled_window_set_shadow_type(PGtkScrolledWindow(Widget), BorderStyleShadowMap[ABorderStyle])
|
||||||
|
else
|
||||||
|
TWSWinControlClass(ClassParent).SetBorderStyle(AWinControl, ABorderStyle);
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
|
@ -427,8 +427,8 @@ end;
|
|||||||
class procedure TGtk2WSCustomListBox.SetBorder(
|
class procedure TGtk2WSCustomListBox.SetBorder(
|
||||||
const ACustomListBox: TCustomListBox);
|
const ACustomListBox: TCustomListBox);
|
||||||
begin
|
begin
|
||||||
// TODO
|
gtk_scrolled_window_set_shadow_type(PGtkScrolledWindow(ACustomListBox.Handle),
|
||||||
debugln('TGtk2WSCustomListBox.SetBorder TODO');
|
BorderStyleShadowMap[ACustomListBox.BorderStyle]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSCustomListBox.SetItemIndex(
|
class procedure TGtk2WSCustomListBox.SetItemIndex(
|
||||||
@ -533,8 +533,8 @@ var
|
|||||||
column : PGtkTreeViewColumn;
|
column : PGtkTreeViewColumn;
|
||||||
WidgetInfo: PWidgetInfo;
|
WidgetInfo: PWidgetInfo;
|
||||||
begin
|
begin
|
||||||
Result := TGtkWSBaseScrollingWinControl.CreateHandle(AWinControl,AParams);
|
Result := TGtkWSBaseScrollingWinControl.CreateHandle(AWinControl, AParams);
|
||||||
p:= PGtkWidget(Result);
|
p := PGtkWidget(Result);
|
||||||
|
|
||||||
if Result = 0 then exit;
|
if Result = 0 then exit;
|
||||||
{$IFDEF DebugLCLComponents}
|
{$IFDEF DebugLCLComponents}
|
||||||
@ -545,7 +545,8 @@ begin
|
|||||||
GTK_WIDGET_UNSET_FLAGS(PGtkScrolledWindow(p)^.vscrollbar, GTK_CAN_FOCUS);
|
GTK_WIDGET_UNSET_FLAGS(PGtkScrolledWindow(p)^.vscrollbar, GTK_CAN_FOCUS);
|
||||||
gtk_scrolled_window_set_policy(PGtkScrolledWindow(p),
|
gtk_scrolled_window_set_policy(PGtkScrolledWindow(p),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
gtk_scrolled_window_set_shadow_type(PGtkScrolledWindow(p),GTK_SHADOW_IN);
|
gtk_scrolled_window_set_shadow_type(PGtkScrolledWindow(p),
|
||||||
|
BorderStyleShadowMap[TCustomListBox(AWinControl).BorderStyle]);
|
||||||
gtk_widget_show(p);
|
gtk_widget_show(p);
|
||||||
|
|
||||||
liststore := gtk_list_store_new (2, [G_TYPE_STRING, G_TYPE_POINTER, nil]);
|
liststore := gtk_list_store_new (2, [G_TYPE_STRING, G_TYPE_POINTER, nil]);
|
||||||
|
Loading…
Reference in New Issue
Block a user