mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 10:00:41 +02:00
MG: added gtk rc file support and started stule dependent syscolors
git-svn-id: trunk@706 -
This commit is contained in:
parent
4a11d8de0c
commit
b0c70834c4
@ -49,6 +49,8 @@ begin
|
|||||||
FAccelGroup := gtk_accel_group_new();
|
FAccelGroup := gtk_accel_group_new();
|
||||||
FTimerData := TList.Create;
|
FTimerData := TList.Create;
|
||||||
FDefaultFont:= nil;
|
FDefaultFont:= nil;
|
||||||
|
FRCFilename := ChangeFileExt(ParamStr(0),'.gtkrc');
|
||||||
|
FRCFileParsed := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -600,6 +602,10 @@ begin
|
|||||||
// call init and pass cmd line args
|
// call init and pass cmd line args
|
||||||
gtk_init (@argc, @argv);
|
gtk_init (@argc, @argv);
|
||||||
|
|
||||||
|
// read gtk rc file
|
||||||
|
FRCFileParsed:=true;
|
||||||
|
ParseRCFile;
|
||||||
|
|
||||||
// Create default cursor types
|
// Create default cursor types
|
||||||
Cursor_Watch := gdk_Cursor_New(gdk_Watch);
|
Cursor_Watch := gdk_Cursor_New(gdk_Watch);
|
||||||
Cursor_Arrow := gdk_Cursor_New(gdk_Arrow);
|
Cursor_Arrow := gdk_Cursor_New(gdk_Arrow);
|
||||||
@ -2654,6 +2660,36 @@ var
|
|||||||
//pStr : PChar; // currently only used for TBitBtn to load default pixmap
|
//pStr : PChar; // currently only used for TBitBtn to load default pixmap
|
||||||
ParentForm: TCustomForm;
|
ParentForm: TCustomForm;
|
||||||
|
|
||||||
|
procedure Set_RC_Name(AWidget: PGtkWidget);
|
||||||
|
var RCName: string;
|
||||||
|
AComponent: TComponent;
|
||||||
|
begin
|
||||||
|
if (AWidget=nil) or (not (Sender is TComponent)) then exit;
|
||||||
|
|
||||||
|
// check if a unique name can be created
|
||||||
|
AComponent:=TComponent(Sender);
|
||||||
|
while (AComponent<>nil) and (AComponent.Name<>'') do begin
|
||||||
|
AComponent:=AComponent.Owner;
|
||||||
|
end;
|
||||||
|
if (AComponent=nil) or (AComponent=TComponent(Application)) then begin
|
||||||
|
// create unique name
|
||||||
|
AComponent:=TComponent(Sender);
|
||||||
|
RCName:=AComponent.Name;
|
||||||
|
while (AComponent<>nil) do begin
|
||||||
|
AComponent:=TComponent(AComponent.Owner);
|
||||||
|
if (AComponent<>nil) and (AComponent.Name<>'') then
|
||||||
|
RCName:=AComponent.Name+'_'+RCName;
|
||||||
|
end;
|
||||||
|
gtk_widget_set_name(AWidget,PChar(RCName));
|
||||||
|
gtk_widget_set_rc_style(AWidget);
|
||||||
|
end;
|
||||||
|
if (Sender is TCustomForm)
|
||||||
|
and ((Application.MainForm=TCustomForm(Sender))
|
||||||
|
or (Application.MainForm=nil))
|
||||||
|
then
|
||||||
|
UpdateSysColorMap(AWidget);
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Assert(False, 'Trace:In CreateComponet');
|
Assert(False, 'Trace:In CreateComponet');
|
||||||
p := nil;
|
p := nil;
|
||||||
@ -3272,6 +3308,7 @@ begin
|
|||||||
if (Sender is TCommonDialog) then
|
if (Sender is TCommonDialog) then
|
||||||
TCommonDialog(Sender).Handle:= THandle(p);
|
TCommonDialog(Sender).Handle:= THandle(p);
|
||||||
|
|
||||||
|
Set_RC_Name(p);
|
||||||
|
|
||||||
StrDispose(StrTemp);
|
StrDispose(StrTemp);
|
||||||
if P <> nil then HookSignals(Sender);
|
if P <> nil then HookSignals(Sender);
|
||||||
@ -4216,6 +4253,36 @@ begin
|
|||||||
gdk_color_black(gdk_colormap_get_system, @Result^.GDIPenColor);
|
gdk_color_black(gdk_colormap_get_system, @Result^.GDIPenColor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Function: SetRCFilename
|
||||||
|
Params: const AValue: string
|
||||||
|
Returns: none
|
||||||
|
|
||||||
|
Sets the gtk resource file and parses it.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TgtkObject.SetRCFilename(const AValue: string);
|
||||||
|
begin
|
||||||
|
if FRCFilename=AValue then exit;
|
||||||
|
FRCFilename:=AValue;
|
||||||
|
ParseRCFile;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Function: ParseRCFile
|
||||||
|
Params: const AValue: string
|
||||||
|
Returns: none
|
||||||
|
|
||||||
|
Sets the gtk resource file and parses it.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TgtkObject.ParseRCFile;
|
||||||
|
begin
|
||||||
|
if (FRCFilename<>'') and FileExists(FRCFilename) and FRCFileParsed then
|
||||||
|
begin
|
||||||
|
gtk_rc_parse(PChar(FRCFilename));
|
||||||
|
FRCFileParsed:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: HashPaintMessage
|
Function: HashPaintMessage
|
||||||
Params: a PaintMessage in the Message queue (= PLazQueueItem)
|
Params: a PaintMessage in the Message queue (= PLazQueueItem)
|
||||||
@ -4445,6 +4512,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.128 2002/05/28 19:39:45 lazarus
|
||||||
|
MG: added gtk rc file support and started stule dependent syscolors
|
||||||
|
|
||||||
Revision 1.127 2002/05/28 14:58:31 lazarus
|
Revision 1.127 2002/05/28 14:58:31 lazarus
|
||||||
MG: added scrollbars for TListView
|
MG: added scrollbars for TListView
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user