Michael Van Canneyt wrote:

On Mon, 27 Mar 2006, darekm wrote:

Hi
 this patch enabled SetColor and SetFont property for tMemo

I think you forgot an attachment.

Of course, sorry.

Darek

ps. maybe this patch depend of my proper patch, then I send it once again.


Index: interfaces/gtk/gtkwsstdctrls.pp
===================================================================
--- interfaces/gtk/gtkwsstdctrls.pp     (wersja 9016)
+++ interfaces/gtk/gtkwsstdctrls.pp     (kopia robocza)
@@ -76,6 +76,7 @@
     class function  GetSelLength(const ACustomComboBox: TCustomComboBox): 
integer; override;
     class function  GetItemIndex(const ACustomComboBox: TCustomComboBox): 
integer; override;
     class function  GetMaxLength(const ACustomComboBox: TCustomComboBox): 
integer; override;
+    class function  GetText(const AWinControl: TWinControl; var AText: 
String): Boolean; override;
 
     class procedure SetArrowKeysTraverseList(const ACustomComboBox: 
TCustomComboBox; 
       NewTraverseList: boolean); override;
@@ -173,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;
 
@@ -614,10 +617,20 @@
   end;
 end;
 
+function TGtkWSCustomComboBox.GetText(const AWinControl: TWinControl; var 
AText: String): Boolean;
+begin
+//  DebugLn('TGtkWSCustomComboBox.Gettext ',DbgSName(ACustomComboBox),' 
',GetWidgetDebugReport(PGtkWidget(ACustomComboBox.Handle)));
+
+  Atext:=GetComboBoxText(PGtkCombo(AWinControl.handle));
+  result:=true;
+end;
+
 function TGtkWSCustomComboBox.GetItemIndex(
   const ACustomComboBox: TCustomComboBox): integer;
+var
+  CurText : string;
 begin
-  //DebugLn('TGtkWSCustomComboBox.GetItemIndex ',DbgSName(ACustomComboBox),' 
',DebugGtkWidgets.GetInfo(Pointer(ACustomComboBox.Handle),true));
+  //DebugLn('TGtkWSCustomComboBox.GetItemIndex ',DbgSName(ACustomComboBox),' 
',GetWidgetDebugReport(PGtkWidget(ACustomComboBox.Handle)));
   Result:=GetComboBoxItemIndex(ACustomComboBox);
 end;
 
@@ -708,7 +721,7 @@
   const ACustomComboBox: TCustomComboBox): TStrings;
 begin
   Result := TStrings(gtk_object_get_data(PGtkObject(ACustomComboBox.Handle),
-                                         'LCLList'));
+                                         GtkListItemLCLListTag));
 end;
 
 procedure TGtkWSCustomComboBox.Sort(const ACustomComboBox: TCustomComboBox;
@@ -998,6 +1011,40 @@
   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]);
+    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: include/speedbutton.inc
===================================================================
--- include/speedbutton.inc     (wersja 9016)
+++ 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: buttons.pp
===================================================================
--- buttons.pp  (wersja 9016)
+++ 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;
 

Reply via email to