mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 14:59:08 +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;
|
FMargin: integer;
|
||||||
FMouseInControl: Boolean;
|
FMouseInControl: Boolean;
|
||||||
FShortcut: Longint;
|
FShortcut: Longint;
|
||||||
|
FShowAccelChar: boolean;
|
||||||
FSpacing: integer;
|
FSpacing: integer;
|
||||||
FTransparent: Boolean;
|
FTransparent: Boolean;
|
||||||
function GetGlyph: TBitmap;
|
function GetGlyph: TBitmap;
|
||||||
@ -291,6 +292,7 @@ type
|
|||||||
procedure SetAllowAllUp(Value: Boolean);
|
procedure SetAllowAllUp(Value: Boolean);
|
||||||
procedure SetGlyph(Value: TBitmap);
|
procedure SetGlyph(Value: TBitmap);
|
||||||
procedure SetLayout(const Value: TButtonLayout);
|
procedure SetLayout(const Value: TButtonLayout);
|
||||||
|
procedure SetShowAccelChar(Value: boolean);
|
||||||
procedure SetTransparent(const Value: boolean);
|
procedure SetTransparent(const Value: boolean);
|
||||||
procedure CMButtonPressed(var Message: TLMessage); message CM_BUTTONPRESSED;
|
procedure CMButtonPressed(var Message: TLMessage); message CM_BUTTONPRESSED;
|
||||||
procedure MouseEnter; override;
|
procedure MouseEnter; override;
|
||||||
@ -334,6 +336,7 @@ type
|
|||||||
property Margin: integer read FMargin write SetMargin default -1;
|
property Margin: integer read FMargin write SetMargin default -1;
|
||||||
property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs default 1;
|
property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs default 1;
|
||||||
property Spacing: integer read FSpacing write SetSpacing default 4;
|
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;
|
property Transparent: Boolean read FTransparent write SetTransparent default true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ begin
|
|||||||
FAllowAllUp:= false;
|
FAllowAllUp:= false;
|
||||||
FMouseInControl := False;
|
FMouseInControl := False;
|
||||||
FDragging := False;
|
FDragging := False;
|
||||||
|
FShowAccelChar:=true;
|
||||||
FSpacing := 4;
|
FSpacing := 4;
|
||||||
FMargin := -1;
|
FMargin := -1;
|
||||||
FTransparent := true;
|
FTransparent := true;
|
||||||
@ -221,6 +222,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure TCustomSpeedButton.SetShowAccelChar(Value : Boolean);
|
||||||
|
begin
|
||||||
|
If FShowAccelChar <> Value then begin
|
||||||
|
FShowAccelChar := Value;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
procedure TCustomSpeedButton.RealSetText(const Value: TCaption);
|
procedure TCustomSpeedButton.RealSetText(const Value: TCaption);
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -429,7 +439,7 @@ begin
|
|||||||
TXTStyle := Canvas.TextStyle;
|
TXTStyle := Canvas.TextStyle;
|
||||||
TXTStyle.Opaque := False;
|
TXTStyle.Opaque := False;
|
||||||
TXTStyle.Clipping := True;
|
TXTStyle.Clipping := True;
|
||||||
TXTStyle.ShowPrefix := True;
|
TXTStyle.ShowPrefix := ShowAccelChar;
|
||||||
TXTStyle.Alignment := taLeftJustify;
|
TXTStyle.Alignment := taLeftJustify;
|
||||||
TXTStyle.Layout := tlTop;
|
TXTStyle.Layout := tlTop;
|
||||||
TXTStyle.SystemFont := Canvas.Font.IsDefault;//Match System Default Style
|
TXTStyle.SystemFont := Canvas.Font.IsDefault;//Match System Default Style
|
||||||
|
@ -174,6 +174,8 @@ type
|
|||||||
const NewScrollbars: TScrollStyle); override;
|
const NewScrollbars: TScrollStyle); override;
|
||||||
class procedure SetWordWrap(const ACustomMemo: TCustomMemo;
|
class procedure SetWordWrap(const ACustomMemo: TCustomMemo;
|
||||||
const NewWordWrap: boolean); override;
|
const NewWordWrap: boolean); override;
|
||||||
|
class procedure SetColor(const AWinControl: TWinControl); override;
|
||||||
|
class procedure SetFont(const AWinControl: TWinControl; const AFont : tFont); override;
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1007,6 +1009,39 @@ begin
|
|||||||
gtk_text_set_editable (GTK_TEXT(ImplWidget), not ACustomEdit.ReadOnly);
|
gtk_text_set_editable (GTK_TEXT(ImplWidget), not ACustomEdit.ReadOnly);
|
||||||
end;
|
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;
|
procedure TGtkWSCustomMemo.SetScrollbars(const ACustomMemo: TCustomMemo;
|
||||||
const NewScrollbars: TScrollStyle);
|
const NewScrollbars: TScrollStyle);
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user