1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
{ $Id: gtkwsextctrls.pp 41387 2013-05-24 18:30:06Z juha $}
{
*****************************************************************************
* GtkWSExtCtrls.pp *
* ---------------- *
* *
* *
*****************************************************************************
*****************************************************************************
This file is part of the Lazarus Component Library (LCL)
See the file COPYING.modifiedLGPL.txt, included in this distribution,
for details about the license.
*****************************************************************************
}
unit GtkWSExtCtrls;
{$mode objfpc}{$H+}
interface
uses
LCLProc, LCLType, LCLIntf, LMessages,
{$IFDEF GTK2}
gtk2, gdk2, gdk2PixBuf, glib2,
{$ELSE GTK2}
gtk, gdk, glib, gtk1WSPrivate, graphics,
{$ENDIF GTK2}
GtkExtra, GtkWsControls,
GtkGlobals, GtkProc, GtkDef, GtkInt,
SysUtils, Classes, Controls, ExtCtrls, Forms, Menus,
WSExtCtrls, WSLCLClasses, WSProc, InterfaceBase;
type
{ TGtkWSPage }
TGtkWSPage = class(TWSPage)
published
end;
{ TGtkWSNotebook }
TGtkWSNotebook = class(TWSNotebook)
published
end;
{ TGtkWSShape }
TGtkWSShape = class(TWSShape)
published
end;
{ TGtkWSCustomSplitter }
TGtkWSCustomSplitter = class(TWSCustomSplitter)
published
end;
{ TGtkWSSplitter }
TGtkWSSplitter = class(TWSSplitter)
published
end;
{ TGtkWSPaintBox }
TGtkWSPaintBox = class(TWSPaintBox)
published
end;
{ TGtkWSCustomImage }
TGtkWSCustomImage = class(TWSCustomImage)
published
end;
{ TGtkWSImage }
TGtkWSImage = class(TWSImage)
published
end;
{ TGtkWSBevel }
TGtkWSBevel = class(TWSBevel)
published
end;
{ TGtkWSCustomRadioGroup }
TGtkWSCustomRadioGroup = class(TWSCustomRadioGroup)
published
end;
{ TGtkWSRadioGroup }
TGtkWSRadioGroup = class(TWSRadioGroup)
published
end;
{ TGtkWSCustomCheckGroup }
TGtkWSCustomCheckGroup = class(TWSCustomCheckGroup)
published
end;
{ TGtkWSCheckGroup }
TGtkWSCheckGroup = class(TWSCheckGroup)
published
end;
{ TGtkWSCustomLabeledEdit }
TGtkWSCustomLabeledEdit = class(TWSCustomLabeledEdit)
published
end;
{ TGtkWSLabeledEdit }
TGtkWSLabeledEdit = class(TWSLabeledEdit)
published
end;
{ TGtkWSCustomPanel }
TGtkWSCustomPanel = class(TWSCustomPanel)
protected
class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
published
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
class procedure SetColor(const AWinControl: TWinControl); override;
end;
{ TGtkWSPanel }
TGtkWSPanel = class(TWSPanel)
published
end;
{ TGtkWSCustomTrayIcon }
{$IFDEF GTK1}
TGtkWSCustomTrayIcon = class(TWSCustomTrayIcon)
published
class function Hide(const ATrayIcon: TCustomTrayIcon): Boolean; override;
class function Show(const ATrayIcon: TCustomTrayIcon): Boolean; override;
class procedure InternalUpdate(const ATrayIcon: TCustomTrayIcon); override;
class function GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint; override;
class function GetCanvas(const ATrayIcon: TCustomTrayIcon): TCanvas; override;
end;
{$ENDIF}
implementation
{$IFDEF GTK1}
uses
x, xlib, xutil;
{$ENDIF}
class procedure TGtkWSCustomPanel.SetCallbacks(const AGtkWidget: PGtkWidget;
const AWidgetInfo: PWidgetInfo);
begin
TGtkWSWinControl.SetCallbacks(PGtkObject(AGtkWidget), TComponent(AWidgetInfo^.LCLObject));
end;
class function TGtkWSCustomPanel.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle;
var
Widget: PGtkWidget;
WidgetInfo: PWidgetInfo;
Allocation: TGTKAllocation;
begin
Widget := TGtkWidgetset(Widgetset).CreateAPIWidget(AWinControl);
{$IFDEF DebugLCLComponents}
DebugGtkWidgets.MarkCreated(Widget, dbgsName(AWinControl));
{$ENDIF}
Result := THandle(PtrUInt(Widget));
if Result = 0 then Exit;
WidgetInfo := GetWidgetInfo(Widget); // Widget info already created in CreateAPIWidget
WidgetInfo^.Style := AParams.Style;
WidgetInfo^.ExStyle := AParams.ExStyle;
WidgetInfo^.WndProc := PtrUInt(AParams.WindowClass.lpfnWndProc);
Include(WidgetInfo^.Flags, wwiNoEraseBkgnd);
// set allocation
Allocation.X := AParams.X;
Allocation.Y := AParams.Y;
Allocation.Width := AParams.Width;
Allocation.Height := AParams.Height;
gtk_widget_size_allocate(Widget, @Allocation);
Set_RC_Name(AWinControl, Widget);
SetCallbacks(Widget, WidgetInfo);
end;
class procedure TGtkWSCustomPanel.SetColor(const AWinControl: TWinControl);
var
MainWidget: PGtkWidget;
begin
if not AWinControl.HandleAllocated then exit;
MainWidget:=GetFixedWidget(pGtkWidget(AWinControl.handle));
if MainWidget<>nil then
GtkWidgetSet.SetWidgetColor(MainWidget,
AWinControl.font.color, AWinControl.color,
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,
GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
UpdateWidgetStyleOfControl(AWinControl);
end;
{$IFDEF GTK1}
{$include gtk1trayicon.inc}
{$ENDIF}
end.
|