Gtk2: gtk2WSFactory: register TCustomPanel, also fixed default text color for TPanel.

git-svn-id: trunk@29490 -
This commit is contained in:
zeljko 2011-02-12 19:36:22 +00:00
parent bdd4e15f32
commit be8772f584
2 changed files with 14 additions and 4 deletions

View File

@ -34,7 +34,7 @@ uses
// libs // libs
Math, GLib2, Gtk2, Gdk2, Gdk2Pixbuf, Gtk2Int, Gtk2Def, {$ifdef UseStatusIcon}Gtk2Ext, {$endif} Math, GLib2, Gtk2, Gdk2, Gdk2Pixbuf, Gtk2Int, Gtk2Def, {$ifdef UseStatusIcon}Gtk2Ext, {$endif}
// LCL // LCL
LCLProc, ExtCtrls, Classes, Controls, SysUtils, LCLType, LMessages, LCLProc, ExtCtrls, Classes, Controls, SysUtils, Graphics, LCLType, LMessages,
// widgetset // widgetset
WSExtCtrls, WSLCLClasses, WSProc, WSExtCtrls, WSLCLClasses, WSProc,
Gtk2WSControls, Gtk2WSPrivate, Gtk2Proc, Gtk2Globals; Gtk2WSControls, Gtk2WSPrivate, Gtk2Proc, Gtk2Globals;
@ -191,6 +191,7 @@ type
class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual; class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
published published
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override; class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
class procedure SetColor(const AWinControl: TWinControl); override; class procedure SetColor(const AWinControl: TWinControl); override;
end; end;
@ -778,7 +779,6 @@ begin
WidgetInfo^.Style := AParams.Style; WidgetInfo^.Style := AParams.Style;
WidgetInfo^.ExStyle := AParams.ExStyle; WidgetInfo^.ExStyle := AParams.ExStyle;
WidgetInfo^.WndProc := PtrUInt(AParams.WindowClass.lpfnWndProc); WidgetInfo^.WndProc := PtrUInt(AParams.WindowClass.lpfnWndProc);
Include(WidgetInfo^.Flags, wwiNoEraseBkgnd);
// set allocation // set allocation
Allocation.X := AParams.X; Allocation.X := AParams.X;
@ -791,15 +791,25 @@ begin
SetCallbacks(Widget, WidgetInfo); SetCallbacks(Widget, WidgetInfo);
end; end;
class function TGtk2WSCustomPanel.GetDefaultColor(const AControl: TControl;
const ADefaultColorType: TDefaultColorType): TColor;
begin
if ADefaultColorType = dctFont then
Result := clWindowText
else
Result := clDefault;
end;
class procedure TGtk2WSCustomPanel.SetColor(const AWinControl: TWinControl); class procedure TGtk2WSCustomPanel.SetColor(const AWinControl: TWinControl);
var var
MainWidget: PGtkWidget; MainWidget: PGtkWidget;
FontColor, BGColor: TColor;
begin begin
if not AWinControl.HandleAllocated then exit; if not AWinControl.HandleAllocated then exit;
MainWidget:=GetFixedWidget(pGtkWidget(AWinControl.handle)); MainWidget:=GetFixedWidget(pGtkWidget(AWinControl.handle));
if MainWidget<>nil then if MainWidget<>nil then
Gtk2WidgetSet.SetWidgetColor(MainWidget, Gtk2WidgetSet.SetWidgetColor(MainWidget,
AWinControl.font.color, AWinControl.color, AWinControl.Font.Color, AWinControl.Color,
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE, [GTK_STATE_NORMAL,GTK_STATE_ACTIVE,
GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]); GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);

View File

@ -441,7 +441,7 @@ end;
function RegisterCustomPanel: Boolean; alias : 'WSRegisterCustomPanel'; function RegisterCustomPanel: Boolean; alias : 'WSRegisterCustomPanel';
begin begin
// RegisterWSComponent(TCustomPanel, TGtk2WSCustomPanel); RegisterWSComponent(TCustomPanel, TGtk2WSCustomPanel);
// RegisterWSComponent(TPanel, TGtk2WSPanel); // RegisterWSComponent(TPanel, TGtk2WSPanel);
Result := False; Result := False;
end; end;