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

View File

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