mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-20 22:05:58 +02:00
style widgets are now realized, so all values are initialized
git-svn-id: trunk@5088 -
This commit is contained in:
parent
aa0ab2a2a5
commit
5dba91f6ae
@ -3199,22 +3199,16 @@ end;
|
|||||||
Procedure GTKStyleChanged(Widget: PGtkWidget; previous_style : PGTKStyle;
|
Procedure GTKStyleChanged(Widget: PGtkWidget; previous_style : PGTKStyle;
|
||||||
Data: Pointer); cdecl;
|
Data: Pointer); cdecl;
|
||||||
|
|
||||||
Handler for style changes. For example the user changes the the theme.
|
Handler for style changes. For example the user changes the theme.
|
||||||
|
But also called on every widget realize, so it should not release all styles
|
||||||
|
everytime.
|
||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
Procedure GTKStyleChanged(Widget: PGtkWidget; previous_style : PGTKStyle;
|
Procedure GTKStyleChanged(Widget: PGtkWidget; previous_style : PGTKStyle;
|
||||||
Data: Pointer); cdecl;
|
Data: Pointer); cdecl;
|
||||||
begin
|
begin
|
||||||
if (Widget=nil) or (Data=nil) or (previous_style=nil) then ;
|
if (Widget=nil) or (Data=nil) or (previous_style=nil) then ;
|
||||||
EventTrace('style-set', nil);
|
EventTrace('style-set', nil);
|
||||||
ReleaseStyle('button');
|
//ReleaseAllStyles;
|
||||||
ReleaseStyle('radiobutton');
|
|
||||||
ReleaseStyle('checkbox');
|
|
||||||
ReleaseStyle('menu');
|
|
||||||
ReleaseStyle('menuitem');
|
|
||||||
ReleaseStyle('scrollbar');
|
|
||||||
ReleaseStyle('tooltip');
|
|
||||||
ReleaseStyle('default');
|
|
||||||
ReleaseStyle('window');
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$I gtkDragCallback.inc}
|
{$I gtkDragCallback.inc}
|
||||||
@ -3230,6 +3224,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.215 2004/01/23 13:55:30 mattias
|
||||||
|
style widgets are now realized, so all values are initialized
|
||||||
|
|
||||||
Revision 1.214 2004/01/22 11:23:36 mattias
|
Revision 1.214 2004/01/22 11:23:36 mattias
|
||||||
started MaskBlt for gtkIF and applied patch for dir dlg in env opts from Vincent
|
started MaskBlt for gtkIF and applied patch for dir dlg in env opts from Vincent
|
||||||
|
|
||||||
|
@ -81,7 +81,39 @@ var
|
|||||||
var
|
var
|
||||||
LastFileSelectRow : gint;
|
LastFileSelectRow : gint;
|
||||||
|
|
||||||
// styles -------------------------------------------------------------------
|
// styles -------------------------------------------------------------------
|
||||||
|
type
|
||||||
|
TLazGtkStyle = (
|
||||||
|
lgsGTK_Default,
|
||||||
|
lgsDefault,
|
||||||
|
lgsButton,
|
||||||
|
lgsWindow,
|
||||||
|
lgsCheckbox,
|
||||||
|
lgsRadiobutton,
|
||||||
|
lgsMenu,
|
||||||
|
lgsMenuitem,
|
||||||
|
lgsList,
|
||||||
|
lgsScrollbar,
|
||||||
|
lgsTooltip,
|
||||||
|
lgsUserDefined
|
||||||
|
);
|
||||||
|
|
||||||
|
const
|
||||||
|
LazGtkStyleNames: array[TLazGtkStyle] of string = (
|
||||||
|
'gtk_default',
|
||||||
|
'default',
|
||||||
|
'button',
|
||||||
|
'window',
|
||||||
|
'checkbox',
|
||||||
|
'radiobutton',
|
||||||
|
'menu',
|
||||||
|
'menuitem',
|
||||||
|
'list',
|
||||||
|
'scrollbar',
|
||||||
|
'tooltip',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
var
|
var
|
||||||
Styles : TStrings;
|
Styles : TStrings;
|
||||||
|
|
||||||
|
@ -247,20 +247,12 @@ end;
|
|||||||
procedure TgtkObject.FreeAllStyles;
|
procedure TgtkObject.FreeAllStyles;
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TgtkObject.FreeAllStyles;
|
procedure TgtkObject.FreeAllStyles;
|
||||||
var
|
|
||||||
I : Integer;
|
|
||||||
begin
|
begin
|
||||||
If Assigned(Styles) then
|
If Assigned(Styles) then begin
|
||||||
Try
|
ReleaseAllStyles;
|
||||||
For I := Styles.Count - 1 downto 0 do
|
|
||||||
ReleaseStyle(Styles[I]);
|
|
||||||
Styles.Free;
|
Styles.Free;
|
||||||
Except
|
Styles:=nil;
|
||||||
on E: Exception do begin
|
|
||||||
writeln('WARNING: TgtkObject.FreeAllStyles: ',E.Message);
|
|
||||||
end;
|
end;
|
||||||
End;
|
|
||||||
Styles := Nil;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -9211,6 +9203,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.455 2004/01/23 13:55:30 mattias
|
||||||
|
style widgets are now realized, so all values are initialized
|
||||||
|
|
||||||
Revision 1.454 2004/01/22 11:23:36 mattias
|
Revision 1.454 2004/01/22 11:23:36 mattias
|
||||||
started MaskBlt for gtkIF and applied patch for dir dlg in env opts from Vincent
|
started MaskBlt for gtkIF and applied patch for dir dlg in env opts from Vincent
|
||||||
|
|
||||||
|
@ -4883,7 +4883,7 @@ begin
|
|||||||
gtk_box_pack_end(Result, ScrolledWidget, True, True, 0);
|
gtk_box_pack_end(Result, ScrolledWidget, True, True, 0);
|
||||||
gtk_widget_show(ScrolledWidget);
|
gtk_widget_show(ScrolledWidget);
|
||||||
ClientAreaWidget := gtk_layout_new(nil, nil);
|
ClientAreaWidget := gtk_layout_new(nil, nil);
|
||||||
WindowStyle:=GetStyle('window');
|
WindowStyle:=GetStyle(lgsWindow);
|
||||||
gtk_widget_set_style(ClientAreaWidget,WindowStyle);
|
gtk_widget_set_style(ClientAreaWidget,WindowStyle);
|
||||||
gtk_container_add(PGtkContainer(ScrolledWidget), ClientAreaWidget);
|
gtk_container_add(PGtkContainer(ScrolledWidget), ClientAreaWidget);
|
||||||
|
|
||||||
@ -4903,14 +4903,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function IndexOfStyle(aStyle: TLazGtkStyle): integer;
|
||||||
|
begin
|
||||||
|
Result:=IndexOfStyleWithName(LazGtkStyleNames[aStyle]);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: IndexOfStyle
|
Function: IndexOfWithNameStyle
|
||||||
Params: WName
|
Params: WName
|
||||||
Returns: Index of Style
|
Returns: Index of Style
|
||||||
|
|
||||||
Returns the Index within the Styles property of WNAME
|
Returns the Index within the Styles property of WNAME
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function IndexOfStyle(const WName : String): integer;
|
function IndexOfStyleWithName(const WName : String): integer;
|
||||||
begin
|
begin
|
||||||
if Styles<>nil then begin
|
if Styles<>nil then begin
|
||||||
for Result:=0 to Styles.Count-1 do
|
for Result:=0 to Styles.Count-1 do
|
||||||
@ -4935,6 +4940,9 @@ Type
|
|||||||
Widget : PGTKWidget;
|
Widget : PGTKWidget;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
StandardStyles: array[TLazGtkStyle] of PStyleObject;
|
||||||
|
|
||||||
Function NewStyleObject : PStyleObject;
|
Function NewStyleObject : PStyleObject;
|
||||||
begin
|
begin
|
||||||
New(Result);
|
New(Result);
|
||||||
@ -4943,10 +4951,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure FreeStyleObject(var StyleObject : PStyleObject);
|
Procedure FreeStyleObject(var StyleObject : PStyleObject);
|
||||||
|
// internal function to dispose a styleobject
|
||||||
|
// it does *not* remove it from the style lists
|
||||||
begin
|
begin
|
||||||
If StyleObject <> nil then begin
|
If StyleObject <> nil then begin
|
||||||
If StyleObject^.Widget <> nil then
|
If StyleObject^.Widget <> nil then begin
|
||||||
|
// first unref
|
||||||
|
gtk_widget_unref(StyleObject^.Widget);
|
||||||
|
// then destroy
|
||||||
GTK_Widget_Destroy(StyleObject^.Widget);
|
GTK_Widget_Destroy(StyleObject^.Widget);
|
||||||
|
end;
|
||||||
If StyleObject^.Style <> nil then
|
If StyleObject^.Style <> nil then
|
||||||
If StyleObject^.Style^.{$IFDEF Gtk2}attach_count{$ELSE}Ref_Count{$ENDIF}>0
|
If StyleObject^.Style^.{$IFDEF Gtk2}attach_count{$ELSE}Ref_Count{$ENDIF}>0
|
||||||
then
|
then
|
||||||
@ -4956,14 +4970,46 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure ReleaseStyle(const WName : String);
|
procedure ReleaseAllStyles;
|
||||||
|
var
|
||||||
|
StyleObject: PStyleObject;
|
||||||
|
lgs: TLazGtkStyle;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if Styles=nil then exit;
|
||||||
|
for i:=Styles.Count-1 downto 0 do begin
|
||||||
|
StyleObject:=PStyleObject(Styles.Objects[i]);
|
||||||
|
FreeStyleObject(StyleObject);
|
||||||
|
end;
|
||||||
|
Styles.Clear;
|
||||||
|
for lgs:=Low(TLazGtkStyle) to High(TLazGtkStyle) do
|
||||||
|
StandardStyles[lgs]:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ReleaseStyle(aStyle: TLazGtkStyle);
|
||||||
|
var
|
||||||
|
StyleObject: PStyleObject;
|
||||||
|
l: Integer;
|
||||||
|
begin
|
||||||
|
if Styles=nil then exit;
|
||||||
|
if aStyle in [lgsUserDefined] then
|
||||||
|
RaiseException('');// user styles are defined by name
|
||||||
|
StyleObject:=StandardStyles[aStyle];
|
||||||
|
if StyleObject<>nil then begin
|
||||||
|
l:=IndexOfStyle(aStyle);
|
||||||
|
Styles.Delete(l);
|
||||||
|
StandardStyles[aStyle]:=nil;
|
||||||
|
FreeStyleObject(StyleObject);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure ReleaseStyleWithName(const WName : String);
|
||||||
var
|
var
|
||||||
l : Longint;
|
l : Longint;
|
||||||
s : PStyleObject;
|
s : PStyleObject;
|
||||||
begin
|
begin
|
||||||
If Not Assigned(Styles) then
|
if Styles=nil then exit;
|
||||||
exit;
|
l := IndexOfStyleWithName(WName);
|
||||||
l := IndexOfStyle(WName);
|
|
||||||
If l >= 0 then begin
|
If l >= 0 then begin
|
||||||
If Styles.Objects[l] <> nil then
|
If Styles.Objects[l] <> nil then
|
||||||
Try
|
Try
|
||||||
@ -4976,8 +5022,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetStyle(aStyle: TLazGtkStyle): PGTKStyle;
|
||||||
|
begin
|
||||||
|
if Styles=nil then exit(nil);
|
||||||
|
if aStyle in [lgsUserDefined] then
|
||||||
|
RaiseException('');// user styles are defined by name
|
||||||
|
if StandardStyles[aStyle]<>nil then
|
||||||
|
// already created
|
||||||
|
Result:=StandardStyles[aStyle]^.Style
|
||||||
|
else
|
||||||
|
// create it
|
||||||
|
Result:=GetStyleWithName(LazGtkStyleNames[aStyle]);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: GetStyle
|
Function: GetStyleWithName
|
||||||
Params: none
|
Params: none
|
||||||
Returns: Returns a Corresponding Style
|
Returns: Returns a Corresponding Style
|
||||||
|
|
||||||
@ -4987,30 +5046,46 @@ end;
|
|||||||
list which is only updated on theme change, to ensure fast efficient retrieval
|
list which is only updated on theme change, to ensure fast efficient retrieval
|
||||||
of Styles.
|
of Styles.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function GetStyle(const WName : String) : PGTKStyle;
|
function GetStyleWithName(const WName: String) : PGTKStyle;
|
||||||
var
|
var
|
||||||
Tp : Pointer;
|
Tp : Pointer;
|
||||||
l : Longint;
|
l : Longint;
|
||||||
StyleObject : PStyleObject;
|
StyleObject : PStyleObject;
|
||||||
NoName: PGChar;
|
NoName: PGChar;
|
||||||
|
lgs: TLazGtkStyle;
|
||||||
|
WidgetName: String;
|
||||||
|
VBox: PGtkWidget;
|
||||||
|
AddToStyleWindow: Boolean;
|
||||||
|
StyleWindowWidget: PGtkWidget;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
if Styles=nil then exit;
|
||||||
{$IFDEF NoStyle}
|
{$IFDEF NoStyle}
|
||||||
exit;
|
exit;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
If Not Assigned(Styles) then
|
|
||||||
exit;
|
If (WName='') then exit;
|
||||||
l:=IndexOfStyle(WName);
|
l:=IndexOfStyleWithName(WName);
|
||||||
// writeln('GetStyle A ',WName,' ',l);
|
//writeln('GetStyleWithName START ',WName,' ',l);
|
||||||
If l < 0 then begin
|
|
||||||
|
If l >= 0 then begin
|
||||||
|
StyleObject:=PStyleObject(Styles.Objects[l]);
|
||||||
|
Result := StyleObject^.Style;
|
||||||
|
|
||||||
|
end else begin
|
||||||
// create a new style object
|
// create a new style object
|
||||||
StyleObject := NewStyleObject;
|
StyleObject := NewStyleObject;
|
||||||
|
lgs:=lgsUserDefined;
|
||||||
Tp:=nil;
|
Tp:=nil;
|
||||||
|
AddToStyleWindow:=true;
|
||||||
// create a style widget
|
// create a style widget
|
||||||
If AnsiCompareText(WName,'button')=0 then
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsButton])=0 then begin
|
||||||
StyleObject^.Widget := GTK_BUTTON_NEW
|
StyleObject^.Widget := GTK_BUTTON_NEW;
|
||||||
else
|
lgs:=lgsButton;
|
||||||
If AnsiCompareText(WName,'default')=0 then begin
|
end else
|
||||||
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsDefault])=0 then begin
|
||||||
|
lgs:=lgsDefault;
|
||||||
|
AddToStyleWindow:=false;
|
||||||
NoName:=nil;
|
NoName:=nil;
|
||||||
StyleObject^.Widget :=
|
StyleObject^.Widget :=
|
||||||
// GTK2 does not allow to instantiate the abstract base Widget
|
// GTK2 does not allow to instantiate the abstract base Widget
|
||||||
@ -5021,30 +5096,52 @@ begin
|
|||||||
NoName,[]);
|
NoName,[]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
If AnsiCompareText(WName,'window')=0 then begin
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsWindow])=0 then begin
|
||||||
|
lgs:=lgsWindow;
|
||||||
StyleObject^.Widget := GTK_WINDOW_NEW(GTK_WINDOW_TOPLEVEL);
|
StyleObject^.Widget := GTK_WINDOW_NEW(GTK_WINDOW_TOPLEVEL);
|
||||||
|
AddToStyleWindow:=false;
|
||||||
|
gtk_widget_hide(StyleObject^.Widget);
|
||||||
|
// create the box
|
||||||
|
// (where to put all style widgets, that need a parent for realize)
|
||||||
|
VBox:=gtk_vbox_new(false,0);
|
||||||
|
gtk_widget_show(VBox);
|
||||||
|
gtk_container_add(PGtkContainer(StyleObject^.Widget), VBox);
|
||||||
|
gtk_object_set_data(PGtkObject(StyleObject^.Widget),'vbox',VBox);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
If AnsiCompareText(WName,'checkbox')=0 then begin
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsCheckbox])=0 then begin
|
||||||
|
lgs:=lgsCheckbox;
|
||||||
StyleObject^.Widget := GTK_CHECK_BUTTON_NEW;
|
StyleObject^.Widget := GTK_CHECK_BUTTON_NEW;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
If AnsiCompareText(WName,'radiobutton')=0 then
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsRadiobutton])=0 then begin
|
||||||
StyleObject^.Widget := GTK_RADIO_BUTTON_NEW(nil)
|
lgs:=lgsRadiobutton;
|
||||||
|
StyleObject^.Widget := GTK_RADIO_BUTTON_NEW(nil);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
If AnsiCompareText(WName,'menu')=0 then
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsMenu])=0 then begin
|
||||||
StyleObject^.Widget := GTK_MENU_NEW
|
lgs:=lgsMenu;
|
||||||
|
StyleObject^.Widget := GTK_MENU_NEW;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
If AnsiCompareText(WName,'menuitem')=0 then
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsMenuitem])=0 then begin
|
||||||
StyleObject^.Widget := GTK_MENU_ITEM_NEW
|
lgs:=lgsMenuitem;
|
||||||
|
StyleObject^.Widget := GTK_MENU_ITEM_NEW;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
If AnsiCompareText(WName,'list')=0 then
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsList])=0 then begin
|
||||||
StyleObject^.Widget := GTK_LIST_NEW
|
lgs:=lgsList;
|
||||||
|
StyleObject^.Widget := GTK_LIST_NEW;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
If AnsiCompareText(WName,'scrollbar')=0 then
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsScrollbar])=0 then begin
|
||||||
StyleObject^.Widget := gtk_hscrollbar_new(nil)//can't dif. between Horiz/Vert. Styles
|
lgs:=lgsScrollbar;
|
||||||
|
StyleObject^.Widget := gtk_hscrollbar_new(nil);//can't dif. between Horiz/Vert. Styles
|
||||||
|
end
|
||||||
else
|
else
|
||||||
If AnsiCompareText(WName,'tooltip')=0 then begin
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsTooltip])=0 then begin
|
||||||
|
lgs:=lgsTooltip;
|
||||||
|
AddToStyleWindow:=false;
|
||||||
TP := gtk_tooltips_new;
|
TP := gtk_tooltips_new;
|
||||||
StyleObject^.Widget := nil;
|
StyleObject^.Widget := nil;
|
||||||
GTK_Tooltips_Force_Window(TP);
|
GTK_Tooltips_Force_Window(TP);
|
||||||
@ -5052,63 +5149,106 @@ begin
|
|||||||
StyleObject^.Style:=gtk_widget_get_style(PGTKTooltips(TP)^.Tip_Window);
|
StyleObject^.Style:=gtk_widget_get_style(PGTKTooltips(TP)^.Tip_Window);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
If AnsiCompareText(WName,'gtk_default')=0 then begin
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsGTK_Default])=0 then begin
|
||||||
|
lgs:=lgsGTK_Default;
|
||||||
|
AddToStyleWindow:=false;
|
||||||
StyleObject^.Widget := nil;
|
StyleObject^.Widget := nil;
|
||||||
StyleObject^.Style := gtk_style_new;
|
StyleObject^.Style := gtk_style_new;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
|
// unknown style name -> bug
|
||||||
FreeStyleObject(StyleObject);
|
FreeStyleObject(StyleObject);
|
||||||
exit;
|
RaiseException('');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if (lgs<>lgsUserDefined) and (StandardStyles[lgs]<>nil) then begin
|
||||||
|
// consistency error
|
||||||
|
RaiseException('');
|
||||||
|
end;
|
||||||
|
|
||||||
// ensure style of the widget
|
// ensure style of the widget
|
||||||
If (StyleObject^.Widget <> nil) then begin
|
If (StyleObject^.Widget <> nil) then begin
|
||||||
|
gtk_widget_ref(StyleObject^.Widget);
|
||||||
|
|
||||||
|
// put style widget on style window, so that it can be realized
|
||||||
|
if AddToStyleWindow then begin
|
||||||
|
gtk_widget_show(StyleObject^.Widget);
|
||||||
|
StyleWindowWidget:=GetStyleWidget(lgsWindow);
|
||||||
|
VBox:=PGTKWidget(
|
||||||
|
gtk_object_get_data(PGtkObject(StyleWindowWidget),'vbox'));
|
||||||
|
gtk_box_pack_end(PGTKBox(VBox), StyleObject^.Widget, True, True, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
WidgetName:='LazStyle'+WName;
|
||||||
|
gtk_widget_set_name(StyleObject^.Widget,PChar(WidgetName));
|
||||||
gtk_widget_ensure_style(StyleObject^.Widget);
|
gtk_widget_ensure_style(StyleObject^.Widget);
|
||||||
StyleObject^.Style:=gtk_widget_get_style(StyleObject^.Widget);
|
StyleObject^.Style:=gtk_widget_get_style(StyleObject^.Widget);
|
||||||
// ToDo: find out, why sometimes the style is not initialized.
|
// ToDo: find out, why sometimes the style is not initialized.
|
||||||
// for example: why the following occurs:
|
// for example: why the following occurs:
|
||||||
If AnsiCompareText(WName,'button')=0 then begin
|
If AnsiCompareText(WName,'button')=0 then begin
|
||||||
if StyleObject^.Style^.light_gc[GTK_STATE_NORMAL]=nil then begin
|
if StyleObject^.Style^.light_gc[GTK_STATE_NORMAL]=nil then begin
|
||||||
//if not GtkWidgetIsA(StyleObject^.Widget,GTK_WINDOW_TYPE) then begin
|
//writeln('GetStyleWithName ',WName);
|
||||||
//end;
|
if not GtkWidgetIsA(StyleObject^.Widget,GTK_WINDOW_TYPE) then begin
|
||||||
|
gtk_widget_realize(StyleObject^.Widget);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// increase refcount of style
|
||||||
If StyleObject^.Style <> nil then
|
If StyleObject^.Style <> nil then
|
||||||
If AnsiCompareText(WName,'gtk_default')<>0 then
|
If AnsiCompareText(WName,LazGtkStyleNames[lgsGTK_Default])<>0 then
|
||||||
StyleObject^.Style:=GTK_Style_Ref(StyleObject^.Style);
|
StyleObject^.Style:=GTK_Style_Ref(StyleObject^.Style);
|
||||||
|
|
||||||
// if successful add to style objects list
|
// if successful add to style objects list
|
||||||
if StyleObject^.Style <> nil then begin
|
if StyleObject^.Style <> nil then begin
|
||||||
Styles.AddObject(WName, TObject(StyleObject));
|
Styles.AddObject(WName, TObject(StyleObject));
|
||||||
|
if lgs<>lgsUserDefined then
|
||||||
|
StandardStyles[lgs]:=StyleObject;
|
||||||
Result:=StyleObject^.Style;
|
Result:=StyleObject^.Style;
|
||||||
If (StyleObject^.Widget <> nil)
|
If (StyleObject^.Widget <> nil)
|
||||||
and (AnsiCompareText(WName,'window')=0) then
|
and (AnsiCompareText(WName,LazGtkStyleNames[lgsWindow])=0) then
|
||||||
UpdateSysColorMap(StyleObject^.Widget);
|
UpdateSysColorMap(StyleObject^.Widget);
|
||||||
|
|
||||||
// ToDo: create all gc of the style
|
// ToDo: create all gc of the style
|
||||||
|
//gtk_widget_set_rc_style(StyleObject^.Widget);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
// no success, clean up
|
// no success, clean up
|
||||||
FreeStyleObject(StyleObject);
|
FreeStyleObject(StyleObject);
|
||||||
|
writeln('WARNING: GetStyleWithName ',WName,' failed');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// clean up
|
||||||
If Tp<>nil then
|
If Tp<>nil then
|
||||||
GTK_Object_Destroy(Tp);
|
GTK_Object_Destroy(Tp);
|
||||||
end else begin
|
|
||||||
StyleObject:=PStyleObject(Styles.Objects[l]);
|
|
||||||
Result := StyleObject^.Style;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function GetStyleWidget(const WName : String) : PGTKWidget;
|
function GetStyleWidget(aStyle: TLazGtkStyle) : PGTKWidget;
|
||||||
|
begin
|
||||||
|
if aStyle in [lgsUserDefined] then
|
||||||
|
RaiseException('');// user styles are defined by name
|
||||||
|
if StandardStyles[aStyle]<>nil then
|
||||||
|
// already created
|
||||||
|
Result:=StandardStyles[aStyle]^.Widget
|
||||||
|
else
|
||||||
|
// create it
|
||||||
|
Result:=GetStyleWidgetWithName(LazGtkStyleNames[aStyle]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function GetStyleWidgetWithName(const WName : String) : PGTKWidget;
|
||||||
var
|
var
|
||||||
l : Longint;
|
l : Longint;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
l:=IndexOfStyle(WName);
|
// init style
|
||||||
If (l > -1) or (GetStyle(WName) <> nil) then begin
|
GetStyleWithName(WName);
|
||||||
l:=IndexOfStyle(WName);
|
// return widget
|
||||||
|
l:=IndexOfStyleWithName(WName);
|
||||||
|
If l>=0 then
|
||||||
Result := PStyleObject(Styles.Objects[l])^.Widget;
|
Result := PStyleObject(Styles.Objects[l])^.Widget;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -5131,9 +5271,9 @@ var
|
|||||||
Style : PGTKStyle;
|
Style : PGTKStyle;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
if Style = nil then
|
if Style = nil then
|
||||||
Style := GetStyle('gtk_default');
|
Style := GetStyle(lgsGTK_Default);
|
||||||
|
|
||||||
If (Style <> nil) then begin
|
If (Style <> nil) then begin
|
||||||
Result := pango_font_description_copy(Style^.font_desc);
|
Result := pango_font_description_copy(Style^.font_desc);
|
||||||
@ -5151,9 +5291,9 @@ var
|
|||||||
Style : PGTKStyle;
|
Style : PGTKStyle;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
if Style = nil then
|
if Style = nil then
|
||||||
Style := GetStyle('gtk_default');
|
Style := GetStyle(lgsGTK_Default);
|
||||||
|
|
||||||
If Style <> nil then begin
|
If Style <> nil then begin
|
||||||
Result := Style^.Font;
|
Result := Style^.Font;
|
||||||
@ -5184,9 +5324,9 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
if Style = nil then
|
if Style = nil then
|
||||||
Style := GetStyle('gtk_default');
|
Style := GetStyle(lgsGTK_Default);
|
||||||
|
|
||||||
If Style <> nil then begin
|
If Style <> nil then begin
|
||||||
{$IFDEF GTK1}
|
{$IFDEF GTK1}
|
||||||
@ -5290,10 +5430,10 @@ begin
|
|||||||
|
|
||||||
COLOR_INFOBK :
|
COLOR_INFOBK :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('tooltip');
|
Style := GetStyle(lgsTooltip);
|
||||||
|
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
Style := GetStyle('window');
|
Style := GetStyle(lgsWindow);
|
||||||
|
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -5315,10 +5455,10 @@ begin
|
|||||||
|
|
||||||
COLOR_INFOTEXT :
|
COLOR_INFOTEXT :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('tooltip');
|
Style := GetStyle(lgsTooltip);
|
||||||
|
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
Style := GetStyle('window');
|
Style := GetStyle(lgsWindow);
|
||||||
|
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -5338,10 +5478,10 @@ begin
|
|||||||
COLOR_BTNFACE :
|
COLOR_BTNFACE :
|
||||||
begin
|
begin
|
||||||
Case BaseColor of
|
Case BaseColor of
|
||||||
COLOR_FORM: Style := GetStyle('window');
|
COLOR_FORM: Style := GetStyle(lgsWindow);
|
||||||
COLOR_BTNFACE: Style := GetStyle('button');
|
COLOR_BTNFACE: Style := GetStyle(lgsButton);
|
||||||
COLOR_MENU: Style := GetStyle('menu');
|
COLOR_MENU: Style := GetStyle(lgsMenu);
|
||||||
COLOR_SCROLLBAR: Style := GetStyle('scrollbar');
|
COLOR_SCROLLBAR: Style := GetStyle(lgsScrollbar);
|
||||||
end;
|
end;
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -5363,7 +5503,7 @@ begin
|
|||||||
COLOR_3DDKSHADOW,
|
COLOR_3DDKSHADOW,
|
||||||
COLOR_BTNSHADOW :
|
COLOR_BTNSHADOW :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('button');
|
Style := GetStyle(lgsButton);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
GC := Style^.dark_gc[GTK_STATE_NORMAL];
|
GC := Style^.dark_gc[GTK_STATE_NORMAL];
|
||||||
@ -5377,7 +5517,7 @@ begin
|
|||||||
|
|
||||||
COLOR_GRAYTEXT :
|
COLOR_GRAYTEXT :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
GC := Style^.text_gc[GTK_STATE_INSENSITIVE];
|
GC := Style^.text_gc[GTK_STATE_INSENSITIVE];
|
||||||
@ -5392,8 +5532,8 @@ begin
|
|||||||
COLOR_BTNTEXT :
|
COLOR_BTNTEXT :
|
||||||
begin
|
begin
|
||||||
Case BaseColor of
|
Case BaseColor of
|
||||||
COLOR_BTNTEXT : Style := GetStyle('button');
|
COLOR_BTNTEXT : Style := GetStyle(lgsButton);
|
||||||
COLOR_MENUTEXT : Style := GetStyle('menuitem');
|
COLOR_MENUTEXT : Style := GetStyle(lgsMenuitem);
|
||||||
end;
|
end;
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -5408,7 +5548,7 @@ begin
|
|||||||
|
|
||||||
COLOR_WINDOWTEXT:
|
COLOR_WINDOWTEXT:
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
GC := Style^.text_gc[GTK_STATE_NORMAL];
|
GC := Style^.text_gc[GTK_STATE_NORMAL];
|
||||||
@ -5423,7 +5563,7 @@ begin
|
|||||||
COLOR_3DLIGHT,
|
COLOR_3DLIGHT,
|
||||||
COLOR_BTNHIGHLIGHT :
|
COLOR_BTNHIGHLIGHT :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('button');
|
Style := GetStyle(lgsButton);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
GC := Style^.light_gc[GTK_STATE_NORMAL];
|
GC := Style^.light_gc[GTK_STATE_NORMAL];
|
||||||
@ -5440,12 +5580,12 @@ begin
|
|||||||
ThemeWidget:=GetWidgetWithBackgroundWindow(ThemeWidget);
|
ThemeWidget:=GetWidgetWithBackgroundWindow(ThemeWidget);
|
||||||
if ThemeWidget<>nil then begin
|
if ThemeWidget<>nil then begin
|
||||||
if GtkWidgetIsA(ThemeWidget,GTK_TYPE_LIST_ITEM) then
|
if GtkWidgetIsA(ThemeWidget,GTK_TYPE_LIST_ITEM) then
|
||||||
Style:=GetStyle('list');
|
Style:=GetStyle(lgsList);
|
||||||
if Style=nil then
|
if Style=nil then
|
||||||
Style:=PGtkStyle(gtk_widget_get_style(ThemeWidget));
|
Style:=PGtkStyle(gtk_widget_get_style(ThemeWidget));
|
||||||
end;
|
end;
|
||||||
if Style=nil then
|
if Style=nil then
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
GC := Style^.base_gc[GTK_STATE_NORMAL];
|
GC := Style^.base_gc[GTK_STATE_NORMAL];
|
||||||
@ -5462,7 +5602,7 @@ begin
|
|||||||
|
|
||||||
COLOR_HIGHLIGHT :
|
COLOR_HIGHLIGHT :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
GC := Style^.bg_gc[GTK_STATE_SELECTED];
|
GC := Style^.bg_gc[GTK_STATE_SELECTED];
|
||||||
@ -5476,7 +5616,7 @@ begin
|
|||||||
|
|
||||||
COLOR_HIGHLIGHTTEXT :
|
COLOR_HIGHLIGHTTEXT :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
GC := Style^.bg_gc[GTK_STATE_PRELIGHT];
|
GC := Style^.bg_gc[GTK_STATE_PRELIGHT];
|
||||||
@ -5515,7 +5655,7 @@ begin
|
|||||||
Case TColor(Color) of
|
Case TColor(Color) of
|
||||||
clINFOTEXT :
|
clINFOTEXT :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('tooltip');
|
Style := GetStyle(lgsTooltip);
|
||||||
|
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -5526,7 +5666,7 @@ begin
|
|||||||
cl3DDKSHADOW,
|
cl3DDKSHADOW,
|
||||||
clBTNSHADOW :
|
clBTNSHADOW :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('button');
|
Style := GetStyle(lgsButton);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
Result := @Style^.dark[GTK_STATE_NORMAL];
|
Result := @Style^.dark[GTK_STATE_NORMAL];
|
||||||
@ -5534,7 +5674,7 @@ begin
|
|||||||
|
|
||||||
clGRAYTEXT :
|
clGRAYTEXT :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
Result := @Style^.text[GTK_STATE_INSENSITIVE];
|
Result := @Style^.text[GTK_STATE_INSENSITIVE];
|
||||||
@ -5544,8 +5684,8 @@ begin
|
|||||||
clBTNTEXT :
|
clBTNTEXT :
|
||||||
begin
|
begin
|
||||||
Case TColor(Color) of
|
Case TColor(Color) of
|
||||||
clBTNTEXT : Style := GetStyle('button');
|
clBTNTEXT : Style := GetStyle(lgsButton);
|
||||||
clMENUTEXT : Style := GetStyle('menuitem');
|
clMENUTEXT : Style := GetStyle(lgsMenuitem);
|
||||||
end;
|
end;
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -5554,7 +5694,7 @@ begin
|
|||||||
|
|
||||||
clWINDOWTEXT:
|
clWINDOWTEXT:
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
Result := @Style^.text[GTK_STATE_NORMAL];
|
Result := @Style^.text[GTK_STATE_NORMAL];
|
||||||
@ -5563,7 +5703,7 @@ begin
|
|||||||
cl3DLIGHT,
|
cl3DLIGHT,
|
||||||
clBTNHIGHLIGHT :
|
clBTNHIGHLIGHT :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('button');
|
Style := GetStyle(lgsButton);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
Result := @Style^.light[GTK_STATE_NORMAL];
|
Result := @Style^.light[GTK_STATE_NORMAL];
|
||||||
@ -5571,7 +5711,7 @@ begin
|
|||||||
|
|
||||||
clHIGHLIGHTTEXT :
|
clHIGHLIGHTTEXT :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('default');
|
Style := GetStyle(lgsDefault);
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
exit;
|
exit;
|
||||||
Result := @Style^.bg[GTK_STATE_PRELIGHT];
|
Result := @Style^.bg[GTK_STATE_PRELIGHT];
|
||||||
@ -5621,8 +5761,8 @@ begin
|
|||||||
|
|
||||||
clInfoBk :
|
clInfoBk :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('window');
|
Style := GetStyle(lgsWindow);
|
||||||
widget := GetStyleWidget('window');
|
widget := GetStyleWidget(lgsWindow);
|
||||||
// Style := GetStyle('tooltip');
|
// Style := GetStyle('tooltip');
|
||||||
state := GTK_STATE_NORMAL;
|
state := GTK_STATE_NORMAL;
|
||||||
detail := 'tooltip';
|
detail := 'tooltip';
|
||||||
@ -5630,8 +5770,8 @@ begin
|
|||||||
|
|
||||||
clForm :
|
clForm :
|
||||||
begin
|
begin
|
||||||
Style := GetStyle('window');
|
Style := GetStyle(lgsWindow);
|
||||||
widget := GetStyleWidget('window');
|
widget := GetStyleWidget(lgsWindow);
|
||||||
state := GTK_STATE_NORMAL;
|
state := GTK_STATE_NORMAL;
|
||||||
detail := 'window';
|
detail := 'window';
|
||||||
end;
|
end;
|
||||||
@ -6065,6 +6205,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.248 2004/01/23 13:55:30 mattias
|
||||||
|
style widgets are now realized, so all values are initialized
|
||||||
|
|
||||||
Revision 1.247 2004/01/22 11:23:36 mattias
|
Revision 1.247 2004/01/22 11:23:36 mattias
|
||||||
started MaskBlt for gtkIF and applied patch for dir dlg in env opts from Vincent
|
started MaskBlt for gtkIF and applied patch for dir dlg in env opts from Vincent
|
||||||
|
|
||||||
|
@ -556,11 +556,16 @@ procedure FreeClipboardTargetEntries(ClipboardType: TClipboardType);
|
|||||||
// forms
|
// forms
|
||||||
Function CreateFormContents(AForm: TCustomForm; var FormWidget: Pointer): Pointer;
|
Function CreateFormContents(AForm: TCustomForm; var FormWidget: Pointer): Pointer;
|
||||||
|
|
||||||
// style
|
// styles
|
||||||
function IndexOfStyle(const WName : String): integer;
|
function IndexOfStyle(aStyle: TLazGtkStyle): integer;
|
||||||
Procedure ReleaseStyle(const WName : String);
|
function IndexOfStyleWithName(const WName : String): integer;
|
||||||
function GetStyle(const WName : String) : PGTKStyle;
|
Procedure ReleaseAllStyles;
|
||||||
Function GetStyleWidget(const WName : String) : PGTKWidget;
|
Procedure ReleaseStyle(aStyle: TLazGtkStyle);
|
||||||
|
Procedure ReleaseStyleWithName(const WName : String);
|
||||||
|
function GetStyle(aStyle: TLazGtkStyle): PGTKStyle;
|
||||||
|
function GetStyleWithName(const WName : String) : PGTKStyle;
|
||||||
|
Function GetStyleWidget(aStyle: TLazGtkStyle) : PGTKWidget;
|
||||||
|
Function GetStyleWidgetWithName(const WName : String) : PGTKWidget;
|
||||||
Procedure StyleFillRectangle(drawable : PGDKDrawable; GC : PGDKGC; Color : TColorRef; x, y, width, height : gint);
|
Procedure StyleFillRectangle(drawable : PGDKDrawable; GC : PGDKGC; Color : TColorRef; x, y, width, height : gint);
|
||||||
Function StyleForegroundColor(Color : TColorRef; DefaultColor : PGDKColor): PGDKColor;
|
Function StyleForegroundColor(Color : TColorRef; DefaultColor : PGDKColor): PGDKColor;
|
||||||
|
|
||||||
@ -806,7 +811,10 @@ end;
|
|||||||
{$I gtkproc.inc}
|
{$I gtkproc.inc}
|
||||||
{$I gtkcallback.inc}
|
{$I gtkcallback.inc}
|
||||||
|
|
||||||
initialization
|
procedure InitGTKProc;
|
||||||
|
var
|
||||||
|
lgs: TLazGtkStyle;
|
||||||
|
begin
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
{$IFNDEF GTK2_2}
|
{$IFNDEF GTK2_2}
|
||||||
MX11Display := nil;
|
MX11Display := nil;
|
||||||
@ -823,7 +831,12 @@ initialization
|
|||||||
GdkTrapCalls := 0;
|
GdkTrapCalls := 0;
|
||||||
LCLHandledKeyEvents:=nil;
|
LCLHandledKeyEvents:=nil;
|
||||||
|
|
||||||
finalization
|
for lgs:=Low(TLazGtkStyle) to High(TLazGtkStyle) do
|
||||||
|
StandardStyles[lgs]:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DoneGTKProc;
|
||||||
|
begin
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
{$IFNDEF GTK2_2}
|
{$IFNDEF GTK2_2}
|
||||||
if MX11Display <> nil
|
if MX11Display <> nil
|
||||||
@ -834,5 +847,13 @@ finalization
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
DoneKeyboardTables;
|
DoneKeyboardTables;
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
InitGTKProc;
|
||||||
|
|
||||||
|
finalization
|
||||||
|
DoneGTKProc;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -2236,7 +2236,7 @@ var
|
|||||||
aDC:=TDeviceContext(DC);
|
aDC:=TDeviceContext(DC);
|
||||||
DCOrigin:=GetDCOffset(aDC);
|
DCOrigin:=GetDCOffset(aDC);
|
||||||
|
|
||||||
aStyle := GetStyle('button');
|
aStyle := GetStyle(lgsButton);
|
||||||
If aStyle = nil then
|
If aStyle = nil then
|
||||||
aStyle := gtk_widget_get_style(Widget)
|
aStyle := gtk_widget_get_style(Widget)
|
||||||
else begin
|
else begin
|
||||||
@ -2301,17 +2301,17 @@ var
|
|||||||
aDC:=TDeviceContext(DC);
|
aDC:=TDeviceContext(DC);
|
||||||
DCOrigin:=GetDCOffset(aDC);
|
DCOrigin:=GetDCOffset(aDC);
|
||||||
|
|
||||||
Style := GetStyle('checkbox');
|
Style := GetStyle(lgsCheckbox);
|
||||||
|
|
||||||
If Style = nil then
|
If Style = nil then
|
||||||
Style := GetStyle('gtk_default');
|
Style := GetStyle(lgsGTK_Default);
|
||||||
|
|
||||||
If Style <> nil then
|
If Style <> nil then
|
||||||
Style := gtk_style_attach(gtk_style_ref(Style),aDC.Drawable);
|
Style := gtk_style_attach(gtk_style_ref(Style),aDC.Drawable);
|
||||||
|
|
||||||
Widget := GetStyleWidget('checkbox');
|
Widget := GetStyleWidget(lgsCheckbox);
|
||||||
If Widget = nil then
|
If Widget = nil then
|
||||||
Widget := GetStyleWidget('default');
|
Widget := GetStyleWidget(lgsDefault);
|
||||||
If (Widget <> nil) and (Style <> nil) then begin
|
If (Widget <> nil) and (Style <> nil) then begin
|
||||||
Widget^.Window := aDC.Drawable;
|
Widget^.Window := aDC.Drawable;
|
||||||
if Style<>nil then
|
if Style<>nil then
|
||||||
@ -3385,9 +3385,9 @@ begin
|
|||||||
Result := IsValidDC(DC);
|
Result := IsValidDC(DC);
|
||||||
if not Result then exit;
|
if not Result then exit;
|
||||||
if FrameWidth=0 then exit;
|
if FrameWidth=0 then exit;
|
||||||
TheStyle:=GetStyle('button');
|
TheStyle:=GetStyle(lgsButton);
|
||||||
if TheStyle=nil then exit;
|
|
||||||
//writeln('TGtkObject.Frame3d A ',HexStr(Cardinal(TheStyle),8));
|
//writeln('TGtkObject.Frame3d A ',HexStr(Cardinal(TheStyle),8));
|
||||||
|
if TheStyle=nil then exit;
|
||||||
|
|
||||||
with TDeviceContext(DC) do
|
with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
@ -8700,6 +8700,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.321 2004/01/23 13:55:30 mattias
|
||||||
|
style widgets are now realized, so all values are initialized
|
||||||
|
|
||||||
Revision 1.320 2004/01/22 11:23:36 mattias
|
Revision 1.320 2004/01/22 11:23:36 mattias
|
||||||
started MaskBlt for gtkIF and applied patch for dir dlg in env opts from Vincent
|
started MaskBlt for gtkIF and applied patch for dir dlg in env opts from Vincent
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user