Hi
attached patch has:
setColor and setFont for tMemo
ShowAccelChar to tSpeedButton
some improvements for tLabel
Darek
Index: interfaces/gtk/gtkwsstdctrls.pp
===================================================================
--- interfaces/gtk/gtkwsstdctrls.pp (wersja 9056)
+++ interfaces/gtk/gtkwsstdctrls.pp (kopia robocza)
@@ -174,6 +174,8 @@
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,38 @@
gtk_text_set_editable (GTK_TEXT(ImplWidget), not ACustomEdit.ReadOnly);
end;
+procedure TGtkWSCustomMemo.SetColor(const AWinControl: TWinControl);
+var
+ aWidget : PGTKWidget;
+begin
+ 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,
+ mWidget : 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,GTK_STYLE_TEXT]);
+ GtkWidgetSet.SetWidgetFont(AWidget, AFont);
+ end;
+end;
+
+
+
procedure TGtkWSCustomMemo.SetScrollbars(const ACustomMemo: TCustomMemo;
const NewScrollbars: TScrollStyle);
var
Index: interfaces/gtk/gtkwinapi.inc
===================================================================
--- interfaces/gtk/gtkwinapi.inc (wersja 9056)
+++ interfaces/gtk/gtkwinapi.inc (kopia robocza)
@@ -2782,7 +2782,10 @@
If (Flags and DT_SingleLine) > 0 then begin
// ignore word and line breaks
GetTextExtentPoint(DC, Str, Count, AP);
- theRect.Right := theRect.Left + Min(MaxLength, AP.cX);
+ if (Flags and DT_CalcRect)<>0 then
+ theRect.Right := theRect.Left + AP.cX
+ else
+ theRect.Right := theRect.Left + Min(MaxLength, AP.cX);
theRect.Bottom := theRect.Top + TM.tmHeight;
end
else begin
@@ -2825,6 +2828,34 @@
end;
end;
+ Procedure DrawLineRaw(theLine : PChar; LineLength, TopPos : Longint);
+ var
+ Points : Array[0..1] of TSize;
+ LeftPos : Longint;
+ begin
+ If LeftOffset <> DT_Left then
+ GetTextExtentPoint(DC, theLine, LineLength, Points[0]);
+
+ If TempBrush = -1 then
+ TempBrush := SelectObject(DC, GetStockObject(NULL_BRUSH));
+ Case LeftOffset of
+ DT_Left:
+ LeftPos := theRect.Left;
+ DT_Center:
+ LeftPos := theRect.Left + (theRect.Right - theRect.Left) div 2
+ - Points[0].cX div 2;
+ DT_Right:
+ LeftPos := theRect.Right - Points[0].cX;
+ end;
+
+ {Draw line of Text}
+ TextUtf8Out(DC, LeftPos, TopPos, theLine, lineLength);
+ end;
+
+
+
+
+
Procedure DrawLine(theLine : PChar; LineLength, TopPos : Longint);
var
Points : Array[0..1] of TSize;
@@ -2905,6 +2936,12 @@
TempPen := -1;
TempBrush := -1;
try
+ if (Flags and
(DT_SingleLine+DT_CalcRect+Dt_NoPrefix+DT_NOClip))=(DT_SingleLine+Dt_NoPrefix+Dt_NoClip)
then begin
+ CopyRect(theRect, Rect);
+ DrawLineRaw(Str, Count, Rect.Top);
+ exit;
+ end;
+
Count := Min(StrLen(Str), Count);
GetTextMetrics(DC, TM);
Index: interfaces/gtk/gtkwscontrols.pp
===================================================================
--- interfaces/gtk/gtkwscontrols.pp (wersja 9056)
+++ interfaces/gtk/gtkwscontrols.pp (kopia robocza)
@@ -659,8 +659,9 @@
if ModalWindows=nil then ModalWindows:=TFPList.Create;
ModalWindows.Add(GtkWindow);
-
+ {$IFDEF gtk_no_set_modal}
gtk_window_set_modal(GtkWindow, true);
+ {$ENDIF}
gtk_widget_show(PGtkWidget(GtkWindow));
{$IFDEF Gtk1}
GDK_WINDOW_ACTIVATE(PGdkWindowPrivate(PGtkWidget(GtkWindow)^.window));
Index: include/speedbutton.inc
===================================================================
--- include/speedbutton.inc (wersja 9056)
+++ include/speedbutton.inc (kopia robocza)
@@ -46,6 +46,7 @@
FAllowAllUp:= false;
FMouseInControl := False;
FDragging := False;
+ FShowAccelChar:=true;
FSpacing := 4;
FMargin := -1;
FTransparent := true;
@@ -221,6 +222,15 @@
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 @@
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
Index: include/canvas.inc
===================================================================
--- include/canvas.inc (wersja 9056)
+++ include/canvas.inc (kopia robocza)
@@ -1022,7 +1022,7 @@
SetTextColor(Self.Handle, Font.Color);
//debugln('TCanvas.TextRect DRAW Text="',Text,'" ',dbgs(fRect));
DrawText(Self.Handle, pChar(Text), Length(Text), fRect, Options);
-
+
if Style.Clipping then begin
if DCIndex <> -1 then
RestoreDC(Self.Handle, DCIndex);
Index: include/customlabel.inc
===================================================================
--- include/customlabel.inc (wersja 9056)
+++ include/customlabel.inc (kopia robocza)
@@ -153,8 +153,7 @@
inherited Create(TheOwner);
Font.OnChange := @FontChange;
ControlStyle := [csSetCaption, csClickEvents, csDoubleClicks,
csReplicatable];
- Width := 65;
- Height := 17;
+ setbounds(0,0,65,17);
FShowAccelChar := True;
Color := clNone;
AutoSize:=true;
Index: include/customcombobox.inc
===================================================================
--- include/customcombobox.inc (wersja 9056)
+++ include/customcombobox.inc (kopia robocza)
@@ -753,7 +753,7 @@
------------------------------------------------------------------------------}
function TCustomComboBox.GetItemIndex : integer;
begin
- if not (csDestroying in ComponentState){and not (csDestroyingHandle in
ControlState) } and HandleAllocated then
+ if not (csDestroying in ComponentState) and not (csDestroyingHandle in
ControlState) and HandleAllocated then
FItemIndex:= TWSCustomComboBoxClass(WidgetSetClass).GetItemIndex(Self);
Result:=FItemIndex;
end;
Index: buttons.pp
===================================================================
--- buttons.pp (wersja 9056)
+++ buttons.pp (kopia robocza)
@@ -284,6 +284,7 @@
FMargin: integer;
FMouseInControl: Boolean;
FShortcut: Longint;
+ FShowAccelChar: boolean;
FSpacing: integer;
FTransparent: Boolean;
function GetGlyph: TBitmap;
@@ -291,6 +292,7 @@
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 @@
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;
@@ -359,6 +362,7 @@
property Margin;
property NumGlyphs;
property Spacing;
+ property ShowAccelChar;
property Transparent;
property Visible;
property OnClick;