mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 20:28:19 +02:00
added gtk TMemo font and color implmentation from Darek
git-svn-id: trunk@9077 -
This commit is contained in:
parent
7072bbe773
commit
0bf04077bf
@ -284,6 +284,7 @@ type
|
||||
FMargin: integer;
|
||||
FMouseInControl: Boolean;
|
||||
FShortcut: Longint;
|
||||
FShowAccelChar: boolean;
|
||||
FSpacing: integer;
|
||||
FTransparent: Boolean;
|
||||
function GetGlyph: TBitmap;
|
||||
@ -291,6 +292,7 @@ type
|
||||
procedure SetAllowAllUp(Value: Boolean);
|
||||
procedure SetGlyph(Value: TBitmap);
|
||||
procedure SetLayout(const Value: TButtonLayout);
|
||||
procedure SetShowAccelChar(Value: boolean);
|
||||
procedure SetTransparent(const Value: boolean);
|
||||
procedure CMButtonPressed(var Message: TLMessage); message CM_BUTTONPRESSED;
|
||||
procedure MouseEnter; override;
|
||||
@ -334,6 +336,7 @@ type
|
||||
property Margin: integer read FMargin write SetMargin default -1;
|
||||
property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs default 1;
|
||||
property Spacing: integer read FSpacing write SetSpacing default 4;
|
||||
property ShowAccelChar: boolean read FShowAccelChar write SetShowAccelChar default true;
|
||||
property Transparent: Boolean read FTransparent write SetTransparent default true;
|
||||
end;
|
||||
|
||||
|
@ -46,6 +46,7 @@ begin
|
||||
FAllowAllUp:= false;
|
||||
FMouseInControl := False;
|
||||
FDragging := False;
|
||||
FShowAccelChar:=true;
|
||||
FSpacing := 4;
|
||||
FMargin := -1;
|
||||
FTransparent := true;
|
||||
@ -221,6 +222,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
Procedure TCustomSpeedButton.SetShowAccelChar(Value : Boolean);
|
||||
begin
|
||||
If FShowAccelChar <> Value then begin
|
||||
FShowAccelChar := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TCustomSpeedButton.RealSetText(const Value: TCaption);
|
||||
------------------------------------------------------------------------------}
|
||||
@ -429,7 +439,7 @@ begin
|
||||
TXTStyle := Canvas.TextStyle;
|
||||
TXTStyle.Opaque := False;
|
||||
TXTStyle.Clipping := True;
|
||||
TXTStyle.ShowPrefix := True;
|
||||
TXTStyle.ShowPrefix := ShowAccelChar;
|
||||
TXTStyle.Alignment := taLeftJustify;
|
||||
TXTStyle.Layout := tlTop;
|
||||
TXTStyle.SystemFont := Canvas.Font.IsDefault;//Match System Default Style
|
||||
|
@ -174,6 +174,8 @@ type
|
||||
const NewScrollbars: TScrollStyle); override;
|
||||
class procedure SetWordWrap(const ACustomMemo: TCustomMemo;
|
||||
const NewWordWrap: boolean); override;
|
||||
class procedure SetColor(const AWinControl: TWinControl); override;
|
||||
class procedure SetFont(const AWinControl: TWinControl; const AFont : tFont); override;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
@ -1007,6 +1009,39 @@ begin
|
||||
gtk_text_set_editable (GTK_TEXT(ImplWidget), not ACustomEdit.ReadOnly);
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomMemo.SetColor(const AWinControl: TWinControl);
|
||||
var
|
||||
aWidget : PGTKWidget;
|
||||
begin
|
||||
if not AWinControl.HandleAllocated then exit;
|
||||
AWidget:=PGtkWidget(AWinControl.Handle);
|
||||
AWidget:= GetWidgetInfo(AWidget, true)^.CoreWidget;
|
||||
GtkWidgetSet.SetWidgetColor(AWidget, clNone, AWinControl.color,
|
||||
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED,
|
||||
GTK_STYLE_BASE]);
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomMemo.SetFont(const AWinControl: TWinControl;
|
||||
const AFont : TFont);
|
||||
var
|
||||
AWidget: PGTKWidget;
|
||||
begin
|
||||
if not AWinControl.HandleAllocated then exit;
|
||||
if AFont.IsDefault then exit;
|
||||
|
||||
AWidget:= PGtkWidget(AWinControl.Handle);
|
||||
AWidget:= GetWidgetInfo(AWidget, true)^.CoreWidget;
|
||||
|
||||
if AWidget<>nil then begin
|
||||
// GtkWidgetSet.SetWidgetColor(AWidget, AWinControl.font.color, clNone,
|
||||
// [GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
|
||||
GtkWidgetSet.SetWidgetColor(AWidget, AWinControl.font.color, clNone,
|
||||
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED,
|
||||
GTK_STYLE_TEXT]);
|
||||
GtkWidgetSet.SetWidgetFont(AWidget, AFont);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomMemo.SetScrollbars(const ACustomMemo: TCustomMemo;
|
||||
const NewScrollbars: TScrollStyle);
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user