PageRenderTime 105ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 2ms

/packages/fpgtk/src/fpgtk.pp

https://github.com/slibre/freepascal
Puppet | 12085 lines | 10076 code | 2009 blank | 0 comment | 182 complexity | b337937eb034893336e893d80f99a453 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1. {$mode objfpc}{$h+} {$ifdef win32}{$define gtkwin}{$endif}
  2. UNIT FPgtk;
  3. // Generated with GtkWrite by Luk Vandelaer (version 1.08)
  4. INTERFACE
  5. USES classes, sysutils, gtk, gdk, glib, FPglib;
  6. TYPE
  7. TFPgtkObject = class;
  8. TFPgtkData = class;
  9. TFPgtkAdjustment = class;
  10. TFPgtkToolTips = class;
  11. TFPgtkWidget = class;
  12. TFPgtkGroup = class;
  13. TFPgtkWidgetGroup = class;
  14. TFPgtkMisc = class;
  15. TFPgtkLabel = class;
  16. TFPgtkAccelLabel = class;
  17. TFPgtkTipsQuery = class;
  18. TFPgtkArrow = class;
  19. TFPgtkImage = class;
  20. TFPgtkPixmap = class;
  21. TFPgtkContainer = class;
  22. TFPgtkBin = class;
  23. TFPgtkAlignment = class;
  24. TFPgtkFrame = class;
  25. TFPgtkAspectFrame = class;
  26. TFPgtkButton = class;
  27. TFPgtkToggleButton = class;
  28. TFPgtkCheckButton = class;
  29. TFPgtkRadioButton = class;
  30. TFPgtkRadioButtonGroup = class;
  31. TFPgtkOptionMenu = class;
  32. TFPgtkItem = class;
  33. TFPgtkItemGroup = class;
  34. TFPgtkMenuItem = class;
  35. TFPgtkCheckMenuItem = class;
  36. TFPgtkRadioMenuItem = class;
  37. TFPgtkRadioMenuGroup = class;
  38. TFPgtkTearOffMenuItem = class;
  39. TFPgtkListItem = class;
  40. TFPgtkListItemGroup = class;
  41. TFPgtkTreeItem = class;
  42. TFPgtkWindow = class;
  43. TFPgtkColorSelectionDialog = class;
  44. TFPgtkDialog = class;
  45. TFPgtkInputDialog = class;
  46. TFPgtkFileSelection = class;
  47. TFPgtkFontSelectionDialog = class;
  48. TFPgtkEventBox = class;
  49. TFPgtkHandleBox = class;
  50. TFPgtkScrolledWindow = class;
  51. TFPgtkViewport = class;
  52. TFPgtkBox = class;
  53. TFPgtkButtonBox = class;
  54. TFPgtkHButtonBox = class;
  55. TFPgtkVButtonBox = class;
  56. TFPgtkVBox = class;
  57. TFPgtkColorSelection = class;
  58. TFPgtkGammaCurve = class;
  59. TFPgtkHBox = class;
  60. TFPgtkCombo = class;
  61. TFPgtkStatusbar = class;
  62. TFPgtkCList = class;
  63. TFPgtkCTree = class;
  64. TFPgtkFixed = class;
  65. TFPgtkNotebook = class;
  66. TFPgtkFontSelection = class;
  67. TFPgtkPaned = class;
  68. TFPgtkHPaned = class;
  69. TFPgtkVPaned = class;
  70. TFPgtkLayout = class;
  71. TFPgtkList = class;
  72. TFPgtkMenuShell = class;
  73. TFPgtkMenuBar = class;
  74. TFPgtkMenu = class;
  75. TFPgtkPacker = class;
  76. TFPgtkTable = class;
  77. TFPgtkToolbar = class;
  78. TFPgtkTree = class;
  79. TFPgtkCalendar = class;
  80. TFPgtkDrawingArea = class;
  81. TFPgtkCurve = class;
  82. TFPgtkEditable = class;
  83. TFPgtkEntry = class;
  84. TFPgtkSpinButton = class;
  85. TFPgtkText = class;
  86. TFPgtkRuler = class;
  87. TFPgtkHRuler = class;
  88. TFPgtkVRuler = class;
  89. TFPgtkRange = class;
  90. TFPgtkScale = class;
  91. TFPgtkHScale = class;
  92. TFPgtkVScale = class;
  93. TFPgtkScrollbar = class;
  94. TFPgtkHScrollbar = class;
  95. TFPgtkVScrollbar = class;
  96. TFPgtkSeparator = class;
  97. TFPgtkHSeparator = class;
  98. TFPgtkVSeparator = class;
  99. TFPgtkPreview = class;
  100. TFPgtkProgress = class;
  101. TFPgtkProgressBar = class;
  102. TFPgtkItemFactory = class;
  103. TFPgtkSignalFunction = procedure (Sender:TFPgtkObject; Data:pointer) of Object;
  104. TFPgtkBooleanSignalFunction = procedure (Sender:TFPgtkObject; Bool:boolean; data:pointer) of Object;
  105. FPgtkException = class (Exception) end;
  106. PPascalClassData = ^TPascalClassData;
  107. TPascalClassData = record
  108. TheInstance : TFPgtkObject;
  109. end;
  110. PSignalData = ^TSignalData;
  111. TSignalData = record
  112. TheData : pointer;
  113. TheWidget : TFPgtkObject;
  114. TheSignalProc : TFPgtkSignalFunction;
  115. end;
  116. TDestroyState = (dsAlive, dsWaiting, dsDestroying);
  117. TFPgtkObjectClass = Class of TFPgtkObject;
  118. PFPgtkObject = ^TFPgtkObject;
  119. TFPgtkObject = class
  120. Private
  121. FDestroying : TDestroyState;
  122. PascalInstance:TPascalClassData;
  123. ConvertDatas:TStringList;
  124. SignalDatas:TList;
  125. NotifyList:TList;
  126. function ConvertSignalData (proc:TFPgtkSignalFunction; data:pointer; FreeIt:boolean) : PSignalData;
  127. procedure FreeClass (Sender:TFPgtkObject; Data:pointer);
  128. procedure CheckConvertDatas;
  129. procedure CheckNotifyList;
  130. procedure InitCreate;
  131. procedure FinalCreate;
  132. function GetUserData : pointer;
  133. procedure SetUserData (TheValue : pointer);
  134. Protected
  135. FGtkObject:PGtkObject;
  136. procedure CreateGtkObject; Virtual; Abstract;
  137. procedure NotifyDestroy (AnObject:TFPgtkObject); Virtual;
  138. Public
  139. function TheGtkObject : PGtkObject;
  140. function SignalConnect (Signal:string; Proc:TFPgtkSignalFunction; data:pointer) : guint;
  141. function SignalConnectAfter (Signal:string; Proc:TFPgtkSignalFunction; data:pointer) : guint;
  142. function BooleanSignalConnect (Signal:string; Proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  143. function BooleanSignalConnectAfter (Signal:string; Proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  144. constructor Create;
  145. constructor CreateFromObject (GtkObject:PGtkObject);
  146. property Destroying : TDestroyState read FDestroying;
  147. procedure AskNotification (AnObject:TFPgtkObject);
  148. destructor Destroy; Override;
  149. function ConnectDestroy (proc:TFPgtkSignalFunction; data:pointer) : guint;
  150. function ConnectAfterDestroy (proc:TFPgtkSignalFunction; data:pointer) : guint;
  151. procedure SignalDisconnect (SignalHandler:guint);
  152. procedure SignalBlockHandler (SignalHandler:guint);
  153. procedure SignalUnblockHandler (SignalHandler:guint);
  154. procedure SignalEmit (aName:string; Args:array of const);
  155. function SignalNEmissions (aName:string) : guint;
  156. procedure SignalEmitStop (aName:string);
  157. procedure SetData (Key:string; Data:pointer);
  158. property UserData : pointer read GetUserData write SetUserData;
  159. procedure SetDataFull (Key:string; Data:pointer; Destroyer:TFPgtkSignalFunction);
  160. procedure RemoveData (Key:string);
  161. function GetData (Key:string) : pointer;
  162. function GtkDestroyed : boolean;
  163. procedure Constructed;
  164. procedure ConstructedDefault;
  165. procedure Sink;
  166. procedure Ref;
  167. procedure Unref;
  168. procedure WeakRef (Notify:TFPgtkSignalFunction; data:pointer);
  169. procedure WeakUnref (notify:TFPgtkSignalFunction; data:pointer);
  170. end;
  171. TFPgtkData = class (TFPgtkObject)
  172. Public
  173. function TheGtkObject : PGtkData;
  174. function ConnectDisconnect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  175. function ConnectAfterDisconnect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  176. end;
  177. TFPgtkAdjustment = class (TFPgtkData)
  178. Private
  179. function GetValue : gfloat;
  180. procedure SetValue (TheValue : gfloat);
  181. function GetLower : gfloat;
  182. procedure SetLower (TheValue : gfloat);
  183. function GetUpper : gfloat;
  184. procedure SetUpper (TheValue : gfloat);
  185. function GetStepIncrement : gfloat;
  186. procedure SetStepIncrement (TheValue : gfloat);
  187. function GetPageIncrement : gfloat;
  188. procedure SetPageIncrement (TheValue : gfloat);
  189. function GetPageSize : gfloat;
  190. procedure SetPageSize (TheValue : gfloat);
  191. Protected
  192. procedure CreateGtkObject; override;
  193. Public
  194. function TheGtkObject : PGtkAdjustment;
  195. procedure Configure (aLower:gfloat; anUpper:gfloat; aValue:gfloat; aStepInc:gfloat; aPageInc:gfloat; aPageSize:gfloat);
  196. function ConnectValueChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  197. function ConnectAfterValueChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  198. function ConnectChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  199. function ConnectAfterChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  200. procedure ValueChanged;
  201. procedure Changed;
  202. procedure ClampPage (aLower:gfloat; aUpper:gfloat);
  203. property Value : gfloat read GetValue write SetValue;
  204. property Lower : gfloat read GetLower write SetLower;
  205. property Upper : gfloat read GetUpper write SetUpper;
  206. property StepIncrement : gfloat read GetStepIncrement write SetStepIncrement;
  207. property PageIncrement : gfloat read GetPageIncrement write SetPageIncrement;
  208. property PageSize : gfloat read GetPageSize write SetPageSize;
  209. end;
  210. TFPgtkToolTips = class (TFPgtkData)
  211. Private
  212. function GetEnabled : boolean;
  213. procedure SetEnabled (TheValue : boolean);
  214. function GetDelay : integer;
  215. procedure SetDelay (TheValue : integer);
  216. function GetColorForeground : PGdkColor;
  217. procedure SetColorForeground (TheValue : PGdkColor);
  218. function GetColorBackground : PGdkColor;
  219. procedure SetColorBackground (TheValue : PGdkColor);
  220. Protected
  221. procedure CreateGtkObject; override;
  222. Public
  223. function TheGtkObject : PGtkToolTips;
  224. procedure SetColors (Fore:PGdkColor; Back:PGdkColor);
  225. procedure SetTip (Widget:TFPgtkWidget; TipText:string; TipPrivate:string);
  226. property Enabled : boolean read GetEnabled write SetEnabled;
  227. property Delay : integer read GetDelay write SetDelay;
  228. property ColorForeground : PGdkColor read GetColorForeground write SetColorForeground;
  229. property ColorBackground : PGdkColor read GetColorBackground write SetColorBackground;
  230. procedure ForceWindow;
  231. end;
  232. TFPgtkWidgetSignalFunction = procedure (Sender:TFPgtkObject; Widget:TFPgtkWidget; Data:pointer) of Object;
  233. TFPgtkEventFunction = function (Sender:TFPgtkWidget; Event:PGdkEvent; data:pointer): boolean of Object;
  234. TFPgtkEventButtonFunction = function (Sender:TFPgtkWidget; Event:PGdkEventButton; data:pointer): boolean of Object;
  235. TFPgtkEventMotionFunction = function (Sender:TFPgtkWidget; Event:PGdkEventMotion; data:pointer): boolean of Object;
  236. TFPgtkEventExposeFunction = function (Sender:TFPgtkWidget; Event:PGdkEventExpose; data:pointer): boolean of Object;
  237. TFPgtkEventKeyFunction = function (Sender:TFPgtkWidget; Event:PGdkEventKey; data:pointer): boolean of Object;
  238. TFPgtkEventCrossingFunction = function (Sender:TFPgtkWidget; Event:PGdkEventCrossing; data:pointer): boolean of Object;
  239. TFPgtkEventConfigureFunction = function (Sender:TFPgtkWidget; Event:PGdkEventConfigure; data:pointer): boolean of Object;
  240. TFPgtkEventFocusFunction = function (Sender:TFPgtkWidget; Event:PGdkEventFocus; data:pointer): boolean of Object;
  241. TFPgtkEventPropertyFunction = function (Sender:TFPgtkWidget; Event:PGdkEventProperty; data:pointer): boolean of Object;
  242. TFPgtkEventSelectionFunction = function (Sender:TFPgtkWidget; Event:PGdkEventSelection; data:pointer): boolean of Object;
  243. TFPgtkEventProximityFunction = function (Sender:TFPgtkWidget; Event:PGdkEventProximity; data:pointer): boolean of Object;
  244. TFPgtkEventClientFunction = function (Sender:TFPgtkWidget; Event:PGdkEventClient; data:pointer): boolean of Object;
  245. TFPgtkEventNoExposeFunction = function (Sender:TFPgtkWidget; Event:PGdkEventNoExpose; data:pointer): boolean of Object;
  246. TFPgtkWidget = class (TFPgtkObject)
  247. Private
  248. function GetTheGtkWidget : PGtkWidget;
  249. procedure SetTheGtkWidget (TheValue : PGtkWidget);
  250. function GetAllocation : TGtkAllocation;
  251. function GetName : string;
  252. procedure SetName (TheValue : string);
  253. function GetPropFlags : longint;
  254. procedure SetPropFlags (TheValue : longint);
  255. function GetState : longint;
  256. function GetSavedState : longint;
  257. function GetParent : TFPgtkWidget;
  258. procedure SetParent (TheValue : TFPgtkWidget);
  259. function GetParentWindow : PGdkWindow;
  260. procedure SetParentWindow (TheValue : PGdkWindow);
  261. procedure Reparent (NewParent:TFPgtkWidget);
  262. function GetVisible : boolean;
  263. procedure SetVisible (TheValue : boolean);
  264. function GetNoWindow : boolean;
  265. procedure SetNoWindow (TheValue : boolean);
  266. function GetRealized : boolean;
  267. procedure SetRealized (TheValue : boolean);
  268. function GetMapped : boolean;
  269. procedure SetMapped (TheValue : boolean);
  270. function GetDrawable : boolean;
  271. function GetIsSensitive : boolean;
  272. function GetSensitive : boolean;
  273. procedure SetSensitive (TheValue : boolean);
  274. function GetParentSensitive : boolean;
  275. procedure SetParentSensitive (TheValue : boolean);
  276. function GetAppPaintable : boolean;
  277. function GetCanFocus : boolean;
  278. procedure SetCanFocus (TheValue : boolean);
  279. function GetHasFocus : boolean;
  280. function GetCanDefault : boolean;
  281. procedure SetCanDefault (TheValue : boolean);
  282. function GetHasDefault : boolean;
  283. function GetReceivesDefault : boolean;
  284. function GetCompositeChild : boolean;
  285. function GetTooltip : string;
  286. procedure SetTooltip (TheValue : string);
  287. function GetColormap : PGdkColormap;
  288. procedure SetColormap (TheValue : PGdkColormap);
  289. Protected
  290. procedure SetFlags (NewFlags:longint);
  291. procedure UnsetFlags (NewUnsetFlags:longint);
  292. procedure Map;
  293. procedure Unmap;
  294. procedure QueueDraw;
  295. procedure QueueResize;
  296. procedure DrawFocus;
  297. procedure DrawDefault;
  298. Public
  299. function TheGtkObject : PGtkWidget;
  300. property TheGtkWidget : PGtkWidget read GetTheGtkWidget write SetTheGtkWidget;
  301. function WidgetSignalConnect (Signal:string; Proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  302. function WidgetSignalConnectAfter (Signal:string; Proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  303. procedure Draw (Rectangle:PGdkRectangle); Overload;
  304. procedure Show;
  305. procedure Hide;
  306. procedure Realize;
  307. procedure Unrealize;
  308. procedure ShowNow;
  309. procedure ShowAll;
  310. procedure HideAll;
  311. procedure SetAllocation (AnAllocation:TGtkAllocation); Overload;
  312. procedure SetAllocation (x:integer; y:integer; width:integer; height:integer); Overload;
  313. property Allocation : TGtkAllocation read GetAllocation write SetAllocation;
  314. procedure SetUPosition (x:integer; y:integer);
  315. procedure SetUsize (width:integer; height:integer);
  316. property Name : string read GetName write SetName;
  317. property Flags : longint read GetPropFlags write SetPropFlags;
  318. property State : longint read GetState;
  319. property SavedState : longint read GetSavedState;
  320. property Parent : TFPgtkWidget read GetParent write SetParent;
  321. property ParentWindow : PGdkWindow read GetParentWindow write SetParentWindow;
  322. procedure Unparent;
  323. property Visible : boolean read GetVisible write SetVisible;
  324. property NoWindow : boolean read GetNoWindow write SetNoWindow;
  325. property Realized : boolean read GetRealized write SetRealized;
  326. property Mapped : boolean read GetMapped write SetMapped;
  327. property Drawable : boolean read GetDrawable;
  328. property IsSensitive : boolean read GetIsSensitive;
  329. property Sensitive : boolean read GetSensitive write SetSensitive;
  330. property ParentSensitive : boolean read GetParentSensitive write SetParentSensitive;
  331. property AppPaintable : boolean read GetAppPaintable;
  332. property CanFocus : boolean read GetCanFocus write SetCanFocus;
  333. procedure GrabFocus;
  334. property HasFocus : boolean read GetHasFocus;
  335. property CanDefault : boolean read GetCanDefault write SetCanDefault;
  336. procedure GrabDefault;
  337. property HasDefault : boolean read GetHasDefault;
  338. property ReceivesDefault : boolean read GetReceivesDefault;
  339. property CompositeChild : boolean read GetCompositeChild;
  340. property Tooltip : string read GetTooltip write SetTooltip;
  341. procedure HideOnDelete;
  342. property Colormap : PGdkColormap read GetColormap write SetColormap;
  343. function ConnectShow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  344. function ConnectAfterShow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  345. function Connecthide (proc:TFPgtkSignalFunction; data:pointer) : guint;
  346. function ConnectAfterhide (proc:TFPgtkSignalFunction; data:pointer) : guint;
  347. function Connectmap (proc:TFPgtkSignalFunction; data:pointer) : guint;
  348. function ConnectAftermap (proc:TFPgtkSignalFunction; data:pointer) : guint;
  349. function Connectunmap (proc:TFPgtkSignalFunction; data:pointer) : guint;
  350. function ConnectAfterunmap (proc:TFPgtkSignalFunction; data:pointer) : guint;
  351. function Connectrealize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  352. function ConnectAfterrealize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  353. function Connectunrealize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  354. function ConnectAfterunrealize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  355. function ConnectDrawFocus (proc:TFPgtkSignalFunction; data:pointer) : guint;
  356. function ConnectAfterDrawFocus (proc:TFPgtkSignalFunction; data:pointer) : guint;
  357. function ConnectDrawDefault (proc:TFPgtkSignalFunction; data:pointer) : guint;
  358. function ConnectAfterDrawDefault (proc:TFPgtkSignalFunction; data:pointer) : guint;
  359. function ConnectParentSet (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  360. function ConnectAfterParentSet (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  361. function ConnectGrabFocus (proc:TFPgtkSignalFunction; data:pointer) : guint;
  362. function ConnectAfterGrabFocus (proc:TFPgtkSignalFunction; data:pointer) : guint;
  363. function EventConnect (Signal:string; Proc:TFPgtkEventFunction; data:pointer) : guint;
  364. function EventConnectAfter (Signal:string; Proc:TFPgtkEventFunction; data:pointer) : guint;
  365. function ConnectEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  366. function ConnectAfterEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  367. function EventButtonConnect (Signal:string; Proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  368. function EventButtonConnectAfter (Signal:string; Proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  369. function ConnectButtonPressEvent (proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  370. function ConnectAfterButtonPressEvent (proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  371. function ConnectButtonReleaseEvent (proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  372. function ConnectAfterButtonReleaseEvent (proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  373. function EventMotionConnect (Signal:string; Proc:TFPgtkEventMotionFunction; data:pointer) : guint;
  374. function EventMotionConnectAfter (Signal:string; Proc:TFPgtkEventMotionFunction; data:pointer) : guint;
  375. function ConnectMotionNotifyEvent (proc:TFPgtkEventMotionFunction; data:pointer) : guint;
  376. function ConnectAfterMotionNotifyEvent (proc:TFPgtkEventMotionFunction; data:pointer) : guint;
  377. function ConnectDeleteEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  378. function ConnectAfterDeleteEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  379. function ConnectDestroyEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  380. function ConnectAfterDestroyEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  381. function EventExposeConnect (Signal:string; Proc:TFPgtkEventExposeFunction; data:pointer) : guint;
  382. function EventExposeConnectAfter (Signal:string; Proc:TFPgtkEventExposeFunction; data:pointer) : guint;
  383. function ConnectExposeEvent (proc:TFPgtkEventExposeFunction; data:pointer) : guint;
  384. function ConnectAfterExposeEvent (proc:TFPgtkEventExposeFunction; data:pointer) : guint;
  385. function EventKeyConnect (Signal:string; Proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  386. function EventKeyConnectAfter (Signal:string; Proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  387. function ConnectKeyPressEvent (proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  388. function ConnectAfterKeyPressEvent (proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  389. function ConnectKeyReleaseEvent (proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  390. function ConnectAfterKeyReleaseEvent (proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  391. function EventCrossingConnect (Signal:string; Proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  392. function EventCrossingConnectAfter (Signal:string; Proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  393. function ConnectEnterNotifyEvent (proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  394. function ConnectAfterEnterNotifyEvent (proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  395. function ConnectLeaveNotifyEvent (proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  396. function ConnectAfterLeaveNotifyEvent (proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  397. function EventConfigureConnect (Signal:string; Proc:TFPgtkEventConfigureFunction; data:pointer) : guint;
  398. function EventConfigureConnectAfter (Signal:string; Proc:TFPgtkEventConfigureFunction; data:pointer) : guint;
  399. function ConnectConfigureEvent (proc:TFPgtkEventConfigureFunction; data:pointer) : guint;
  400. function ConnectAfterConfigureEvent (proc:TFPgtkEventConfigureFunction; data:pointer) : guint;
  401. function EventFocusConnect (Signal:string; Proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  402. function EventFocusConnectAfter (Signal:string; Proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  403. function ConnectFocusInEvent (proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  404. function ConnectAfterFocusInEvent (proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  405. function ConnectFocusOutEvent (proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  406. function ConnectAfterFocusOutEvent (proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  407. function ConnectMapEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  408. function ConnectAfterMapEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  409. function ConnectUnmapEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  410. function ConnectAfterUnmapEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  411. function EventPropertyConnect (Signal:string; Proc:TFPgtkEventPropertyFunction; data:pointer) : guint;
  412. function EventPropertyConnectAfter (Signal:string; Proc:TFPgtkEventPropertyFunction; data:pointer) : guint;
  413. function ConnectPropertyNotifyEvent (proc:TFPgtkEventPropertyFunction; data:pointer) : guint;
  414. function ConnectAfterPropertyNotifyEvent (proc:TFPgtkEventPropertyFunction; data:pointer) : guint;
  415. function EventSelectionConnect (Signal:string; Proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  416. function EventSelectionConnectAfter (Signal:string; Proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  417. function ConnectSelectionClearEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  418. function ConnectAfterSelectionClearEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  419. function ConnectSelectionRequestEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  420. function ConnectAfterSelectionRequestEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  421. function ConnectSelectionNotifyEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  422. function ConnectAfterSelectionNotifyEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  423. function EventProximityConnect (Signal:string; Proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  424. function EventProximityConnectAfter (Signal:string; Proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  425. function ConnectProximityInEvent (proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  426. function ConnectAfterProximityInEvent (proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  427. function ConnectProximityOutEvent (proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  428. function ConnectAfterProximityOutEvent (proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  429. function EventClientConnect (Signal:string; Proc:TFPgtkEventClientFunction; data:pointer) : guint;
  430. function EventClientConnectAfter (Signal:string; Proc:TFPgtkEventClientFunction; data:pointer) : guint;
  431. function ConnectClientEvent (proc:TFPgtkEventClientFunction; data:pointer) : guint;
  432. function ConnectAfterClientEvent (proc:TFPgtkEventClientFunction; data:pointer) : guint;
  433. function EventNoExposeConnect (Signal:string; Proc:TFPgtkEventNoExposeFunction; data:pointer) : guint;
  434. function EventNoExposeConnectAfter (Signal:string; Proc:TFPgtkEventNoExposeFunction; data:pointer) : guint;
  435. function ConnectNoExposeEvent (proc:TFPgtkEventNoExposeFunction; data:pointer) : guint;
  436. function ConnectAfterNoExposeEvent (proc:TFPgtkEventNoExposeFunction; data:pointer) : guint;
  437. function ConnectVisibilityNotifyEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  438. function ConnectAfterVisibilityNotifyEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  439. procedure LockAccelerators;
  440. procedure UnlockAccelerators;
  441. procedure RemoveAccelerators (aSignal:string; OnlyVisible:boolean);
  442. procedure ActivateAccelGroups (Key:guint; Mods:TGdkModifierType);
  443. procedure AcceleratorAdd (AG:PGtkAccelGroup; aSignal:string; Key:guint; Mods:TGdkModifierType; acFlags:TGtkAccelFlags); Overload;
  444. end;
  445. TFPgtkForEachProcedure = procedure (item : pointer; data : pointer) of object;
  446. TFPgtkGroup = class (TList)
  447. Private
  448. FManageLists : boolean;
  449. FListChanged:boolean;
  450. FSListChanged:boolean;
  451. FClassesChanged:boolean;
  452. FNotUpdating:boolean;
  453. FGList:PGList;
  454. FGSList:PGSList;
  455. procedure FreeList;
  456. procedure FreeSList;
  457. function CreateGList : PGList;
  458. function CreateGSList : PGSList;
  459. function GetGtkListProp : PGList;
  460. procedure SetGtkListProp (TheValue : PGList);
  461. function GetGtkSListProp : PGSList;
  462. procedure SetGtkSListProp (TheValue : PGSList);
  463. Protected
  464. procedure BuildFromGtkList;
  465. procedure BuildFromGtkSList;
  466. procedure Notify (ptr:pointer; Action:TListNotification); Override;
  467. function GetData (index:integer) : pointer; Dynamic;
  468. function UngetData (data:pointer) : pointer; Dynamic;
  469. Public
  470. property ManageLists : boolean read FManageLists write FManageLists;
  471. constructor Create;
  472. destructor Destroy; Override;
  473. function GetGtkList (buffered:boolean) : PGList;
  474. function GetGtkSList (buffered:boolean) : PGSList;
  475. procedure BeginUpdate;
  476. procedure EndUpdate;
  477. procedure ForEach (Proc:TFPgtkForEachProcedure; data:pointer);
  478. property GtkList : PGList read GetGtkListProp write SetGtkListProp;
  479. property GtkSList : PGSList read GetGtkSListProp write SetGtkSListProp;
  480. end;
  481. TFPgtkWidgetGroup = class (TFPgtkGroup)
  482. Private
  483. function GetItem(Index:integer) : TFPgtkWidget;
  484. procedure SetItem (Index:integer; TheValue : TFPgtkWidget);
  485. function GetTooltips(index:integer) : string;
  486. procedure SetTooltips (index:integer; TheValue : string);
  487. Public
  488. function GetData (index:integer) : pointer; Override;
  489. function UnGetData (data:pointer) : pointer; Override;
  490. procedure AddToContainer (Container:TFPgtkContainer);
  491. procedure PackInBox (box:TFPgtkBox; AtStart:boolean; Expanding:boolean; Fill:boolean; Padding:integer);
  492. property Items [Index:integer] : TFPgtkWidget read GetItem write SetItem;
  493. property Tooltips [index:integer] : string read GetTooltips write SetTooltips;
  494. end;
  495. TFPgtkMisc = class (TFPgtkWidget)
  496. Private
  497. function GetXAlign : gfloat;
  498. procedure SetXAlign (TheValue : gfloat);
  499. function GetYAlign : gfloat;
  500. procedure SetYAlign (TheValue : gfloat);
  501. function GetXPad : word;
  502. procedure SetXPad (TheValue : word);
  503. function GetYPad : word;
  504. procedure SetYPad (TheValue : word);
  505. Public
  506. function TheGtkObject : PGtkMisc;
  507. procedure SetAlignment (x:gfloat; y:gfloat);
  508. procedure SetPadding (x:word; y:word);
  509. property XAlign : gfloat read GetXAlign write SetXAlign;
  510. property YAlign : gfloat read GetYAlign write SetYAlign;
  511. property XPad : word read GetXPad write SetXPad;
  512. property YPad : word read GetYPad write SetYPad;
  513. end;
  514. TFPgtkLabelClass = class of TFPgtkLabel;
  515. TFPgtkLabel = class (TFPgtkMisc)
  516. Private
  517. function GetText : string;
  518. procedure SetText (TheValue : string);
  519. function GetPattern : string;
  520. procedure SetPattern (TheValue : string);
  521. function GetJustify : TGtkJustification;
  522. procedure SetJustify (TheValue : TGtkJustification);
  523. function GetLineWrap : boolean;
  524. procedure SetLineWrap (TheValue : boolean);
  525. Protected
  526. procedure CreateGtkObject; override;
  527. Public
  528. function TheGtkObject : PGtkLabel;
  529. constructor Create (aText:string);
  530. property Text : string read GetText write SetText;
  531. property Pattern : string read GetPattern write SetPattern;
  532. property Justify : TGtkJustification read GetJustify write SetJustify;
  533. property LineWrap : boolean read GetLineWrap write SetLineWrap;
  534. function ParseUline (aText:string) : guint;
  535. end;
  536. TFPgtkAccelLabel = class (TFPgtkLabel)
  537. Private
  538. function GetAccelWidget : TFPgtkWidget;
  539. procedure SetAccelWidget (TheValue : TFPgtkWidget);
  540. Protected
  541. procedure CreateGtkObject; override;
  542. Public
  543. function TheGtkObject : PGtkAccelLabel;
  544. property AccelWidget : TFPgtkWidget read GetAccelWidget write SetAccelWidget;
  545. function AccelText : string;
  546. procedure Refetch;
  547. end;
  548. TFPgtkTipsQuery = class (TFPgtkLabel)
  549. Protected
  550. procedure CreateGtkObject; override;
  551. Public
  552. function TheGtkObject : PGtkTipsQuery;
  553. end;
  554. TFPgtkArrow = class (TFPgtkMisc)
  555. Private
  556. function GetArrowType : TGtkArrowType;
  557. procedure SetArrowType (TheValue : TGtkArrowType);
  558. function GetShadowType : TGtkShadowType;
  559. procedure SetShadowType (TheValue : TGtkShadowType);
  560. Protected
  561. procedure CreateGtkObject; override;
  562. Public
  563. function TheGtkObject : PGtkArrow;
  564. property ArrowType : TGtkArrowType read GetArrowType write SetArrowType;
  565. property ShadowType : TGtkShadowType read GetShadowType write SetShadowType;
  566. procedure SetTypes (AnArrowType:TGtkArrowType; AShadowtype:TGtkShadowType);
  567. constructor Create (AnArrowType:TGtkArrowType; AShadowType:TGtkShadowType);
  568. end;
  569. TFPgtkImage = class (TFPgtkMisc)
  570. Private
  571. function GetImageProp : PGdkImage;
  572. procedure SetImageProp (TheValue : PGdkImage);
  573. function GetMask : PGdkBitMap;
  574. procedure SetMask (TheValue : PGdkBitMap);
  575. Protected
  576. procedure CreateGtkObject; override;
  577. Public
  578. FMask:PGdkBitMap;
  579. FImage:PGdkImage;
  580. function TheGtkObject : PGtkImage;
  581. property Image : PGdkImage read GetImageProp write SetImageProp;
  582. property Mask : PGdkBitMap read GetMask write SetMask;
  583. procedure SetImage (anImage:PGdkImage; aMask:PGdkBitmap);
  584. constructor Create (anImage:PGdkImage; aMask:PGdkBitmap);
  585. end;
  586. TStringArray = array[0..32000] of pgchar;
  587. PStringArray = ^TStringArray;
  588. TFPgtkPixmap = class (TFPgtkMisc)
  589. Private
  590. function GetBuildInsensitive : longbool;
  591. procedure SetBuildInsensitive (TheValue : longbool);
  592. function GetPixmapProp : PGdkPixMap;
  593. procedure SetPixmapProp (TheValue : PGdkPixMap);
  594. function GetMask : PGdkBitMap;
  595. procedure SetMask (TheValue : PGdkBitMap);
  596. Protected
  597. procedure CreateGtkObject; override;
  598. Public
  599. FMask:PGdkBitMap;
  600. FPixMap:PGdkPixmap;
  601. function TheGtkObject : PGtkPixmap;
  602. property BuildInsensitive : longbool read GetBuildInsensitive write SetBuildInsensitive;
  603. constructor Create;
  604. constructor CreateFromFile (Filename:string; Window:TFPgtkWidget);
  605. constructor CreateFromStrings (Data:TStrings; Window:TFPgtkWidget);
  606. constructor CreateFromText (Data:string; Window:TFPgtkWidget);
  607. property PixMap : PGdkPixMap read GetPixmapProp write SetPixmapProp;
  608. property Mask : PGdkBitMap read GetMask write SetMask;
  609. procedure SetPixmap (aPixmap:PGdkPixMap; aMask:PGdkBitmap);
  610. procedure GetPixmap (var aPixmap:PGdkPixmap; var aMask:PGdkBitmap);
  611. procedure LoadFromFile (Filename:string);
  612. procedure LoadFromStrings (data:TStrings);
  613. procedure LoadFromText (data:string);
  614. procedure LoadFromArray (data:array of string);
  615. end;
  616. TFPgtkDirectionFunctionSignalFunction = function (Sender:TFPgtkObject; Direction:TGtkDirectionType; data:pointer): TGtkDirectionType of Object;
  617. TFPgtkContainer = class (TFPgtkWidget)
  618. Private
  619. function GetBorder : integer;
  620. procedure SetBorder (TheValue : integer);
  621. function GetChildren : TFPgtkWidgetGroup;
  622. Public
  623. FChildren:TFPgtkWidgetGroup;
  624. function TheGtkObject : PGtkContainer;
  625. property Border : integer read GetBorder write SetBorder;
  626. procedure Add (AWidget:TFPgtkWidget; IsVisible:boolean); Overload;
  627. procedure Add (AWidget:TFPgtkWidget); Overload;
  628. procedure Remove (AWidget:TFPgtkWidget);
  629. constructor Create;
  630. destructor Destroy; Override;
  631. property Children : TFPgtkWidgetGroup read GetChildren;
  632. procedure Focus (Direction:TGtkDirectionType);
  633. procedure FocusChild (Child:TFPgtkWidget);
  634. procedure RegisterToplevel;
  635. procedure UnregisterToplevel;
  636. procedure ResizeChildren;
  637. function DirectionFunctionSignalConnect (Signal:string; Proc:TFPgtkDirectionFunctionSignalFunction; data:pointer) : guint;
  638. function DirectionFunctionSignalConnectAfter (Signal:string; Proc:TFPgtkDirectionFunctionSignalFunction; data:pointer) : guint;
  639. function ConnectAdd (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  640. function ConnectAfterAdd (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  641. function ConnectRemove (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  642. function ConnectAfterRemove (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  643. function ConnectCheckResize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  644. function ConnectAfterCheckResize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  645. function ConnectFocus (proc:TFPgtkDirectionFunctionSignalFunction; data:pointer) : guint;
  646. function ConnectAfterFocus (proc:TFPgtkDirectionFunctionSignalFunction; data:pointer) : guint;
  647. function ConnectSetFocusChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  648. function ConnectAfterSetFocusChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  649. end;
  650. TFPgtkBin = class (TFPgtkContainer)
  651. Private
  652. function GetChild : TFPgtkWidget;
  653. procedure SetChild (TheValue : TFPgtkWidget);
  654. Protected
  655. property Child : TFPgtkWidget read GetChild write SetChild;
  656. Public
  657. function TheGtkObject : PGtkBin;
  658. end;
  659. TFPgtkAlignment = class (TFPgtkBin)
  660. Public
  661. function TheGtkObject : PGtkAlignment;
  662. procedure Configure (anXAlign:gfloat; anYAlign:gfloat; anXScale:gfloat; anYScale:gfloat);
  663. end;
  664. TFPgtkFrame = class (TFPgtkBin)
  665. Private
  666. function GetText : string;
  667. procedure SetText (TheValue : string);
  668. function GetAlignment : gfloat;
  669. procedure SetAlignment (TheValue : gfloat);
  670. function GetShadowType : TgtkShadowType;
  671. procedure SetShadowType (TheValue : TgtkShadowType);
  672. Protected
  673. procedure CreateGtkObject; override;
  674. Public
  675. function TheGtkObject : PGtkFrame;
  676. property Text : string read GetText write SetText;
  677. property Alignment : gfloat read GetAlignment write SetAlignment;
  678. property ShadowType : TgtkShadowType read GetShadowType write SetShadowType;
  679. end;
  680. TFPgtkAspectFrame = class (TFPgtkFrame)
  681. Protected
  682. procedure CreateGtkObject; override;
  683. Public
  684. function TheGtkObject : PGtkAspectFrame;
  685. procedure Configure (anXAlign:gfloat; anYAlign:gfloat; Ratio:gfloat; ObeyChild:longbool);
  686. end;
  687. TFPgtkButton = class (TFPgtkBin)
  688. Private
  689. FAccelKey : guint;
  690. FAddContainer : TFPgtkContainer;
  691. FLabel : TFPgtkLabel;
  692. procedure CreateLabel (aText:string);
  693. function GetText : string;
  694. procedure SetText (TheValue : string);
  695. function GetReliefStyle : TGtkReliefStyle;
  696. procedure SetReliefStyle (TheValue : TGtkReliefStyle);
  697. Protected
  698. procedure CreateGtkObject; override;
  699. function LabelClass : TFPgtkLabelClass; Virtual;
  700. procedure NotifyDestroy (AnObject:TFPgtkObject); Override;
  701. procedure LabelCreated; Virtual;
  702. Public
  703. function TheGtkObject : PGtkButton;
  704. function ConnectClicked (proc:TFPgtkSignalFunction; data:pointer) : guint;
  705. function ConnectAfterClicked (proc:TFPgtkSignalFunction; data:pointer) : guint;
  706. function ConnectPressed (proc:TFPgtkSignalFunction; data:pointer) : guint;
  707. function ConnectAfterPressed (proc:TFPgtkSignalFunction; data:pointer) : guint;
  708. function ConnectReleased (proc:TFPgtkSignalFunction; data:pointer) : guint;
  709. function ConnectAfterReleased (proc:TFPgtkSignalFunction; data:pointer) : guint;
  710. function ConnectEnter (proc:TFPgtkSignalFunction; data:pointer) : guint;
  711. function ConnectAfterEnter (proc:TFPgtkSignalFunction; data:pointer) : guint;
  712. function ConnectLeave (proc:TFPgtkSignalFunction; data:pointer) : guint;
  713. function ConnectAfterLeave (proc:TFPgtkSignalFunction; data:pointer) : guint;
  714. procedure Clicked;
  715. procedure Pressed;
  716. procedure Released;
  717. procedure Enter;
  718. procedure Leave;
  719. constructor Create;
  720. constructor CreateWithLabel (aText:string); Overload;
  721. constructor CreateWithLabel (aText:string; AccelGroup:PGtkAccelGroup); Overload;
  722. property TheLabel : TFPgtkLabel read FLabel;
  723. property Text : string read GetText write SetText;
  724. property ReliefStyle : TGtkReliefStyle read GetReliefStyle write SetReliefStyle;
  725. property AddContainer : TFPgtkContainer read FAddContainer write FAddContainer;
  726. property AccelKey : guint read FAccelKey;
  727. end;
  728. TFPgtkToggleButton = class (TFPgtkButton)
  729. Private
  730. function GetActive : boolean;
  731. procedure SetActive (TheValue : boolean);
  732. function GetDrawIndicator : boolean;
  733. procedure SetDrawIndicator (TheValue : boolean);
  734. Protected
  735. procedure CreateGtkObject; override;
  736. Public
  737. function TheGtkObject : PGtkToggleButton;
  738. function ConnectToggled (proc:TFPgtkSignalFunction; data:pointer) : guint;
  739. function ConnectAfterToggled (proc:TFPgtkSignalFunction; data:pointer) : guint;
  740. procedure Toggled;
  741. property Active : boolean read GetActive write SetActive;
  742. property DrawIndicator : boolean read GetDrawIndicator write SetDrawIndicator;
  743. end;
  744. TFPgtkCheckButton = class (TFPgtkToggleButton)
  745. Protected
  746. procedure CreateGtkObject; override;
  747. Public
  748. function TheGtkObject : PGtkCheckButton;
  749. end;
  750. TFPgtkRadioButton = class (TFPgtkCheckButton)
  751. Protected
  752. procedure CreateGtkObject; Override;
  753. Public
  754. FGroup:TFPgtkRadioButtonGroup;
  755. function TheGtkObject : PGtkRadioButton;
  756. constructor Create (AGroup:TFPgtkRadioButtonGroup);
  757. constructor CreateWithLabel (AGroup:TFPgtkRadioButtonGroup; aText:string);
  758. end;
  759. TFPgtkRadioButtonGroup = class (TFPgtkWidgetGroup)
  760. Private
  761. function GetItem(index:integer) : TFPgtkRadioButton;
  762. procedure SetItem (index:integer; TheValue : TFPgtkRadioButton);
  763. Public
  764. property Items [index:integer] : TFPgtkRadioButton read GetItem write SetItem;
  765. function ActiveButtonText : string;
  766. function ActiveButtonIndex : integer;
  767. function ActiveButton : TFPgtkRadioButton;
  768. end;
  769. TFPgtkOptionMenu = class (TFPgtkButton)
  770. Private
  771. function GetMenu : TFPgtkMenu;
  772. procedure setmenu (TheValue : TFPgtkMenu);
  773. Protected
  774. procedure CreateGtkObject; override;
  775. Public
  776. function TheGtkObject : PGtkOptionMenu;
  777. property Menu : TFPgtkMenu read GetMenu write setmenu;
  778. procedure RemoveMenu;
  779. procedure SetHistory (index:integer);
  780. procedure Clear;
  781. end;
  782. TFPgtkItemClass = class of TFPgtkItem;
  783. TFPgtkItem = class (TFPgtkBin)
  784. Private
  785. FAccelKey : guint;
  786. FAddContainer : TFPgtkContainer;
  787. FLabel : TFPgtkLabel;
  788. procedure CreateLabel (aText:string);
  789. function GetText : string;
  790. procedure SetText (TheValue : string);
  791. Protected
  792. function LabelClass : TFPgtkLabelClass; Virtual;
  793. procedure NotifyDestroy (AnObject:TFPgtkObject); Override;
  794. procedure LabelCreated; Virtual;
  795. Public
  796. function TheGtkObject : PGtkItem;
  797. function ConnectSelect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  798. function ConnectAfterSelect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  799. function ConnectDeselect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  800. function ConnectAfterDeselect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  801. function ConnectToggle (proc:TFPgtkSignalFunction; data:pointer) : guint;
  802. function ConnectAfterToggle (proc:TFPgtkSignalFunction; data:pointer) : guint;
  803. procedure Select;
  804. procedure Deselect;
  805. procedure Toggle;
  806. constructor Create;
  807. constructor CreateWithLabel (aText:string);
  808. property TheLabel : TFPgtkLabel read FLabel;
  809. property Text : string read GetText write SetText;
  810. property AddContainer : TFPgtkContainer read FAddContainer write FAddContainer;
  811. property AccelKey : guint read FAccelKey;
  812. end;
  813. TFPgtkItemGroup = class (TFPgtkWidgetGroup)
  814. Private
  815. FItemClass : TFPgtkItemClass;
  816. function GetItem(index:integer) : TFPgtkItem;
  817. procedure SetItem (index:integer; TheValue : TFPgtkItem);
  818. Public
  819. property Items [index:integer] : TFPgtkItem read GetItem write SetItem;
  820. procedure FillFromList (aList:TStrings);
  821. procedure FillFromCommaText (aList:string);
  822. procedure FillFromArray (aList:array of string);
  823. property ItemClass : TFPgtkItemClass read FItemClass write FItemClass;
  824. procedure SignalConnect (Signal:string; proc:TFPgtkSignalFunction; data:pointer);
  825. constructor create (AnItemClass:TFPgtkItemClass);
  826. function AddTextItem (aText:string) : TFPgtkItem;
  827. end;
  828. TFPgtkMenuItem = class (TFPgtkItem)
  829. Private
  830. function GetPlacement : TGtkSubmenuPlacement;
  831. procedure SetPlacement (TheValue : TGtkSubmenuPlacement);
  832. function GetToggleIndicator : boolean;
  833. procedure SetToggleIndicator (TheValue : boolean);
  834. function GetSubMenuIndicator : boolean;
  835. procedure SetSubMenuIndicator (TheValue : boolean);
  836. function GetJustifyRight : boolean;
  837. procedure SetJustifyRight (TheValue : boolean);
  838. function GetSubMenu : TFPgtkMenuShell;
  839. procedure SetPropSubMenu (TheValue : TFPgtkMenuShell);
  840. Protected
  841. procedure CreateGtkObject; override;
  842. function LabelClass : TFPgtkLabelClass; Override;
  843. procedure LabelCreated; Override;
  844. Public
  845. function TheGtkObject : PGtkMenuItem;
  846. function ConnectActivate (proc:TFPgtksignalFunction; data:pointer) : guint;
  847. function ConnectAfterActivate (proc:TFPgtksignalFunction; data:pointer) : guint;
  848. function ConnectActivateItem (proc:TFPgtksignalFunction; data:pointer) : guint;
  849. function ConnectAfterActivateItem (proc:TFPgtksignalFunction; data:pointer) : guint;
  850. procedure Activate;
  851. procedure SetSubMenu (aSubMenu:TFPgtkWidget);
  852. procedure RemoveSubMenu;
  853. procedure Configure (ShowToggleIndicator:boolean; ShowSubmenuIndicator:boolean);
  854. procedure RightJustify;
  855. property Placement : TGtkSubmenuPlacement read GetPlacement write SetPlacement;
  856. property ToggleIndicator : boolean read GetToggleIndicator write SetToggleIndicator;
  857. property SubMenuIndicator : boolean read GetSubMenuIndicator write SetSubMenuIndicator;
  858. property JustifyRight : boolean read GetJustifyRight write SetJustifyRight;
  859. property SubMenu : TFPgtkMenuShell read GetSubMenu write SetPropSubMenu;
  860. end;
  861. TFPgtkCheckMenuItem = class (TFPgtkMenuItem)
  862. Private
  863. function GetActive : boolean;
  864. procedure SetActive (TheValue : boolean);
  865. function GetShowToggle : boolean;
  866. procedure SetShowToggle (TheValue : boolean);
  867. Protected
  868. procedure CreateGtkObject; override;
  869. Public
  870. function TheGtkObject : PGtkCheckMenuItem;
  871. function ConnectToggled (proc:TFPgtksignalFunction; data:pointer) : guint;
  872. function ConnectAfterToggled (proc:TFPgtksignalFunction; data:pointer) : guint;
  873. procedure Toggled;
  874. property Active : boolean read GetActive write SetActive;
  875. property ShowToggle : boolean read GetShowToggle write SetShowToggle;
  876. end;
  877. TFPgtkRadioMenuItem = class (TFPgtkCheckMenuItem)
  878. Private
  879. FGroup : TFPgtkRadioMenuGroup;
  880. Protected
  881. procedure CreateGtkObject; Override;
  882. Public
  883. function TheGtkObject : PGtkRadioMenuItem;
  884. constructor Create (AGroup:TFPgtkRadioMenuGroup);
  885. constructor CreateWithLabel (Agroup:TFPgtkRadioMenuGroup; aText:string);
  886. property Group : TFPgtkRadioMenuGroup read FGroup;
  887. end;
  888. TFPgtkRadioMenuGroup = class (TFPgtkItemGroup)
  889. Private
  890. function GetItem(index:integer) : TFPgtkRadioMenuItem;
  891. procedure SetItem (index:integer; TheValue : TFPgtkRadioMenuItem);
  892. Public
  893. property Items [index:integer] : TFPgtkRadioMenuItem read GetItem write SetItem;
  894. function ActiveMenuText : string;
  895. function ActiveMenuIndex : integer;
  896. function ActiveMenu : TFPgtkRadioMenuItem;
  897. constructor create;
  898. end;
  899. TFPgtkTearOffMenuItem = class (TFPgtkMenuItem)
  900. Protected
  901. procedure CreateGtkObject; override;
  902. Public
  903. function TheGtkObject : PGtkTearOffMenuItem;
  904. end;
  905. TFPgtkScrollSignalFunction = procedure (Sender:TFPgtkObject; ScrollType:TgtkScrollType; position:gfloat; data:pointer) of Object;
  906. TFPgtkScrollBooleanSignalFunction = procedure (Sender:TFPgtkObject; ScrolType:TgtkScrollType; Position:gfloat; AutoStartSelection:boolean; data:pointer) of Object;
  907. TFPgtkListItem = class (TFPgtkItem)
  908. Protected
  909. procedure CreateGtkObject; override;
  910. Public
  911. function TheGtkObject : PGtkListItem;
  912. function ScrollSignalConnect (Signal:string; Proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  913. function ScrollSignalConnectAfter (Signal:string; Proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  914. function ScrollBooleanSignalConnect (Signal:string; Proc:TFPgtkScrollBooleanSignalFunction; data:pointer) : guint;
  915. function ScrollBooleanSignalConnectAfter (Signal:string; Proc:TFPgtkScrollBooleanSignalFunction; data:pointer) : guint;
  916. function ConnectToggleFocusRow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  917. function ConnectAfterToggleFocusRow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  918. function ConnectSelectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  919. function ConnectAfterSelectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  920. function ConnectUnselectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  921. function ConnectAfterUnselectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  922. function ConnectUndoSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  923. function ConnectAfterUndoSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  924. function ConnectStartSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  925. function ConnectAfterStartSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  926. function ConnectEndSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  927. function ConnectAfterEndSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  928. function ConnectToggleAddMode (proc:TFPgtkSignalFunction; data:pointer) : guint;
  929. function ConnectAfterToggleAddMode (proc:TFPgtkSignalFunction; data:pointer) : guint;
  930. function ConnectExtendSelection (proc:TFPgtkScrollBooleanSignalFunction; data:pointer) : guint;
  931. function ConnectAfterExtendSelection (proc:TFPgtkScrollBooleanSignalFunction; data:pointer) : guint;
  932. function ConnectScrollVertical (proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  933. function ConnectAfterScrollVertical (proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  934. function ConnectScrollHorizontal (proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  935. function ConnectAfterScrollHorizontal (proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  936. procedure Select;
  937. procedure Deselect;
  938. end;
  939. TFPgtkListItemGroup = class (TFPgtkItemGroup)
  940. Public
  941. constructor create;
  942. end;
  943. TFPgtkTreeItem = class (TFPgtkItem)
  944. Private
  945. function GetSubTree : TFPgtkWidget;
  946. procedure SetSubTree (TheValue : TFPgtkWidget);
  947. function GetPixPlus : TFPgtkWidget;
  948. function GetPixMinus : TFPgtkWidget;
  949. function GetExpanded : boolean;
  950. procedure SetExpanded (TheValue : boolean);
  951. Protected
  952. procedure CreateGtkObject; override;
  953. Public
  954. function TheGtkObject : PGtkTreeItem;
  955. property SubTree : TFPgtkWidget read GetSubTree write SetSubTree;
  956. property PixPlus : TFPgtkWidget read GetPixPlus;
  957. property PixMinus : TFPgtkWidget read GetPixMinus;
  958. property Expanded : boolean read GetExpanded write SetExpanded;
  959. procedure Select;
  960. procedure Deselect;
  961. procedure Expand;
  962. procedure Collapse;
  963. function ConnectCollapse (proc:TFPgtkSignalFunction; data:pointer) : guint;
  964. function ConnectAfterCollapse (proc:TFPgtkSignalFunction; data:pointer) : guint;
  965. function ConnectExpand (proc:TFPgtkSignalFunction; data:pointer) : guint;
  966. function ConnectAfterExpand (proc:TFPgtkSignalFunction; data:pointer) : guint;
  967. end;
  968. DialogResultCallback = procedure (Sender:TFPgtkWindow; DialogResult:pointer;
  969. Action:integer; initiator:TFPgtkObject) of object;
  970. DialogInitCallback = procedure (Sender : TFPgtkWindow; InitData : pointer) of object;
  971. TFPgtkWindowClass = class of TFPgtkWindow;
  972. TFPgtkWindow = class (TFPgtkBin)
  973. Private
  974. FAccelGroups:TList;
  975. FMainLevel : guint;
  976. FModalAction : integer;
  977. FOnDialogInit : DialogInitCallback;
  978. FOnDialogResult : DialogResultCallback;
  979. FDialogResult : pointer;
  980. TheWindowType:TGtkWindowType;
  981. function GetWindowType : TGtkWindowType;
  982. procedure SetWindowType (TheValue : TGtkWindowType);
  983. function GetTitle : string;
  984. procedure SetTitle (TheValue : string);
  985. function GetModal : boolean;
  986. procedure SetModal (TheValue : boolean);
  987. procedure SetModalAction (TheValue : integer);
  988. procedure ExecuteEnds (Sender:TFPgtkObject; data:pointer);
  989. function GetUserSizable : boolean;
  990. procedure SetUserSizable (TheValue : boolean);
  991. function GetPosition : TGtkWindowPosition;
  992. procedure SetPosition (TheValue : TGtkWindowPosition);
  993. function GetAccelGroups(ID:integer) : PGtkAccelGroup;
  994. Protected
  995. procedure CreateGtkObject; override;
  996. property DialogResult : pointer read FDialogResult write FDialogResult;
  997. procedure DoDialogResult (Action:integer; Sender:TFPgtkObject); Virtual;
  998. procedure DoDialogInit (InitData:pointer); Virtual;
  999. Public
  1000. function TheGtkObject : PGtkWindow;
  1001. constructor Create (AType:TGtkWindowType);
  1002. destructor Destroy; Override;
  1003. property WindowType : TGtkWindowType read GetWindowType write SetWindowType;
  1004. property Title : string read GetTitle write SetTitle;
  1005. property Modal : boolean read GetModal write SetModal;
  1006. property OnDialogResult : DialogResultCallback read FOnDialogResult write FOnDialogResult;
  1007. property OnDialogInit : DialogInitCallback read FOnDialogInit write FOnDialogInit;
  1008. procedure Close;
  1009. procedure CloseWindow (Sender:TFPgtkObject; data:pointer);
  1010. procedure CloseWithResult (Sender:TFPgtkObject; data:pointer);
  1011. property ModalAction : integer read FModalAction write SetModalAction;
  1012. property MainLevel : guint read FMainLevel;
  1013. function Execute (anOnDialogInit:DialogInitCallBack; anInitData:pointer; anOnDialogResult:DialogResultCallBack) : integer;
  1014. function ConnectSetFocus (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1015. function ConnectAfterSetFocus (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1016. procedure SetTransientFor (aParent:TFPgtkWindow);
  1017. procedure DefaultWidget (Widget:TFPgtkWidget);
  1018. procedure FocusedWidget (NewFocus:TFPgtkWidget);
  1019. property UserSizable : boolean read GetUserSizable write SetUserSizable;
  1020. procedure ActivateFocus;
  1021. procedure ActivateDefault;
  1022. procedure SetDefaultSize (Width:gint; Height:gint);
  1023. property Position : TGtkWindowPosition read GetPosition write SetPosition;
  1024. property AccelGroups [ID:integer] : PGtkAccelGroup read GetAccelGroups;
  1025. function AccelGroupNew : integer;
  1026. procedure AccelGroupDelete (ID:integer);
  1027. procedure AcceleratorAdd (AG:integer; aWidget:TFPgtkWidget; aSignal:string; Key:guint; Mods:TGdkModifierType; acFlags:TGtkAccelFlags); Overload;
  1028. procedure AcceleratorRemove (AG:integer; aWidget:TFPgtkWidget; Key:guint; Mods:TGdkModifierType); Overload;
  1029. procedure AccelGroupLock (AG:integer);
  1030. procedure AccelGroupUnlock (AG:integer);
  1031. procedure AccelGroupActivate (AG:integer; Key:guint; Mods:TGdkModifierType);
  1032. end;
  1033. TFPgtkColorSelectionDialog = class (TFPgtkWindow)
  1034. Private
  1035. function GetColorSel : TFPgtkColorSelection;
  1036. function GetButtonOK : TFPgtkButton;
  1037. function GetButtonCancel : TFPgtkButton;
  1038. function GetButtonHelp : TFPgtkButton;
  1039. Protected
  1040. procedure CreateGtkObject; override;
  1041. Public
  1042. function TheGtkObject : PGtkColorSelectionDialog;
  1043. property ColorSel : TFPgtkColorSelection read GetColorSel;
  1044. property ButtonOK : TFPgtkButton read GetButtonOK;
  1045. property ButtonCancel : TFPgtkButton read GetButtonCancel;
  1046. property ButtonHelp : TFPgtkButton read GetButtonHelp;
  1047. end;
  1048. TFPgtkDialog = class (TFPgtkWindow)
  1049. Private
  1050. function GetActionArea : TFPgtkHBox;
  1051. function GetVBox : TFPgtkVBox;
  1052. Protected
  1053. procedure CreateGtkObject; override;
  1054. Public
  1055. function TheGtkObject : PGtkDialog;
  1056. property ActionArea : TFPgtkHBox read GetActionArea;
  1057. property VBox : TFPgtkVBox read GetVBox;
  1058. constructor create;
  1059. end;
  1060. TFPgtkDeviceSignalFunction = procedure (Sender:TFPgtkInputDialog; DeviceID:integer; Data:pointer) of Object;
  1061. TFPgtkInputDialog = class (TFPgtkDialog)
  1062. Private
  1063. function GetButtonClose : TFPgtkButton;
  1064. function GetButtonSave : TFPgtkButton;
  1065. Protected
  1066. procedure CreateGtkObject; override;
  1067. Public
  1068. function TheGtkObject : PGtkInputDialog;
  1069. property ButtonClose : TFPgtkButton read GetButtonClose;
  1070. property ButtonSave : TFPgtkButton read GetButtonSave;
  1071. function DeviceSignalConnect (Signal:string; Proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  1072. function DeviceSignalConnectAfter (Signal:string; Proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  1073. function ConnectEnableDevice (proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  1074. function ConnectAfterEnableDevice (proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  1075. function ConnectDisableDevice (proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  1076. function ConnectAfterDisableDevice (proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  1077. end;
  1078. TFPgtkFileSelection = class (TFPgtkWindow)
  1079. Private
  1080. function GetFilename : string;
  1081. procedure SetFilename (TheValue : string);
  1082. function GetDirList : TFPgtkCList;
  1083. function GetFileList : TFPgtkCList;
  1084. function GetOkButton : TFPgtkButton;
  1085. function GetCancelButton : TFPgtkButton;
  1086. function GetHistoryPulldown : TFPgtkOptionMenu;
  1087. function GetFileOpDialog : TFPgtkDialog;
  1088. function GetFileOpCreateDir : TFPgtkButton;
  1089. function GetFileOpDelFile : TFPgtkButton;
  1090. function GetFileOpRenFile : TFPgtkButton;
  1091. Protected
  1092. procedure CreateGtkObject; override;
  1093. Public
  1094. function TheGtkObject : PGtkFileSelection;
  1095. property Filename : string read GetFilename write SetFilename;
  1096. procedure Complete (Pattern:string);
  1097. procedure ShowFileOpButtons;
  1098. procedure HideFileOpButtons;
  1099. property DirList : TFPgtkCList read GetDirList;
  1100. property FileList : TFPgtkCList read GetFileList;
  1101. property OkButton : TFPgtkButton read GetOkButton;
  1102. property CancelButton : TFPgtkButton read GetCancelButton;
  1103. property HistoryPulldown : TFPgtkOptionMenu read GetHistoryPulldown;
  1104. property FileOpDialog : TFPgtkDialog read GetFileOpDialog;
  1105. property FileOpCreateDir : TFPgtkButton read GetFileOpCreateDir;
  1106. property FileOpDelFile : TFPgtkButton read GetFileOpDelFile;
  1107. property FileOpRenFile : TFPgtkButton read GetFileOpRenFile;
  1108. end;
  1109. TFPgtkFontSelectionDialog = class (TFPgtkWindow)
  1110. Private
  1111. function GetFontSel : TFPgtkFontSelection;
  1112. function GetButtonOk : TFPgtkButton;
  1113. function GetButtonApply : TFPgtkButton;
  1114. function GetButtonCancel : TFPgtkButton;
  1115. Protected
  1116. procedure CreateGtkObject; override;
  1117. Public
  1118. function TheGtkObject : PGtkFontSelectionDialog;
  1119. property FontSel : TFPgtkFontSelection read GetFontSel;
  1120. property ButtonOk : TFPgtkButton read GetButtonOk;
  1121. property ButtonApply : TFPgtkButton read GetButtonApply;
  1122. property ButtonCancel : TFPgtkButton read GetButtonCancel;
  1123. end;
  1124. TFPgtkEventBox = class (TFPgtkBin)
  1125. Protected
  1126. procedure CreateGtkObject; override;
  1127. Public
  1128. function TheGtkObject : PGtkEventBox;
  1129. end;
  1130. TFPgtkHandleBox = class (TFPgtkBin)
  1131. Private
  1132. function GetShadowType : TGtkShadowtype;
  1133. procedure SetShadowType (TheValue : TGtkShadowtype);
  1134. function GetHandlePosition : TGtkPositionType;
  1135. procedure SetHandlePosition (TheValue : TGtkPositionType);
  1136. function GetSnapEdge : TGtkPositionType;
  1137. procedure SetSnapEdge (TheValue : TGtkPositionType);
  1138. function GetChildDetached : boolean;
  1139. Protected
  1140. procedure CreateGtkObject; override;
  1141. Public
  1142. function TheGtkObject : PGtkHandleBox;
  1143. property ShadowType : TGtkShadowtype read GetShadowType write SetShadowType;
  1144. property HandlePosition : TGtkPositionType read GetHandlePosition write SetHandlePosition;
  1145. property SnapEdge : TGtkPositionType read GetSnapEdge write SetSnapEdge;
  1146. property ChildDetached : boolean read GetChildDetached;
  1147. function ConnectChildAttached (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1148. function ConnectAfterChildAttached (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1149. function ConnectChildDetached (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1150. function ConnectAfterChildDetached (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1151. end;
  1152. TFPgtkScrolledWindow = class (TFPgtkBin)
  1153. Private
  1154. FVScroll:TFPgtkAdjustment;
  1155. FHScroll:TFPgtkAdjustment;
  1156. function GetHPolicy : TGtkPolicyType;
  1157. procedure SetHPolicy (TheValue : TGtkPolicyType);
  1158. function GetVPolicy : TGtkPolicyType;
  1159. procedure SetVPolicy (TheValue : TGtkPolicyType);
  1160. function GetHAdjustment : TFPgtkAdjustment;
  1161. procedure SetHAdjustment (TheValue : TFPgtkAdjustment);
  1162. function GetVAdjustment : TFPgtkAdjustment;
  1163. procedure SetVAdjustment (TheValue : TFPgtkAdjustment);
  1164. function GetPlacement : TGtkCornerType;
  1165. procedure SetPlacement (TheValue : TGtkCornerType);
  1166. function GetHScrollbar : TFPgtkScrollbar;
  1167. function GetVScrollbar : TFPgtkScrollbar;
  1168. Protected
  1169. procedure CreateGtkObject; Override;
  1170. Public
  1171. function TheGtkObject : PGtkScrolledWindow;
  1172. constructor Create (hadj:TFPgtkAdjustment; vadj:TFPgtkAdjustment);
  1173. property HPolicy : TGtkPolicyType read GetHPolicy write SetHPolicy;
  1174. property VPolicy : TGtkPolicyType read GetVPolicy write SetVPolicy;
  1175. procedure SetPolicy (aHScrollBar:TGtkPolicyType; aVScrollbar:TGtkPolicyType); Overload;
  1176. procedure SetPolicy (aPolicy:TGtkPolicyType); Overload;
  1177. property HAdjustment : TFPgtkAdjustment read GetHAdjustment write SetHAdjustment;
  1178. property VAdjustment : TFPgtkAdjustment read GetVAdjustment write SetVAdjustment;
  1179. procedure AddWithViewport (aChild:TFPgtkWidget);
  1180. property Placement : TGtkCornerType read GetPlacement write SetPlacement;
  1181. property HScrollbar : TFPgtkScrollbar read GetHScrollbar;
  1182. property VScrollbar : TFPgtkScrollbar read GetVScrollbar;
  1183. procedure UpdatePolicy (UpdPolicy:TGtkUpdateType);
  1184. end;
  1185. TFPgtkViewport = class (TFPgtkBin)
  1186. Private
  1187. FVScroll:TFPgtkAdjustment;
  1188. FHScroll:TFPgtkAdjustment;
  1189. function GetHAdjustment : TFPgtkAdjustment;
  1190. procedure SetHAdjustment (TheValue : TFPgtkAdjustment);
  1191. function GetVAdjustment : TFPgtkAdjustment;
  1192. procedure SetVAdjustment (TheValue : TFPgtkAdjustment);
  1193. function GetShadowType : TgtkShadowType;
  1194. procedure SetShadowType (TheValue : TgtkShadowType);
  1195. Protected
  1196. procedure CreateGtkObject; Override;
  1197. Public
  1198. function TheGtkObject : PGtkViewport;
  1199. constructor Create (hadj:TFPgtkAdjustment; vadj:TFPgtkAdjustment);
  1200. property HAdjustment : TFPgtkAdjustment read GetHAdjustment write SetHAdjustment;
  1201. property VAdjustment : TFPgtkAdjustment read GetVAdjustment write SetVAdjustment;
  1202. property ShadowType : TgtkShadowType read GetShadowType write SetShadowType;
  1203. end;
  1204. TFPgtkBox = class (TFPgtkContainer)
  1205. Private
  1206. function GetHomogeneous : boolean;
  1207. procedure SetHomogeneous (TheValue : boolean);
  1208. function GetSpacing : integer;
  1209. procedure SetSpacing (TheValue : integer);
  1210. Public
  1211. function TheGtkObject : PGtkBox;
  1212. property Homogeneous : boolean read GetHomogeneous write SetHomogeneous;
  1213. property Spacing : integer read GetSpacing write SetSpacing;
  1214. procedure ReorderChild (Widget:TFPgtkWidget; Position:integer);
  1215. procedure GetChildPacking (Widget:TFPgtkWidget; var Expand:boolean; var Fill:boolean; var Padding:integer; var PackType:TGtkPackType);
  1216. procedure SetChildPacking (Widget:TFPgtkWidget; Expand:boolean; Fill:boolean; Padding:integer; PackType:TGtkPackType);
  1217. procedure PackStart (Widget:TFPgtkWidget); Overload;
  1218. procedure PackStart (Widget:TFPgtkWidget; IsVisible:boolean); Overload;
  1219. procedure PackStart (Widget:TFPgtkWidget; expand:boolean; fill:boolean; padding:integer); Overload;
  1220. procedure PackStart (Widget:TFPgtkWidget; expand:boolean; fill:boolean; padding:integer; IsVisible:boolean); Overload;
  1221. procedure PackEnd (Widget:TFPgtkWidget); Overload;
  1222. procedure PackEnd (Widget:TFPgtkWidget; IsVisible:boolean); Overload;
  1223. procedure PackEnd (Widget:TFPgtkWidget; expand:boolean; fill:boolean; padding:integer); Overload;
  1224. procedure PackEnd (Widget:TFPgtkWidget; expand:boolean; fill:boolean; padding:integer; IsVisible:boolean); Overload;
  1225. end;
  1226. TFPgtkButtonBox = class (TFPgtkBox)
  1227. Private
  1228. function GetSpacing : integer;
  1229. procedure SetSpacing (TheValue : integer);
  1230. function GetLayout : TGtkButtonBoxStyle;
  1231. procedure SetLayout (TheValue : TGtkButtonBoxStyle);
  1232. function GetMinWidth : integer;
  1233. procedure SetMinWidth (TheValue : integer);
  1234. function GetMinHeight : integer;
  1235. procedure SetMinHeight (TheValue : integer);
  1236. function GetChildPadX : integer;
  1237. procedure SetChildPadX (TheValue : integer);
  1238. function GetChildPadY : integer;
  1239. procedure SetChildPadY (TheValue : integer);
  1240. Public
  1241. function TheGtkObject : PGtkButtonBox;
  1242. property Spacing : integer read GetSpacing write SetSpacing;
  1243. property Layout : TGtkButtonBoxStyle read GetLayout write SetLayout;
  1244. property ChildMinWidth : integer read GetMinWidth write SetMinWidth;
  1245. property ChildMinHeight : integer read GetMinHeight write SetMinHeight;
  1246. property ChildPadX : integer read GetChildPadX write SetChildPadX;
  1247. property ChildPadY : integer read GetChildPadY write SetChildPadY;
  1248. end;
  1249. TFPgtkHButtonBox = class (TFPgtkButtonBox)
  1250. Protected
  1251. procedure CreateGtkObject; override;
  1252. Public
  1253. function TheGtkObject : PGtkHButtonBox;
  1254. end;
  1255. TFPgtkVButtonBox = class (TFPgtkButtonBox)
  1256. Protected
  1257. procedure CreateGtkObject; override;
  1258. Public
  1259. function TheGtkObject : PGtkVButtonBox;
  1260. end;
  1261. TFPgtkVBox = class (TFPgtkBox)
  1262. Protected
  1263. procedure CreateGtkObject; override;
  1264. Public
  1265. function TheGtkObject : PGtkVBox;
  1266. end;
  1267. TFPgtkColorSelection = class (TFPgtkVBox)
  1268. Private
  1269. function GetUpdatePolicy : TGtkUpdateType;
  1270. procedure SetUpdatePolicy (TheValue : TGtkUpdateType);
  1271. function GetColor : double;
  1272. procedure SetColor (TheValue : double);
  1273. function GetUseOpacity : longbool;
  1274. procedure SetUseOpacity (TheValue : longbool);
  1275. Protected
  1276. procedure CreateGtkObject; override;
  1277. Public
  1278. function TheGtkObject : PGtkColorSelection;
  1279. property UpdatePolicy : TGtkUpdateType read GetUpdatePolicy write SetUpdatePolicy;
  1280. property Color : double read GetColor write SetColor;
  1281. property UseOpacity : longbool read GetUseOpacity write SetUseOpacity;
  1282. end;
  1283. TFPgtkGammaCurve = class (TFPgtkVBOX)
  1284. Protected
  1285. procedure CreateGtkObject; override;
  1286. Public
  1287. function TheGtkObject : PGtkGammaCurve;
  1288. end;
  1289. TFPgtkHBox = class (TFPgtkBox)
  1290. Protected
  1291. procedure CreateGtkObject; override;
  1292. Public
  1293. function TheGtkObject : PGtkHBox;
  1294. end;
  1295. TFPgtkCombo = class (TFPgtkHBox)
  1296. Private
  1297. function GetEntry : TFPgtkEntry;
  1298. function GetList : TFPgtkList;
  1299. function GetButton : TFpGtkButton;
  1300. function GetValueInList : longbool;
  1301. procedure SetValueInListProp (TheValue : longbool);
  1302. function GetOkIfEmpty : longbool;
  1303. procedure SetOkIfEmpty (TheValue : longbool);
  1304. function GetUseArrows : longbool;
  1305. procedure SetUseArrows (TheValue : longbool);
  1306. function GetUseArrowsAlways : longbool;
  1307. procedure SetUseArrowsAlways (TheValue : longbool);
  1308. function GetCaseSensitive : longbool;
  1309. procedure SetCaseSensitive (TheValue : longbool);
  1310. Protected
  1311. procedure CreateGtkObject; override;
  1312. Public
  1313. function TheGtkObject : PGtkCombo;
  1314. property Entry : TFPgtkEntry read GetEntry;
  1315. property List : TFPgtkList read GetList;
  1316. property Button : TFpGtkButton read GetButton;
  1317. property ValueInList : longbool read GetValueInList write SetValueInListProp;
  1318. property OkIfEmpty : longbool read GetOkIfEmpty write SetOkIfEmpty;
  1319. property UseArrows : longbool read GetUseArrows write SetUseArrows;
  1320. property UseArrowsAlways : longbool read GetUseArrowsAlways write SetUseArrowsAlways;
  1321. property CaseSensitive : longbool read GetCaseSensitive write SetCaseSensitive;
  1322. procedure SetItemString (Item:TFPgtkItem; ItemValue:string);
  1323. procedure DisableActivate;
  1324. procedure SetValueInList (Val:longbool; IsOkIfEmpty:longbool);
  1325. end;
  1326. TFPgtkStatusbarSignalFunction = procedure (Sender:TFPgtkObject; contextID:integer; text:string; data:pointer) of Object;
  1327. TFPgtkStatusbar = class (TFPgtkHBox)
  1328. Protected
  1329. procedure CreateGtkObject; override;
  1330. Public
  1331. function TheGtkObject : PGtkStatusbar;
  1332. function GetContextID (ContextDescr:string) : integer;
  1333. function Push (contextID:integer; text:string) : integer;
  1334. procedure Pop (contextID:integer);
  1335. procedure Remove (contextID:integer; MessageID:integer);
  1336. function StatusbarSignalConnect (Signal:string; Proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  1337. function StatusbarSignalConnectAfter (Signal:string; Proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  1338. function ConnectTextPopped (proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  1339. function ConnectAfterTextPopped (proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  1340. function ConnectTextPushed (proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  1341. function ConnectAfterTextPushed (proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  1342. end;
  1343. TFPgtkCListScrollSignalFunction = procedure (Sender:TFPgtkObject; ScrollType:TgtkScrollType; position:gfloat; data:pointer) of Object;
  1344. TFPgtkCListScrollBooleanSignalFunction = procedure (Sender:TFPgtkObject; ScrollType:TgtkScrollType; Position:gfloat; AutoStartSelection:boolean; data:pointer) of Object;
  1345. TFPgtkSelectRowSignalFunction = procedure (Sender:TFPgtkObject; row:integer; column:integer; event:PGdkEventButton; data:pointer) of Object;
  1346. TFPgtkMoveSignalFunction = procedure (Sender:TFPgtkObject; arg1:integer; arg2:integer; data:pointer) of Object;
  1347. TFPgtkColumnClickedSignalFunction = procedure (Sender:TFPgtkObject; column:integer; data:pointer) of Object;
  1348. TFPgtkResizeColumnSignalFunction = procedure (Sender:TFPgtkObject; column:integer; width:integer; data:pointer) of Object;
  1349. TFPgtkCList = class (TFPgtkContainer)
  1350. Private
  1351. compare : TGtkCListCompareFunc;
  1352. FColumnCount : integer;
  1353. function GetShadowType : TGtkShadowType;
  1354. procedure SetShadowType (TheValue : TGtkShadowType);
  1355. function GetSelectionMode : TGtkSelectionMode;
  1356. procedure SetSelectionMode (TheValue : TGtkSelectionMode);
  1357. function GetColumnTitle(column:integer) : string;
  1358. procedure SetColumnTitle (column:integer; TheValue : string);
  1359. function GetColumnWidget(column:integer) : TFPgtkWidget;
  1360. procedure SetColumnWidget (column:integer; TheValue : TFPgtkWidget);
  1361. function GetCellText(Row:integer; Column:integer) : string;
  1362. procedure SetCellText (Row:integer; Column:integer; TheValue : string);
  1363. function GetCellStyle(row:integer; column:integer) : PGtkStyle;
  1364. procedure SetCellStyle (row:integer; column:integer; TheValue : PGtkStyle);
  1365. function GetRowStyle(row:integer) : PGtkStyle;
  1366. procedure SetRowStyle (row:integer; TheValue : PGtkStyle);
  1367. function GetRowData(row:integer) : pointer;
  1368. procedure SetRowData (row:integer; TheValue : pointer);
  1369. procedure SetCompareFunc (TheValue : TGtkCListCompareFunc);
  1370. function GetSortColumn : integer;
  1371. procedure SetSortColumn (TheValue : integer);
  1372. function GetSetSortType : TGtkSortType;
  1373. procedure SetSetSortType (TheValue : TGtkSortType);
  1374. function GetHAdjustment : TFPgtkAdjustment;
  1375. procedure SetHAdjustment (TheValue : TFPgtkAdjustment);
  1376. function GetVAdjustment : TFPgtkAdjustment;
  1377. procedure SetVAdjustment (TheValue : TFPgtkAdjustment);
  1378. Protected
  1379. procedure CreateGtkObject; override;
  1380. Public
  1381. function TheGtkObject : PGtkCList;
  1382. constructor Create (aColumnCount:integer);
  1383. property ColumnCount : integer read FColumnCount;
  1384. property ShadowType : TGtkShadowType read GetShadowType write SetShadowType;
  1385. property SelectionMode : TGtkSelectionMode read GetSelectionMode write SetSelectionMode;
  1386. procedure Freeze;
  1387. procedure Thaw;
  1388. procedure ShowTitles;
  1389. procedure HideTitles;
  1390. procedure ActiveTitles;
  1391. procedure PassiveTitles;
  1392. procedure ActiveTitle (column:integer);
  1393. procedure PassiveTitle (column:integer);
  1394. property ColumnTitle [column:integer] : string read GetColumnTitle write SetColumnTitle;
  1395. property ColumnWidget [column:integer] : TFPgtkWidget read GetColumnWidget write SetColumnWidget;
  1396. procedure SetColumnJustification (column:integer; justification:TGtkJustification);
  1397. procedure SetColumnVisibility (column:integer; aVisible:boolean);
  1398. procedure SetColumnResizeable (column:integer; Resizeable:boolean);
  1399. procedure SetColumnAutoResize (column:integer; autoResize:boolean);
  1400. function OptimalColumnWidth (column:integer) : integer;
  1401. procedure SetColumnWidth (column:integer; width:integer);
  1402. procedure SetColumnMinWidth (column:integer; MinWidth:integer);
  1403. procedure SetColumnMaxWidth (column:integer; MaxWidth:integer);
  1404. function AutoSizeColumns : integer;
  1405. procedure ConfigureColumnWidth (column:integer; Width:integer; MinWidth:integer; MaxWidth:integer);
  1406. procedure ConfigureColumn (column:integer; Justification:TGtkJustification; Visibility:boolean; Resizeable:boolean; AutoSize:boolean);
  1407. procedure SetRowHeight (height:integer);
  1408. procedure MoveTo (row:integer; column:integer; RowAlign:gfloat; ColAlign:gfloat);
  1409. function RowIsVisible (Row:integer) : TGtkVisibility;
  1410. function GetCellType (Row:integer; column:integer) : TGtkCellType;
  1411. property CellText [Row:integer; Column:integer] : string read GetCellText write SetCellText;
  1412. procedure SetPixmap (row:integer; column:integer; pixmap:PGdkPixmap; mask:PGdkBitmap);
  1413. procedure GetPixmap (row:integer; column:integer; var pixmap:PGdkPixmap; var mask:PGdkBitmap);
  1414. procedure SetPixText (row:integer; column:integer; text:string; spacing:guint8; pixmap:PGdkPixmap; mask:PGdkBitmap);
  1415. procedure GetPixText (row:integer; column:integer; var text:string; var aspacing:guint8; var pixmap:PGdkPixmap; var mask:PGdkBitmap);
  1416. procedure SetForeground (row:integer; color:PGdkColor);
  1417. procedure SetBackground (row:integer; color:PGdkColor);
  1418. property CellStyle [row:integer; column:integer] : PGtkStyle read GetCellStyle write SetCellStyle;
  1419. property RowStyle [row:integer] : PGtkStyle read GetRowStyle write SetRowStyle;
  1420. procedure SetShift (row:integer; column:integer; vertical:integer; horizontal:integer);
  1421. procedure Remove (row:integer);
  1422. procedure Prepend (Data:TStrings); Overload;
  1423. procedure Prepend (Text:string; separator:string); Overload;
  1424. procedure Prepend (data:array of string); Overload;
  1425. function Append (data:TStrings) : Integer; Overload;
  1426. function Append (Text:string; Separator:string) : Integer; Overload;
  1427. function Append (data:array of string) : Integer; Overload;
  1428. procedure Insert (row:integer; data:TStrings); Overload;
  1429. procedure Insert (row:integer; Text:string; Separator:string); Overload;
  1430. procedure Insert (row:integer; data:array of string); Overload;
  1431. property RowData [row:integer] : pointer read GetRowData write SetRowData;
  1432. function FindRowFromData (data:pointer) : integer;
  1433. procedure SelectRow (row:integer; column:integer);
  1434. procedure UnselectRow (row:integer; column:integer);
  1435. procedure Clear;
  1436. procedure SelectAll;
  1437. procedure UnselectAll;
  1438. procedure SwapRows (row1:integer; row2:integer);
  1439. procedure RowMove (sourceRow:integer; destRow:integer);
  1440. procedure Sort;
  1441. property CompareFunc : TGtkCListCompareFunc read compare write SetCompareFunc;
  1442. property SortColumn : integer read GetSortColumn write SetSortColumn;
  1443. property SetSortType : TGtkSortType read GetSetSortType write SetSetSortType;
  1444. procedure SetAutoSort (autoSort:boolean);
  1445. property HAdjustment : TFPgtkAdjustment read GetHAdjustment write SetHAdjustment;
  1446. property VAdjustment : TFPgtkAdjustment read GetVAdjustment write SetVAdjustment;
  1447. procedure SetReorderable (reorderable:boolean);
  1448. function Count : integer;
  1449. function CListScrollSignalConnect (Signal:string; Proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  1450. function CListScrollSignalConnectAfter (Signal:string; Proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  1451. function CListScrollBooleanSignalConnect (Signal:string; Proc:TFPgtkCListScrollBooleanSignalFunction; data:pointer) : guint;
  1452. function CListScrollBooleanSignalConnectAfter (Signal:string; Proc:TFPgtkCListScrollBooleanSignalFunction; data:pointer) : guint;
  1453. function SelectRowSignalConnect (Signal:string; Proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  1454. function SelectRowSignalConnectAfter (Signal:string; Proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  1455. function ConnectSelectRow (proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  1456. function ConnectAfterSelectRow (proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  1457. function ConnectUnselectRow (proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  1458. function ConnectAfterUnselectRow (proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  1459. function MoveSignalConnect (Signal:string; Proc:TFPgtkMoveSignalFunction; data:pointer) : guint;
  1460. function MoveSignalConnectAfter (Signal:string; Proc:TFPgtkMoveSignalFunction; data:pointer) : guint;
  1461. function ConnectRowMove (proc:TFPgtkMoveSignalFunction; data:pointer) : guint;
  1462. function ConnectAfterRowMove (proc:TFPgtkMoveSignalFunction; data:pointer) : guint;
  1463. function ConnectScrollVertical (proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  1464. function ConnectAfterScrollVertical (proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  1465. function ConnectScrolHorizontal (proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  1466. function ConnectAfterScrolHorizontal (proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  1467. function ConnectToggleFocusRow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1468. function ConnectAfterToggleFocusRow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1469. function ConnectSelectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1470. function ConnectAfterSelectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1471. function ConnectUnselectAll (proc:TFPgtksignalFunction; data:pointer) : guint;
  1472. function ConnectAfterUnselectAll (proc:TFPgtksignalFunction; data:pointer) : guint;
  1473. function ConnectUndoSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  1474. function ConnectAfterUndoSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  1475. function ConnectStartSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  1476. function ConnectAfterStartSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  1477. function ConnectEndSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  1478. function ConnectAfterEndSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  1479. function ConnectToggleAddMode (proc:TFPgtksignalFunction; data:pointer) : guint;
  1480. function ConnectAfterToggleAddMode (proc:TFPgtksignalFunction; data:pointer) : guint;
  1481. function ConnectAbortColumnResize (proc:TFPgtksignalFunction; data:pointer) : guint;
  1482. function ConnectAfterAbortColumnResize (proc:TFPgtksignalFunction; data:pointer) : guint;
  1483. function ConnectExtendSelection (proc:TFPgtkCListScrollBooleanSignalFunction; data:pointer) : guint;
  1484. function ConnectAfterExtendSelection (proc:TFPgtkCListScrollBooleanSignalFunction; data:pointer) : guint;
  1485. function ColumnClickedSignalConnect (Signal:string; Proc:TFPgtkColumnClickedSignalFunction; data:pointer) : guint;
  1486. function ColumnClickedSignalConnectAfter (Signal:string; Proc:TFPgtkColumnClickedSignalFunction; data:pointer) : guint;
  1487. function ConnectClickColumn (proc:TFPgtkColumnClickedSignalFunction; data:pointer) : guint;
  1488. function ConnectAfterClickColumn (proc:TFPgtkColumnClickedSignalFunction; data:pointer) : guint;
  1489. function ResizeColumnSignalConnect (Signal:string; Proc:TFPgtkResizeColumnSignalFunction; data:pointer) : guint;
  1490. function ResizeColumnSignalConnectAfter (Signal:string; Proc:TFPgtkResizeColumnSignalFunction; data:pointer) : guint;
  1491. function ConnectResizeColumn (proc:TFPgtkResizeColumnSignalFunction; data:pointer) : guint;
  1492. function ConnectAfterResizeColumn (proc:TFPgtkResizeColumnSignalFunction; data:pointer) : guint;
  1493. end;
  1494. TFPgtkCTreeFunction = procedure (TheTree:TFPgtkCTree; TheNode:PGtkCTreeNode; data:pointer) of object;
  1495. TFPgtkCTree = class (TFPgtkCList)
  1496. Private
  1497. FTreeColumn:integer;
  1498. function GetLineStyle : TGtkCTreeLineStyle;
  1499. procedure SetLineStyle (TheValue : TGtkCTreeLineStyle);
  1500. function GetShowStub : boolean;
  1501. procedure SetShowStub (TheValue : boolean);
  1502. function GetExpanderStyle : TGtkCTreeExpanderStyle;
  1503. procedure SetExpanderStyle (TheValue : TGtkCTreeExpanderStyle);
  1504. function GetSpacing : guint;
  1505. procedure SetSpacing (TheValue : guint);
  1506. function GetIndent : guint;
  1507. procedure SetIndent (TheValue : guint);
  1508. function GetTreeColumn : integer;
  1509. function GetNodeCellText(Node:PGtkCTreeNode; Column:integer) : string;
  1510. procedure SetNodeCellText (Node:PGtkCTreeNode; Column:integer; TheValue : string);
  1511. function GetNodeSelectable(Node:PGtkCTreeNode) : boolean;
  1512. procedure SetNodeSelectable (Node:PGtkCTreeNode; TheValue : boolean);
  1513. function GetNodeCellStyle(Node:PGtkCTreeNode; column:integer) : PGtkStyle;
  1514. procedure SetNodeCellStyle (Node:PGtkCTreeNode; column:integer; TheValue : PGtkStyle);
  1515. function GetNodeRowStyle(Node:PGtkCTreeNode) : PGtkStyle;
  1516. procedure SetNodeRowStyle (Node:PGtkCTreeNode; TheValue : PGtkStyle);
  1517. function GetNodeData(Node:PGtkCTreeNode) : pointer;
  1518. procedure SetNodeData (Node:PGtkCTreeNode; TheValue : pointer);
  1519. function GetCompareDragFunc : TGtkCTreeCompareDragFunc;
  1520. procedure SetCompareDragFunc (TheValue : TGtkCTreeCompareDragFunc);
  1521. Public
  1522. function TheGtkObject : PGtkCTree;
  1523. property LineStyle : TGtkCTreeLineStyle read GetLineStyle write SetLineStyle;
  1524. property ShowStub : boolean read GetShowStub write SetShowStub;
  1525. property ExpanderStyle : TGtkCTreeExpanderStyle read GetExpanderStyle write SetExpanderStyle;
  1526. property Spacing : guint read GetSpacing write SetSpacing;
  1527. property Indent : guint read GetIndent write SetIndent;
  1528. property TreeColumn : integer read GetTreeColumn;
  1529. constructor Create (aColumnCount:integer; aTreeColumn:integer);
  1530. procedure RemoveNode (node:PGtkCTreeNode);
  1531. function InsertNode (aParent:PGtkCTreeNode; Sibling:PGtkCTreeNode; data:string; aSpacing:guint8; PixmapClosed:PGdkPixmap; MaskClosed:PGdkBitmap; PixmapOpened:PGdkPixmap; MaskOpened:PGdkBitmap; IsLeaf:boolean; Expanded:boolean) : PGtkCTreeNode; Overload;
  1532. function InsertNode (aParent:PGtkCTreeNode; Sibling:PGtkCTreeNode; data:string; aSpacing:guint8; IsLeaf:boolean; Expanded:boolean) : PGtkCTreeNode; Overload;
  1533. procedure PostRecursive (aNode:PGtkCTreeNode; func:TFPgtkCTreeFunction; data:pointer);
  1534. procedure PostRecursiveToDepth (aNode:PGtkCTreeNode; aDepth:integer; func:TFPgtkCTreeFunction; data:pointer);
  1535. procedure PreRecursive (aNode:PGtkCTreeNode; func:TFPgtkCTreeFunction; data:pointer);
  1536. procedure PreRecursiveToDepth (aNode:PGtkCTreeNode; aDepth:integer; func:TFPgtkCTreeFunction; data:pointer);
  1537. procedure IsViewable (aNode:PGtkCTreeNode);
  1538. procedure LastChild (aNode:PGtkCTreeNode);
  1539. function IsChild (anAncestor:PGtkCTreeNode; aChild:PGtkCTreeNode) : boolean;
  1540. function IsAncestor (anAncestor:PGtkCTreeNode; aChild:PGtkCTreeNode) : boolean;
  1541. function IsHotSpot (X:integer; Y:integer) : boolean;
  1542. procedure MoveNode (aNode:PGtkCTreeNode; NewParent:PGtkCTreeNode; NewSibling:PGtkCTreeNode);
  1543. procedure Expand (aNode:PGtkCTreeNode);
  1544. procedure ExpandRecursive (aNode:PGtkCTreeNode);
  1545. procedure ExpandToDepth (aNode:PGtkCTreeNode; aDepth:integer);
  1546. procedure Collapse (aNode:PGtkCTreeNode);
  1547. procedure CollapseRecursive (aNode:PGtkCTreeNode);
  1548. procedure CollapseToDepth (aNode:PGtkCTreeNode; aDepth:integer);
  1549. procedure SelectNode (aNode:PGtkCTreeNode);
  1550. procedure SelectRecursive (aNode:PGtkCTreeNode);
  1551. procedure UnselectNode (aNode:PGtkCTreeNode);
  1552. procedure UnselectRecursive (aNode:PGtkCTreeNode);
  1553. procedure RealSelectRecursive (aNode:PGtkCTreeNode; aState:boolean);
  1554. function NodeGetCellType (Node:PGtkCTreeNode; column:integer) : TGtkCellType;
  1555. property NodeCellText [Node:PGtkCTreeNode; Column:integer] : string read GetNodeCellText write SetNodeCellText;
  1556. procedure NodeSetPixmap (Node:PGtkCTreeNode; column:integer; pixmap:PGdkPixmap; mask:PGdkBitmap);
  1557. procedure NodeGetPixmap (Node:PGtkCTreeNode; column:integer; var pixmap:PGdkPixmap; var mask:PGdkBitmap);
  1558. procedure NodeSetPixText (Node:PGtkCTreeNode; column:integer; text:string; aspacing:guint8; pixmap:PGdkPixmap; mask:PGdkBitmap);
  1559. procedure NodeGetPixText (Node:PGtkCTreeNode; column:integer; var text:string; var aspacing:guint8; var pixmap:PGdkPixmap; var mask:PGdkBitmap);
  1560. procedure SetNodeInfo (aNode:PGtkCTreeNode; aText:string; aSpacing:guint8; PixmapClosed:PGdkPixmap; MaskClosed:PGdkBitmap; PixmapOpened:PGdkPixmap; MaskOpened:PGdkBitmap; IsLeaf:boolean; Expanded:boolean); Overload;
  1561. procedure GetNodeInfo (aNode:PGtkCTreeNode; var aText:string; var aSpacing:guint8; var PixmapClosed:PGdkPixmap; var MaskClosed:PGdkBitmap; var PixmapOpened:PGdkPixmap; var MaskOpened:PGdkBitmap; var IsLeaf:boolean; var Expanded:boolean); Overload;
  1562. procedure NodeSetShift (Node:PGtkCTreeNode; column:integer; vertical:integer; horizontal:integer);
  1563. property NodeSelectable [Node:PGtkCTreeNode] : boolean read GetNodeSelectable write SetNodeSelectable;
  1564. procedure NodeSetForeground (Node:PGtkCTreeNode; color:PGdkColor);
  1565. procedure NodeSetBackground (Node:PGtkCTreeNode; color:PGdkColor);
  1566. property NodeCellStyle [Node:PGtkCTreeNode; column:integer] : PGtkStyle read GetNodeCellStyle write SetNodeCellStyle;
  1567. property NodeRowStyle [Node:PGtkCTreeNode] : PGtkStyle read GetNodeRowStyle write SetNodeRowStyle;
  1568. property NodeData [Node:PGtkCTreeNode] : pointer read GetNodeData write SetNodeData;
  1569. procedure NodeMoveTo (aNode:PGtkCTreeNode; column:integer; RowAlign:gfloat; ColAlign:gfloat);
  1570. function IsVisible (aNode:PGtkCTreeNode) : TGtkVisibility;
  1571. property CompareDragFunc : TGtkCTreeCompareDragFunc read GetCompareDragFunc write SetCompareDragFunc;
  1572. procedure SortNode (aNode:PGtkCTreeNode);
  1573. procedure SortRecursive (aNode:PGtkCTreeNode);
  1574. function NthNode (Row:integer) : PGtkCTreeNode;
  1575. end;
  1576. TFPgtkFixed = class (TFPgtkContainer)
  1577. Protected
  1578. procedure CreateGtkObject; override;
  1579. Public
  1580. function TheGtkObject : PGtkFixed;
  1581. procedure Put (Widget:TFPgtkWidget; x:integer; y:integer);
  1582. procedure Move (Widget:TFPgtkWidget; x:integer; y:integer);
  1583. procedure GetPos (Widget:TFPgtkWidget; var PosX:integer; var PosY:integer);
  1584. end;
  1585. TFPgtkPageSwitchSignalFunction = procedure (Sender:TFPgtkObject; PageRec:PGtkNotebookPage; aPageNum:integer; data:pointer) of Object;
  1586. TFPgtkNotebook = class (TFPgtkContainer)
  1587. Private
  1588. function GetPageIndex : integer;
  1589. procedure SetPageIndex (TheValue : integer);
  1590. function GetPage : TFPgtkWidget;
  1591. procedure SetPage (TheValue : TFPgtkWidget);
  1592. function GetTabPos : TGtkPositionType;
  1593. procedure SetTabPos (TheValue : TGtkPositionType);
  1594. function GetShowTabs : boolean;
  1595. procedure SetShowTabs (TheValue : boolean);
  1596. function GetShowBorder : boolean;
  1597. procedure SetShowBorder (TheValue : boolean);
  1598. function GetScrollable : boolean;
  1599. procedure SetScrollable (TheValue : boolean);
  1600. function GetHomogenous : boolean;
  1601. procedure SetHomogenous (TheValue : boolean);
  1602. function GetTabHBorder : word;
  1603. procedure SetTabHBorder (TheValue : word);
  1604. function GetTabVBorder : word;
  1605. procedure SetTabVBorder (TheValue : word);
  1606. Protected
  1607. procedure CreateGtkObject; override;
  1608. Public
  1609. function TheGtkObject : PGtkNotebook;
  1610. procedure AppendPage (Child:TFPgtkWidget; TabLabel:TFPgtkWidget);
  1611. procedure AppendPageFull (Child:TFPgtkWidget; TabLabel:TFPgtkWidget; MenuLabel:TFPgtkWidget; IsVisible:boolean);
  1612. procedure PrependPage (Child:TFPgtkWidget; TabLabel:TFPgtkWidget);
  1613. procedure PrependPageFull (Child:TFPgtkWidget; TabLabel:TFPgtkWidget; MenuLabel:TFPgtkWidget; IsVisible:boolean);
  1614. procedure InsertPage (Child:TFPgtkWidget; TabLabel:TFPgtkWidget; Position:integer);
  1615. procedure InsertPageFull (Child:TFPgtkWidget; TabLabel:TFPgtkWidget; MenuLabel:TFPgtkWidget; IsVisible:boolean; Position:integer);
  1616. procedure RemovePage (PageNumber:integer);
  1617. function PageNumberOf (Child:TFPgtkWidget) : integer;
  1618. procedure NextPage;
  1619. procedure PrevPage;
  1620. procedure ReorderPage (Child:TFPgtkWidget; PageNum:integer);
  1621. property PageIndex : integer read GetPageIndex write SetPageIndex;
  1622. property Page : TFPgtkWidget read GetPage write SetPage;
  1623. property TabPos : TGtkPositionType read GetTabPos write SetTabPos;
  1624. property ShowTabs : boolean read GetShowTabs write SetShowTabs;
  1625. property ShowBorder : boolean read GetShowBorder write SetShowBorder;
  1626. property Scrollable : boolean read GetScrollable write SetScrollable;
  1627. property Homogenous : boolean read GetHomogenous write SetHomogenous;
  1628. property TabHBorder : word read GetTabHBorder write SetTabHBorder;
  1629. property TabVBorder : word read GetTabVBorder write SetTabVBorder;
  1630. procedure SetTabBorders (BorderWidth:word);
  1631. function GetMenuLabelOf (Child:TFPgtkWidget) : TFPgtkWidget;
  1632. procedure SetMenuLabel (Child:TFPgtkWidget; MenuLabel:TFPgtkWidget);
  1633. function GetTabLabelOf (Child:TFPgtkWidget) : TFPgtkWidget;
  1634. procedure SetTabLabel (Child:TFPgtkWidget; TabLabel:TFPgtkWidget);
  1635. function GetChildOnPage (PageNum:integer) : TFPgtkWidget;
  1636. procedure GetTabLabelPacking (Widget:TFPgtkWidget; var Expand:boolean; var Fill:boolean; var PackType:TGtkPackType);
  1637. procedure SetTabLabelPacking (Widget:TFPgtkWidget; Expand:boolean; Fill:boolean; PackType:TGtkPackType);
  1638. procedure EnablePopup;
  1639. procedure DisablePopup;
  1640. function PageSwitchSignalConnect (Signal:string; Proc:TFPgtkPageSwitchSignalFunction; data:pointer) : guint;
  1641. function PageSwitchSignalConnectAfter (Signal:string; Proc:TFPgtkPageSwitchSignalFunction; data:pointer) : guint;
  1642. function ConnectSwitchPage (proc:TFPgtkPageSwitchSignalFunction; data:pointer) : guint;
  1643. function ConnectAfterSwitchPage (proc:TFPgtkPageSwitchSignalFunction; data:pointer) : guint;
  1644. end;
  1645. TFPgtkFontSelection = class (TFPgtkNotebook)
  1646. Private
  1647. function GetFontName : string;
  1648. procedure SetFontName (TheValue : string);
  1649. function GetPreviewText : string;
  1650. procedure SetPreviewText (TheValue : string);
  1651. Protected
  1652. procedure CreateGtkObject; override;
  1653. Public
  1654. function TheGtkObject : PGtkFontSelection;
  1655. property FontName : string read GetFontName write SetFontName;
  1656. function GetFont : PGdkFont;
  1657. property PreviewText : string read GetPreviewText write SetPreviewText;
  1658. procedure SetFilter (FilterType:TGtkFontFilterType; FontType:TGtkFontType; Foundries:array of string; Weights:array of string; Slants:array of string; SetWidths:array of string; Spacings:array of string; CharSets:array of string);
  1659. end;
  1660. TFPgtkPaned = class (TFPgtkContainer)
  1661. Private
  1662. function GetGutterSize : word;
  1663. procedure SetGutterSize (TheValue : word);
  1664. function GetHandleSize : word;
  1665. procedure SetHandleSize (TheValue : word);
  1666. function GetPosition : integer;
  1667. procedure SetPosition (TheValue : integer);
  1668. Public
  1669. function TheGtkObject : PGtkPaned;
  1670. property GutterSize : word read GetGutterSize write SetGutterSize;
  1671. property HandleSize : word read GetHandleSize write SetHandleSize;
  1672. property Position : integer read GetPosition write SetPosition;
  1673. procedure ComputePosition (AnAllocation:integer; Child1Req:integer; Child2Req:integer);
  1674. procedure Add1 (Child:TFPgtkWidget); Overload;
  1675. procedure Pack1 (Child:TFPgtkWidget; Resize:boolean; Shrink:boolean); Overload;
  1676. procedure Add1 (Child:TFPgtkWidget; isVisible:boolean); Overload;
  1677. procedure Pack1 (Child:TFPgtkWidget; Resize:boolean; Shrink:boolean; IsVisible:boolean); Overload;
  1678. procedure Add2 (Child:TFPgtkWidget); Overload;
  1679. procedure Pack2 (Child:TFPgtkWidget; Resize:boolean; Shrink:boolean); Overload;
  1680. procedure Add2 (Child:TFPgtkWidget; IsVisible:boolean); Overload;
  1681. procedure Pack2 (Child:TFPgtkWidget; Resize:boolean; Shrink:boolean; IsVisible:boolean); Overload;
  1682. end;
  1683. TFPgtkHPaned = class (TFPgtkPaned)
  1684. Protected
  1685. procedure CreateGtkObject; override;
  1686. Public
  1687. function TheGtkObject : PGtkHPaned;
  1688. end;
  1689. TFPgtkVPaned = class (TFPgtkPaned)
  1690. Protected
  1691. procedure CreateGtkObject; override;
  1692. Public
  1693. function TheGtkObject : PGtkVPaned;
  1694. end;
  1695. TFPgtkLayout = class (TFPgtkContainer)
  1696. Private
  1697. function GetHAdj : TFPgtkAdjustment;
  1698. procedure SetHAdj (TheValue : TFPgtkAdjustment);
  1699. function GetVAdj : TFPgtkAdjustment;
  1700. procedure SetVAdj (TheValue : TFPgtkAdjustment);
  1701. Protected
  1702. procedure CreateGtkObject; override;
  1703. Public
  1704. function TheGtkObject : PGtkLayout;
  1705. property HAdj : TFPgtkAdjustment read GetHAdj write SetHAdj;
  1706. property VAdj : TFPgtkAdjustment read GetVAdj write SetVAdj;
  1707. procedure Freeze;
  1708. procedure Thaw;
  1709. procedure Put (aWidget:TFPgtkWidget; X:integer; Y:integer); Overload;
  1710. procedure Put (aWidget:TFPgtkWidget; X:integer; Y:integer; aVisible:boolean); Overload;
  1711. procedure Move (aWidget:TFPgtkWidget; X:integer; Y:integer);
  1712. procedure SetSize (aWidth:integer; aHeight:integer);
  1713. end;
  1714. TFPgtkList = class (TFPgtkContainer)
  1715. Private
  1716. function GetSelectionMode : TGtkSelectionMode;
  1717. procedure SetSelectionMode (TheValue : TGtkSelectionMode);
  1718. Protected
  1719. procedure CreateGtkObject; override;
  1720. Public
  1721. function TheGtkObject : PGtkList;
  1722. function ConnectSelectionChanged (proc:TFPgtksignalFunction; data:pointer) : guint;
  1723. function ConnectAfterSelectionChanged (proc:TFPgtksignalFunction; data:pointer) : guint;
  1724. function ConnectSelectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1725. function ConnectAfterSelectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1726. function ConnectUnselectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1727. function ConnectAfterUnselectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1728. property SelectionMode : TGtkSelectionMode read GetSelectionMode write SetSelectionMode;
  1729. procedure InsertItems (TheItems:TFPgtkListItemGroup; position:integer);
  1730. procedure AppendItems (TheItems:TFPgtkListItemGroup);
  1731. procedure PrependItems (TheItems:TFPgtkListItemGroup);
  1732. procedure RemoveItems (TheItems:TFPgtkListItemGroup);
  1733. procedure RemoveItemsNoUnref (TheItems:TFPgtkListItemGroup);
  1734. procedure ClearItems (FromItem:integer; ToItem:integer);
  1735. procedure ClearAll;
  1736. procedure SelectItem (Item:integer);
  1737. procedure UnselectItem (Item:integer);
  1738. procedure SelectChild (Child:TFPgtkWidget);
  1739. procedure UnselectChild (Child:TFPgtkWidget);
  1740. function ChildPosition (Child:TFPgtkWidget) : integer;
  1741. procedure ExtendSelection (ScrollType:TGtkScrollType; Position:gfloat; AutoStartSelection:boolean);
  1742. procedure StartSelection;
  1743. procedure EndSelection;
  1744. procedure SelectAll;
  1745. procedure UnselectAll;
  1746. procedure ScrollHorizontal (ScrollType:TGtkScrollType; Position:gfloat);
  1747. procedure ScrollVertical (ScrollType:TGtkScrollType; Position:gfloat);
  1748. procedure ToggleAddMode;
  1749. procedure ToggleFocusRow;
  1750. procedure ToggleRow (Child:TFPgtkWidget);
  1751. procedure UndoSelection;
  1752. procedure EndDragSelection;
  1753. procedure GetSelection (aGroup:TFPgtkGroup);
  1754. end;
  1755. TFPgtkMoveCurrentSignalFunction = procedure (Sender:TFPgtkObject; dir:TGtkMenuDirectionType; data:pointer) of Object;
  1756. TFPgtkMenuShell = class (TFPgtkContainer)
  1757. Protected
  1758. procedure GtkPrepend (MenuItem:TFPgtkWidget); Virtual;
  1759. procedure GtkInsert (MenuItem:TFPgtkWidget; position:integer); Virtual;
  1760. procedure GtkAppend (MenuItem:TFPgtkWidget); Virtual;
  1761. Public
  1762. function TheGtkObject : PGtkMenuShell;
  1763. function MoveCurrentSignalConnect (Signal:string; Proc:TFPgtkMoveCurrentSignalFunction; data:pointer) : guint;
  1764. function MoveCurrentSignalConnectAfter (Signal:string; Proc:TFPgtkMoveCurrentSignalFunction; data:pointer) : guint;
  1765. procedure ActivateItem (MenuItem:TFPgtkWidget; ForceDeactivate:boolean);
  1766. procedure SelectItem (MenuItem:TFPgtkWidget);
  1767. procedure DeActivate;
  1768. procedure Prepend (MenuItem:TFPgtkWidget); Overload;
  1769. procedure Prepend (MenuItem:TFPgtkWidget; CreateVisible:boolean); Overload;
  1770. procedure Insert (MenuItem:TFPgtkWidget; position:integer); Overload;
  1771. procedure Insert (MenuItem:TFPgtkWidget; position:integer; CreateVisible:boolean); Overload;
  1772. procedure Append (MenuItem:TFPgtkWidget); Overload;
  1773. procedure Append (MenuItem:TFPgtkWidget; CreateVisible:boolean); Overload;
  1774. function ConnectDeActivate (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1775. function ConnectAfterDeActivate (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1776. function ConnectSelectionDone (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1777. function ConnectAfterSelectionDone (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1778. function ConnectCancel (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1779. function ConnectAfterCancel (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1780. function ConnectMoveCurrent (proc:TFPgtkMoveCurrentSignalFunction; data:pointer) : guint;
  1781. function ConnectAfterMoveCurrent (proc:TFPgtkMoveCurrentSignalFunction; data:pointer) : guint;
  1782. function ConnectActivateCurrent (proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  1783. function ConnectAfterActivateCurrent (proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  1784. end;
  1785. TFPgtkMenuBar = class (TFPgtkMenuShell)
  1786. Private
  1787. function GetShadow : TgtkShadowType;
  1788. procedure SetShadow (TheValue : TgtkShadowType);
  1789. Protected
  1790. procedure CreateGtkObject; override;
  1791. procedure GtkPrepend (MenuItem:TFPgtkWidget); Override;
  1792. procedure GtkInsert (MenuItem:TFPgtkWidget; position:integer); Override;
  1793. procedure GtkAppend (MenuItem:TFPgtkWidget); Override;
  1794. Public
  1795. function TheGtkObject : PGtkMenuBar;
  1796. property Shadow : TgtkShadowType read GetShadow write SetShadow;
  1797. end;
  1798. TFPgtkMenuDetachFunction = procedure (Widget:TFPgtkWidget; menu:TFPgtkMenu) of object;
  1799. TFPgtkMenuPosFunction = procedure (menu:TFPgtkMenu; var x,y:integer; data:pointer) of object;
  1800. TFPgtkMenu = class (TFPgtkMenuShell)
  1801. Private
  1802. procedure SetTitle (TheValue : string);
  1803. function GetActive : TFPgtkWidget;
  1804. procedure SetActive (TheValue : TFPgtkWidget);
  1805. function GetActiveIndex : integer;
  1806. procedure SetActiveIndex (TheValue : integer);
  1807. function GetTearOffState : boolean;
  1808. procedure SetTearOffState (TheValue : boolean);
  1809. function GetAttachedTo : TFPgtkWidget;
  1810. procedure SetAttachedTo (TheValue : TFPgtkWidget);
  1811. function GetAccelGroup : PGtkAccelGroup;
  1812. procedure SetAccelGroup (TheValue : PGtkAccelGroup);
  1813. Protected
  1814. procedure CreateGtkObject; override;
  1815. procedure GtkPrepend (MenuItem:TFPgtkWidget); Override;
  1816. procedure GtkInsert (MenuItem:TFPgtkWidget; position:integer); Override;
  1817. procedure GtkAppend (MenuItem:TFPgtkWidget); Override;
  1818. Public
  1819. FDetacher:TFPgtkMenuDetachFunction;
  1820. function TheGtkObject : PGtkMenu;
  1821. procedure ReorderChild (MenuItem:TFPgtkWidget; position:integer);
  1822. procedure Popup (button:guint); Overload;
  1823. procedure Popup (ParentShell:TFPgtkWidget; ParentItem:TFPgtkWidget; func:TFPgtkMenuPosFunction; data:pointer; button:guint; ActivateTime:guint32); Overload;
  1824. procedure PopDown;
  1825. procedure Reposition;
  1826. procedure AttachToWidget (Widget:TFPgtkWidget; detacher:TFPgtkMenuDetachFunction);
  1827. procedure Detach;
  1828. property Title : string write SetTitle;
  1829. property Active : TFPgtkWidget read GetActive write SetActive;
  1830. property ActiveIndex : integer read GetActiveIndex write SetActiveIndex;
  1831. property TearOffState : boolean read GetTearOffState write SetTearOffState;
  1832. property AttachedTo : TFPgtkWidget read GetAttachedTo write SetAttachedTo;
  1833. property AccelGroup : PGtkAccelGroup read GetAccelGroup write SetAccelGroup;
  1834. end;
  1835. TFPgtkPacker = class (TFPgtkContainer)
  1836. Private
  1837. function GetSpacing : guint;
  1838. procedure SetSpacing (TheValue : guint);
  1839. Protected
  1840. procedure CreateGtkObject; override;
  1841. Public
  1842. function TheGtkObject : PGtkPacker;
  1843. procedure Add (Child:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions); Overload;
  1844. procedure Add (Child:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions; aVisible:boolean); Overload;
  1845. procedure Add (Child:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions; aBorder:guint; PadX:Guint; PadY:guint; IPadX:guint; IPadY:guint); Overload;
  1846. procedure Add (Child:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions; aBorder:guint; PadX:Guint; PadY:guint; IPadX:guint; IPadY:guint; aVisible:boolean); Overload;
  1847. procedure ReorderChild (aChild:TFPgtkWidget; position:integer);
  1848. property Spacing : guint read GetSpacing write SetSpacing;
  1849. procedure DefaultBorder (aBorder:guint);
  1850. procedure DefaultPad (PadX:guint; PadY:guint);
  1851. procedure DefaultIPad (IPadX:guint; IPadY:guint);
  1852. procedure Configure (aChild:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions; aBorder:guint; PadX:Guint; PadY:guint; IPadX:guint; IPadY:guint); Overload;
  1853. end;
  1854. TFPgtkTable = class (TFPgtkContainer)
  1855. Private
  1856. function GetRowCount : integer;
  1857. function GetColCount : integer;
  1858. function GetHomogeneous : boolean;
  1859. procedure SetHomogeneous (TheValue : boolean);
  1860. function GetRowSpacings : integer;
  1861. procedure SetRowSpacings (TheValue : integer);
  1862. function GetColSpacings : integer;
  1863. procedure SetColSpacings (TheValue : integer);
  1864. Protected
  1865. procedure CreateGtkObject; override;
  1866. Public
  1867. function TheGtkObject : PGtkTable;
  1868. constructor Create (AColumns:integer; ARows:integer);
  1869. procedure Resize (AColumns:integer; ARows:integer);
  1870. procedure Attach (Widget:TFPgtkWidget; left:integer; right:integer; top:integer; bottom:integer; XOptions:integer; YOptions:integer; XPadding:integer; YPadding:integer; IsVisible:boolean);
  1871. procedure Attach (Widget:TFPgtkWidget; left:integer; right:integer; top:integer; bottom:integer; XOptions:integer; YOptions:integer; XPadding:integer; YPadding:integer);
  1872. procedure Attach (Widget:TFPgtkWidget; left:integer; right:integer; top:integer; bottom:integer; IsVisible:boolean);
  1873. procedure Attach (Widget:TFPgtkWidget; left:integer; right:integer; top:integer; bottom:integer);
  1874. property RowCount : integer read GetRowCount;
  1875. property ColCount : integer read GetColCount;
  1876. property Homogeneous : boolean read GetHomogeneous write SetHomogeneous;
  1877. property RowSpacings : integer read GetRowSpacings write SetRowSpacings;
  1878. property ColSpacings : integer read GetColSpacings write SetColSpacings;
  1879. procedure SetOneRowSpacing (row:integer; TheValue:integer);
  1880. procedure SetOneColSpacing (Column:integer; TheValue:integer);
  1881. end;
  1882. TFPgtkToolbar = class (TFPgtkContainer)
  1883. Private
  1884. function GetButtonRelief : TGtkReliefStyle;
  1885. procedure SetButtonRelief (TheValue : TGtkReliefStyle);
  1886. function GetTooltips : TFPgtkTooltips;
  1887. function GetEnableTooltips : longbool;
  1888. procedure SetEnableTooltips (TheValue : longbool);
  1889. function GetSpaceStyle : TGtkToolbarSpaceStyle;
  1890. procedure SetSpaceStyle (TheValue : TGtkToolbarSpaceStyle);
  1891. function GetSpaceSize : integer;
  1892. procedure SetSpaceSize (TheValue : integer);
  1893. function GetStyle : TGtkToolbarStyle;
  1894. procedure SetStyle (TheValue : TGtkToolbarStyle);
  1895. function GetOrientation : tGtkOrientation;
  1896. procedure SetOrientation (TheValue : tGtkOrientation);
  1897. Protected
  1898. procedure CreateGtkObject; override;
  1899. Public
  1900. function TheGtkObject : PGtkToolbar;
  1901. property ButtonRelief : TGtkReliefStyle read GetButtonRelief write SetButtonRelief;
  1902. property Tooltips : TFPgtkTooltips read GetTooltips;
  1903. property EnableTooltips : longbool read GetEnableTooltips write SetEnableTooltips;
  1904. property SpaceStyle : TGtkToolbarSpaceStyle read GetSpaceStyle write SetSpaceStyle;
  1905. property SpaceSize : integer read GetSpaceSize write SetSpaceSize;
  1906. property Style : TGtkToolbarStyle read GetStyle write SetStyle;
  1907. property Orientation : tGtkOrientation read GetOrientation write SetOrientation;
  1908. procedure InsertWidget (Widget:TFPgtkWidget; TooltipText:string; TooltipPrivate:string; Position:integer);
  1909. procedure PrependWidget (Widget:TFPgtkWidget; TooltipText:string; TooltipPrivate:string);
  1910. procedure AppendWidget (Widget:TFPgtkWidget; TooltipText:string; TooltipPrivate:string);
  1911. function InsertElement (ButtonType:TGtkToolbarChildType; PrevRadioBut:TFPgtkWidget; Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer; position:integer) : TFPgtkWidget;
  1912. function AppendElement (ButtonType:TGtkToolbarChildType; PrevRadioBut:TFPgtkWidget; Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget;
  1913. function PrependElement (ButtonType:TGtkToolbarChildType; PrevRadioBut:TFPgtkWidget; Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget;
  1914. function InsertItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer; position:integer) : TFPgtkWidget; Overload;
  1915. function AppendItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget; Overload;
  1916. function PrependItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget; Overload;
  1917. function InsertItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:array of string; CallBack:TFPgtkSignalFunction; data:pointer; position:integer) : TFPgtkWidget; Overload;
  1918. function AppendItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:array of string; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget; Overload;
  1919. function PrependItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:array of string; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget; Overload;
  1920. procedure InsertSpace (position:integer);
  1921. procedure AppendSpace;
  1922. procedure PrependSpace;
  1923. end;
  1924. TFPgtkTree = class (TFPgtkContainer)
  1925. Private
  1926. function GetSelectionMode : TGtkSelectionMode;
  1927. procedure SetSelectionMode (TheValue : TGtkSelectionMode);
  1928. function GetViewLines : boolean;
  1929. procedure SetViewLines (TheValue : boolean);
  1930. function GetViewMode : TGtkTreeViewMode;
  1931. procedure SetViewMode (TheValue : TGtkTreeViewMode);
  1932. Protected
  1933. procedure CreateGtkObject; override;
  1934. Public
  1935. function TheGtkObject : PGtkTree;
  1936. function ConnectSelectionChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1937. function ConnectAfterSelectionChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  1938. function ConnectSelectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1939. function ConnectAfterSelectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1940. function ConnectUnselectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1941. function ConnectAfterUnselectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  1942. property SelectionMode : TGtkSelectionMode read GetSelectionMode write SetSelectionMode;
  1943. property ViewLines : boolean read GetViewLines write SetViewLines;
  1944. property ViewMode : TGtkTreeViewMode read GetViewMode write SetViewMode;
  1945. procedure Append (TreeItem:TFPgtkWidget);
  1946. procedure Prepend (TreeItem:TFPgtkWidget);
  1947. procedure Insert (TreeItem:TFPgtkWidget; position:integer);
  1948. procedure Remove (TreeItem:TFPgtkWidget);
  1949. procedure ClearItems (StartPos:integer; EndPos:integer);
  1950. procedure SelectItem (Item:integer);
  1951. procedure UnselectItem (Item:integer);
  1952. procedure SelectChild (TreeItem:TFPgtkWidget);
  1953. procedure UnselectChild (TreeItem:TFPgtkWidget);
  1954. function ChildPosition (TreeItem:TFPgtkWidget) : integer;
  1955. function RootTree : TFPgtkTree;
  1956. function IsRootTree : boolean;
  1957. procedure GetSelection (aGroup:TFPgtkGroup);
  1958. function Level : integer;
  1959. end;
  1960. TFPgtkCalendar = class (TFPgtkWidget)
  1961. Private
  1962. function GetDisplayOptions : TGtkCalendarDisplayOptions;
  1963. procedure SetDisplayOptions (TheValue : TGtkCalendarDisplayOptions);
  1964. function GetDate : TDatetime;
  1965. procedure SetDate (TheValue : TDatetime);
  1966. Protected
  1967. procedure CreateGtkObject; override;
  1968. Public
  1969. function TheGtkObject : PGtkCalendar;
  1970. function SelectMonth (aMonth:guint; aYear:guint) : integer;
  1971. procedure SelectDay (aDay:guint);
  1972. function MarkDay (aDay:guint) : integer;
  1973. function UnmarkDay (aDay:guint) : integer;
  1974. procedure ClearMarks;
  1975. property DisplayOptions : TGtkCalendarDisplayOptions read GetDisplayOptions write SetDisplayOptions;
  1976. property Date : TDatetime read GetDate write SetDate;
  1977. procedure Freeze;
  1978. procedure Thaw;
  1979. function ConnectMonthChanged (proc:TFPgtksignalFunction; data:pointer) : guint;
  1980. function ConnectAfterMonthChanged (proc:TFPgtksignalFunction; data:pointer) : guint;
  1981. function ConnectDaySelected (proc:TFPgtksignalFunction; data:pointer) : guint;
  1982. function ConnectAfterDaySelected (proc:TFPgtksignalFunction; data:pointer) : guint;
  1983. function ConnectDaySelectedDoubleClick (proc:TFPgtksignalFunction; data:pointer) : guint;
  1984. function ConnectAfterDaySelectedDoubleClick (proc:TFPgtksignalFunction; data:pointer) : guint;
  1985. function ConnectPrevMonth (proc:TFPgtksignalFunction; data:pointer) : guint;
  1986. function ConnectAfterPrevMonth (proc:TFPgtksignalFunction; data:pointer) : guint;
  1987. function ConnectNextMonth (proc:TFPgtksignalFunction; data:pointer) : guint;
  1988. function ConnectAfterNextMonth (proc:TFPgtksignalFunction; data:pointer) : guint;
  1989. function ConnectPrevYear (proc:TFPgtksignalFunction; data:pointer) : guint;
  1990. function ConnectAfterPrevYear (proc:TFPgtksignalFunction; data:pointer) : guint;
  1991. function ConnectNextYear (proc:TFPgtksignalFunction; data:pointer) : guint;
  1992. function ConnectAfterNextYear (proc:TFPgtksignalFunction; data:pointer) : guint;
  1993. end;
  1994. TFPgtkDrawingArea = class (TFPgtkWidget)
  1995. Protected
  1996. procedure CreateGtkObject; override;
  1997. Public
  1998. function TheGtkObject : PGtkDrawingArea;
  1999. procedure SetSize (Width:integer; Height:integer);
  2000. end;
  2001. TFPgtkCurve = class (TFPgtkDrawingArea)
  2002. Private
  2003. function GetCurveType : TGtkCurveType;
  2004. procedure SetCurveType (TheValue : TGtkCurveType);
  2005. Protected
  2006. procedure CreateGtkObject; override;
  2007. Public
  2008. function TheGtkObject : PGtkCurve;
  2009. procedure SetRange (MinX:float; MaxX:float; MinY:float; MaxY:float);
  2010. procedure Reset;
  2011. procedure SetGamma (GammaValue:float);
  2012. property CurveType : TGtkCurveType read GetCurveType write SetCurveType;
  2013. end;
  2014. TFPgtkInsertSignalFunction = procedure (Sender:TFPgtkObject; NewText:string; TextLength:integer; var Position:integer; data:pointer) of Object;
  2015. TFPgtkDeleteSignalFunction = procedure (Sender:TFPgtkObject; StartPos:integer; EndPos:integer; data:pointer) of Object;
  2016. TFPgtkXYSignalFunction = procedure (Sender:TFPgtkObject; x:integer; y:integer; data:pointer) of Object;
  2017. TFPgtkDirectionSignalFunction = procedure (Sender:TFPgtkObject; Direction:integer; data:pointer) of Object;
  2018. TFPgtkMoveWordSignalFunction = procedure (Sender:TFPgtkObject; NumWords:integer; data:pointer) of Object;
  2019. TFPgtkMovetoSignalFunction = procedure (Sender:TFPgtkObject; MoveTo:integer; data:pointer) of Object;
  2020. TFPgtkEditable = class (TFPgtkWidget)
  2021. Private
  2022. function GetEditable : boolean;
  2023. procedure SetEditable (TheValue : boolean);
  2024. function GetVisible : boolean;
  2025. procedure SetVisible (TheValue : boolean);
  2026. function GetPosition : integer;
  2027. procedure SetPosition (TheValue : integer);
  2028. function GetSelectionStart : integer;
  2029. procedure SetSelectionStart (TheValue : integer);
  2030. function GetSelectionEnd : integer;
  2031. procedure SetSelectionEnd (TheValue : integer);
  2032. function GetSelection : string;
  2033. Protected
  2034. function GetHasSelection : boolean; Dynamic;
  2035. procedure SetSelection (TheValue:string); Dynamic;
  2036. function GetText : string; Dynamic;
  2037. procedure SetText (TheValue:string); Dynamic; Abstract;
  2038. Public
  2039. function TheGtkObject : PGtkEditable;
  2040. property HasSelection : boolean read GetHasSelection;
  2041. property Editable : boolean read GetEditable write SetEditable;
  2042. property Visible : boolean read GetVisible write SetVisible;
  2043. property Position : integer read GetPosition write SetPosition;
  2044. property SelectionStart : integer read GetSelectionStart write SetSelectionStart;
  2045. property SelectionEnd : integer read GetSelectionEnd write SetSelectionEnd;
  2046. property Selection : string read GetSelection write SetSelection;
  2047. property Text : string read GetText write SetText;
  2048. procedure Changed;
  2049. procedure InsertText (NewText:string; AtPosition:integer);
  2050. procedure DeleteText (StartPos:integer; EndPos:integer);
  2051. procedure GetChars (StartPos:integer; EndPos:integer);
  2052. procedure CutClipboard;
  2053. procedure CopyClipboard;
  2054. procedure PasteClipboard;
  2055. procedure SelectRegion (StartPos:integer; EndPos:integer);
  2056. procedure ClaimSelection (claim:boolean; time:guint32);
  2057. procedure DeleteSelection;
  2058. procedure Clear;
  2059. function InsertSignalConnect (Signal:string; Proc:TFPgtkInsertSignalFunction; data:pointer) : guint;
  2060. function InsertSignalConnectAfter (Signal:string; Proc:TFPgtkInsertSignalFunction; data:pointer) : guint;
  2061. function DeleteSignalConnect (Signal:string; Proc:TFPgtkDeleteSignalFunction; data:pointer) : guint;
  2062. function DeleteSignalConnectAfter (Signal:string; Proc:TFPgtkDeleteSignalFunction; data:pointer) : guint;
  2063. function XYSignalConnect (Signal:string; Proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  2064. function XYSignalConnectAfter (Signal:string; Proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  2065. function DirectionSignalConnect (Signal:string; Proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  2066. function DirectionSignalConnectAfter (Signal:string; Proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  2067. function MoveWordSignalConnect (Signal:string; Proc:TFPgtkMoveWordSignalFunction; data:pointer) : guint;
  2068. function MoveWordSignalConnectAfter (Signal:string; Proc:TFPgtkMoveWordSignalFunction; data:pointer) : guint;
  2069. function MovetoSignalConnect (Signal:string; Proc:TFPgtkMovetoSignalFunction; data:pointer) : guint;
  2070. function MovetoSignalConnectAfter (Signal:string; Proc:TFPgtkMovetoSignalFunction; data:pointer) : guint;
  2071. function ConnectChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2072. function ConnectAfterChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2073. function ConnectActivate (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2074. function ConnectAfterActivate (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2075. function ConnectInsertText (proc:TFPgtkInsertSignalFunction; data:pointer) : guint;
  2076. function ConnectAfterInsertText (proc:TFPgtkInsertSignalFunction; data:pointer) : guint;
  2077. function ConnectDeleteText (proc:TFPgtkDeleteSignalFunction; data:pointer) : guint;
  2078. function ConnectAfterDeleteText (proc:TFPgtkDeleteSignalFunction; data:pointer) : guint;
  2079. function ConnectSetEditable (proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  2080. function ConnectAfterSetEditable (proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  2081. function ConnectMoveCursor (proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  2082. function ConnectAfterMoveCursor (proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  2083. function ConnectMoveWord (proc:TFPgtkMoveWordSignalFunction; data:pointer) : guint;
  2084. function ConnectAfterMoveWord (proc:TFPgtkMoveWordSignalFunction; data:pointer) : guint;
  2085. function ConnectMovePage (proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  2086. function ConnectAfterMovePage (proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  2087. function ConnectMoveToRow (proc:TFPgtkMoveToSignalFunction; data:pointer) : guint;
  2088. function ConnectAfterMoveToRow (proc:TFPgtkMoveToSignalFunction; data:pointer) : guint;
  2089. function ConnectMoveToCol (proc:TFPgtkMoveToSignalFunction; data:pointer) : guint;
  2090. function ConnectAfterMoveToCol (proc:TFPgtkMoveToSignalFunction; data:pointer) : guint;
  2091. function ConnectKillChar (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  2092. function ConnectAfterKillChar (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  2093. function ConnectKillWord (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  2094. function ConnectAfterKillWord (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  2095. function ConnectKillLine (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  2096. function ConnectAfterKillLine (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  2097. function ConnectCutClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2098. function ConnectAfterCutClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2099. function ConnectCopyClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2100. function ConnectAfterCopyClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2101. function ConnectPasteClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2102. function ConnectAfterPasteClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2103. end;
  2104. TFPgtkEntry = class (TFPgtkEditable)
  2105. Private
  2106. function GetVisibility : boolean;
  2107. procedure SetVisibility (TheValue : boolean);
  2108. function GetMaxLength : word;
  2109. procedure SetMaxLength (TheValue : word);
  2110. Protected
  2111. procedure CreateGtkObject; override;
  2112. procedure SetText (TheValue:string); Override;
  2113. Public
  2114. function TheGtkObject : PGtkEntry;
  2115. procedure AppendText (aText:string);
  2116. procedure PrependText (aText:string);
  2117. property Visibility : boolean read GetVisibility write SetVisibility;
  2118. property MaxLength : word read GetMaxLength write SetMaxLength;
  2119. end;
  2120. TFPgtkSpinButton = class (TFPgtkEntry)
  2121. Private
  2122. function GetAdjustment : TFPgtkAdjustment;
  2123. procedure SetAdjustment (TheValue : TFPgtkAdjustment);
  2124. function GetClimbRate : gfloat;
  2125. procedure SetClimbRate (TheValue : gfloat);
  2126. function GetDigits : integer;
  2127. procedure SetDigits (TheValue : integer);
  2128. function GetAsInteger : integer;
  2129. procedure SetAsInteger (TheValue : integer);
  2130. function GetAsFloat : gfloat;
  2131. procedure SetAsFloat (TheValue : gfloat);
  2132. function GetUpdatePolicy : TGtkSpinButtonUpdatePolicy;
  2133. procedure SetUpdatePolicy (TheValue : TGtkSpinButtonUpdatePolicy);
  2134. function GetNumeric : boolean;
  2135. procedure SetNumeric (TheValue : boolean);
  2136. function GetWrap : boolean;
  2137. procedure SetWrap (TheValue : boolean);
  2138. function GetShadowType : TGtkShadowType;
  2139. procedure SetShadowType (TheValue : TGtkShadowType);
  2140. function GetSnapToTicks : boolean;
  2141. procedure SetSnapToTicks (TheValue : boolean);
  2142. Protected
  2143. procedure CreateGtkObject; override;
  2144. Public
  2145. function TheGtkObject : PGtkSpinButton;
  2146. procedure Configure (Adj:TFPgtkAdjustment; aClimbRate:gfloat; aDigits:integer);
  2147. property Adjustment : TFPgtkAdjustment read GetAdjustment write SetAdjustment;
  2148. property ClimbRate : gfloat read GetClimbRate write SetClimbRate;
  2149. property Digits : integer read GetDigits write SetDigits;
  2150. property AsInteger : integer read GetAsInteger write SetAsInteger;
  2151. property AsFloat : gfloat read GetAsFloat write SetAsFloat;
  2152. property UpdatePolicy : TGtkSpinButtonUpdatePolicy read GetUpdatePolicy write SetUpdatePolicy;
  2153. property Numeric : boolean read GetNumeric write SetNumeric;
  2154. procedure Spin (direction:TGtkSpinType; increment:gfloat);
  2155. property Wrap : boolean read GetWrap write SetWrap;
  2156. property ShadowType : TGtkShadowType read GetShadowType write SetShadowType;
  2157. property SnapToTicks : boolean read GetSnapToTicks write SetSnapToTicks;
  2158. procedure Update;
  2159. end;
  2160. TFPgtkText = class (TFPgtkEditable)
  2161. Private
  2162. FLines:TStrings;
  2163. FIsChanged:boolean;
  2164. procedure SigChanged (Sender:TFPgtkObject; data:pointer);
  2165. function GetLines : TStrings;
  2166. function GetWordWrap : boolean;
  2167. procedure SetWordWrap (TheValue : boolean);
  2168. function GetLineWrap : boolean;
  2169. procedure SetLineWrap (TheValue : boolean);
  2170. function GetPoint : integer;
  2171. procedure SetPoint (TheValue : integer);
  2172. function GetHAdjustment : TFPgtkAdjustment;
  2173. procedure SetHAdjustment (TheValue : TFPgtkAdjustment);
  2174. function GetVAdjustment : TFPgtkAdjustment;
  2175. procedure SetVAdjustment (TheValue : TFPgtkAdjustment);
  2176. Protected
  2177. procedure CreateGtkObject; override;
  2178. procedure RefreshLines;
  2179. procedure SetText (TheValue:string); Override;
  2180. Public
  2181. function TheGtkObject : PGtkText;
  2182. constructor Create;
  2183. destructor Destroy; Override;
  2184. property Lines : TStrings read GetLines;
  2185. procedure Freeze;
  2186. procedure Thaw;
  2187. function TextLength : guint;
  2188. procedure Insert (font:PgdkFont; fore:PgdkColor; back:PgdkColor; TheText:string);
  2189. procedure DeleteBackward (number:longword);
  2190. procedure DeleteForward (number:longword);
  2191. property WordWrap : boolean read GetWordWrap write SetWordWrap;
  2192. property LineWrap : boolean read GetLineWrap write SetLineWrap;
  2193. property Point : integer read GetPoint write SetPoint;
  2194. procedure SetAdjustments (hadj:TFPgtkAdjustment; vadj:TFPgtkAdjustment);
  2195. property HAdjustment : TFPgtkAdjustment read GetHAdjustment write SetHAdjustment;
  2196. property VAdjustment : TFPgtkAdjustment read GetVAdjustment write SetVAdjustment;
  2197. end;
  2198. TFPgtkRuler = class (TFPgtkWidget)
  2199. Public
  2200. function TheGtkObject : PGtkRuler;
  2201. procedure SetMetric (aMetric:TGtkMetricType);
  2202. procedure SetRange (Lower:float; Upper:float; Position:float; MaxSize:float);
  2203. end;
  2204. TFPgtkHRuler = class (TFPgtkRuler)
  2205. Protected
  2206. procedure CreateGtkObject; override;
  2207. Public
  2208. function TheGtkObject : PGtkHRuler;
  2209. end;
  2210. TFPgtkVRuler = class (TFPgtkRuler)
  2211. Protected
  2212. procedure CreateGtkObject; override;
  2213. Public
  2214. function TheGtkObject : PGtkVRuler;
  2215. end;
  2216. TFPgtkRange = class (TFPgtkWidget)
  2217. Private
  2218. function GetAdjustment : TFPgtkAdjustment;
  2219. procedure SetAdjustment (TheValue : TFPgtkAdjustment);
  2220. function GetUpdatePolicy : TgtkUpdateType;
  2221. procedure SetUpdatePolicy (TheValue : TgtkUpdateType);
  2222. Protected
  2223. FAdj:TFPgtkAdjustment;
  2224. Public
  2225. function TheGtkObject : PGtkRange;
  2226. property Adjustment : TFPgtkAdjustment read GetAdjustment write SetAdjustment;
  2227. property UpdatePolicy : TgtkUpdateType read GetUpdatePolicy write SetUpdatePolicy;
  2228. constructor Create (AnAdjustment:TFPgtkAdjustment);
  2229. procedure DrawBackground;
  2230. procedure DrawTrough;
  2231. procedure DrawStepForw;
  2232. procedure DrawStepBack;
  2233. procedure DrawSlider;
  2234. procedure SliderUpdate;
  2235. function TroughClick (X:integer; Y:integer; var JumpPerc:gfloat) : integer;
  2236. procedure DefaultHSliderUpdate;
  2237. procedure DefaultVSliderUpdate;
  2238. function DefaultHTroughClick (X:integer; Y:integer; var JumpPerc:gfloat) : integer;
  2239. function DefaultVTroughClick (X:integer; Y:integer; var JumpPerc:gfloat) : integer;
  2240. procedure defaultHMotion (XDelta:integer; YDelta:integer);
  2241. procedure defaultVMotion (XDelta:integer; YDelta:integer);
  2242. procedure ClearBackground;
  2243. end;
  2244. TFPgtkScale = class (TFPgtkRange)
  2245. Private
  2246. function GetDrawValue : boolean;
  2247. procedure SetDrawValue (TheValue : boolean);
  2248. function GetValuePos : TGtkPositionType;
  2249. procedure SetValuePos (TheValue : TGtkPositionType);
  2250. Public
  2251. function TheGtkObject : PGtkScale;
  2252. procedure SetDigits (TheValue:integer);
  2253. property DrawValue : boolean read GetDrawValue write SetDrawValue;
  2254. property ValuePos : TGtkPositionType read GetValuePos write SetValuePos;
  2255. end;
  2256. TFPgtkHScale = class (TFPgtkScale)
  2257. Protected
  2258. procedure CreateGtkObject; override;
  2259. Public
  2260. function TheGtkObject : PGtkHScale;
  2261. end;
  2262. TFPgtkVScale = class (TFPgtkScale)
  2263. Protected
  2264. procedure CreateGtkObject; override;
  2265. Public
  2266. function TheGtkObject : PGtkVScale;
  2267. end;
  2268. TFPgtkScrollbar = class (TFPgtkRange)
  2269. Public
  2270. function TheGtkObject : PGtkScrollbar;
  2271. end;
  2272. TFPgtkHScrollbar = class (TFPgtkScrollbar)
  2273. Protected
  2274. procedure CreateGtkObject; Override;
  2275. Public
  2276. function TheGtkObject : PGtkHScrollbar;
  2277. end;
  2278. TFPgtkVScrollbar = class (TFPgtkScrollbar)
  2279. Protected
  2280. procedure CreateGtkObject; Override;
  2281. Public
  2282. end;
  2283. TFPgtkSeparator = class (TFPgtkWidget)
  2284. Public
  2285. function TheGtkObject : PGtkSeparator;
  2286. end;
  2287. TFPgtkHSeparator = class (TFPgtkSeparator)
  2288. Protected
  2289. procedure CreateGtkObject; override;
  2290. Public
  2291. function TheGtkObject : PGtkHSeparator;
  2292. end;
  2293. TFPgtkVSeparator = class (TFPgtkSeparator)
  2294. Protected
  2295. procedure CreateGtkObject; override;
  2296. Public
  2297. function TheGtkObject : PGtkVSeparator;
  2298. end;
  2299. TFPgtkPreview = class (TFPgtkWidget)
  2300. Private
  2301. function GetExpand : longbool;
  2302. procedure SetExpand (TheValue : longbool);
  2303. function GetDither : TGdkRgbDither;
  2304. procedure SetDither (TheValue : TGdkRgbDither);
  2305. Protected
  2306. procedure CreateGtkObject; override;
  2307. Public
  2308. function TheGtkObject : PGtkPreview;
  2309. procedure Size (aWidth:integer; aHeight:integer);
  2310. procedure Put (aWindow:PGdkWindow; gc:PGdkGC; SrcX:integer; SrcY:integer; destX:integer; DestY:integer; aWidth:integer; aHeight:integer);
  2311. procedure DrawRow (data:pguchar; X:integer; Y:integer; W:integer);
  2312. property Expand : longbool read GetExpand write SetExpand;
  2313. property Dither : TGdkRgbDither read GetDither write SetDither;
  2314. end;
  2315. TFPgtkProgress = class (TFPgtkWidget)
  2316. Private
  2317. function GetShowtext : longbool;
  2318. procedure SetShowtext (TheValue : longbool);
  2319. function GetTextXAlign : gfloat;
  2320. procedure SetTextXAlign (TheValue : gfloat);
  2321. function GetTextYAlign : gfloat;
  2322. procedure SetTextYAlign (TheValue : gfloat);
  2323. function GetCurrentValue : float;
  2324. procedure SetCurrentValue (TheValue : float);
  2325. function GetPercentage : float;
  2326. procedure SetPercentage (TheValue : float);
  2327. function GetFormatString : string;
  2328. procedure SetFormatString (TheValue : string);
  2329. function GetAdjustment : TFPgtkAdjustment;
  2330. procedure SetAdjustment (TheValue : TFPgtkAdjustment);
  2331. function GetActivityMode : longbool;
  2332. procedure SetActivityMode (TheValue : longbool);
  2333. Public
  2334. function TheGtkObject : PGtkProgress;
  2335. property Showtext : longbool read GetShowtext write SetShowtext;
  2336. property TextXAlign : gfloat read GetTextXAlign write SetTextXAlign;
  2337. property TextYAlign : gfloat read GetTextYAlign write SetTextYAlign;
  2338. procedure SetTextAlignment (anXalign:gfloat; anYAlign:gfloat);
  2339. property CurrentValue : float read GetCurrentValue write SetCurrentValue;
  2340. property Percentage : float read GetPercentage write SetPercentage;
  2341. function PercentageFromValue (aValue:gfloat) : gfloat;
  2342. property FormatString : string read GetFormatString write SetFormatString;
  2343. property Adjustment : TFPgtkAdjustment read GetAdjustment write SetAdjustment;
  2344. property ActivityMode : longbool read GetActivityMode write SetActivityMode;
  2345. function CurrentText : string;
  2346. function TextFromValue (aValue:gfloat) : string;
  2347. procedure Configure (aValue:gfloat; aMin:gfloat; aMax:gfloat);
  2348. end;
  2349. TFPgtkProgressBar = class (TFPgtkProgress)
  2350. Private
  2351. FAdj:TFPgtkAdjustment;
  2352. function GetBarStyle : TGtkProgressBarStyle;
  2353. procedure SetBarStyle (TheValue : TGtkProgressBarStyle);
  2354. function GetDiscreteBlocks : longword;
  2355. procedure SetDiscreteBlocks (TheValue : longword);
  2356. function GetActivityStep : longword;
  2357. procedure SetActivityStep (TheValue : longword);
  2358. function GetActivityBlocks : longword;
  2359. procedure SetActivityBlocks (TheValue : longword);
  2360. function GetOrientation : TGtkProgressBarOrientation;
  2361. procedure SetOrientation (TheValue : TGtkProgressBarOrientation);
  2362. Protected
  2363. procedure CreateGtkObject; Override;
  2364. Public
  2365. function TheGtkObject : PGtkProgressBar;
  2366. constructor Create (adj:TFPgtkAdjustment);
  2367. property BarStyle : TGtkProgressBarStyle read GetBarStyle write SetBarStyle;
  2368. property DiscreteBlocks : longword read GetDiscreteBlocks write SetDiscreteBlocks;
  2369. property ActivityStep : longword read GetActivityStep write SetActivityStep;
  2370. property ActivityBlocks : longword read GetActivityBlocks write SetActivityBlocks;
  2371. property Orientation : TGtkProgressBarOrientation read GetOrientation write SetOrientation;
  2372. end;
  2373. TFPgtkItemFactory = class (TFPgtkObject)
  2374. Public
  2375. end;
  2376. { TFPgtkToolTips }
  2377. var
  2378. TheTooltips : TFPgtkTooltips;
  2379. { TFPgtkButton }
  2380. const
  2381. DefaultButtonModifiers : TGdkModifierType = GDK_MOD1_MASK;
  2382. { TFPgtkWindow }
  2383. const
  2384. drNone = 0;
  2385. drOk = 1;
  2386. drCancel = 2;
  2387. drYes = 3;
  2388. drNo = 4;
  2389. drRetry = 5;
  2390. NoMainLevel = high (guint);
  2391. { TFPgtkFontSelection }
  2392. resourcestring
  2393. sFontNotFound = 'Can''t find font "%s" on this system';
  2394. Const
  2395. // TFPgtkObject
  2396. sgDestroy = 'destroy';
  2397. // TFPgtkData
  2398. sgDisconnect = 'disconnect';
  2399. // TFPgtkAdjustment
  2400. sgValueChanged = 'value_changed';
  2401. sgChanged = 'changed';
  2402. // TFPgtkWidget
  2403. sgShow = 'show';
  2404. sghide = 'hide';
  2405. sgmap = 'map';
  2406. sgunmap = 'unmap';
  2407. sgrealize = 'realize';
  2408. sgunrealize = 'unrealize';
  2409. sgDrawFocus = 'draw-focus';
  2410. sgDrawDefault = 'draw-defaut';
  2411. sgParentSet = 'parent-set';
  2412. sgGrabFocus = 'grab-focus';
  2413. sgEvent = 'event';
  2414. sgButtonPressEvent = 'button-press-event';
  2415. sgButtonReleaseEvent = 'button-release-event';
  2416. sgMotionNotifyEvent = 'motion-notify-event';
  2417. sgDeleteEvent = 'delete-event';
  2418. sgDestroyEvent = 'destroy-event';
  2419. sgExposeEvent = 'expose-event';
  2420. sgKeyPressEvent = 'key-press-event';
  2421. sgKeyReleaseEvent = 'key-release-event';
  2422. sgEnterNotifyEvent = 'enter-notify-event';
  2423. sgLeaveNotifyEvent = 'leave-notify-event';
  2424. sgConfigureEvent = 'configure-event';
  2425. sgFocusInEvent = 'focus-in-event';
  2426. sgFocusOutEvent = 'focus-out-event';
  2427. sgMapEvent = 'map-event';
  2428. sgUnmapEvent = 'unmap-event';
  2429. sgPropertyNotifyEvent = 'property-notify-event';
  2430. sgSelectionClearEvent = 'selection-clear-event';
  2431. sgSelectionRequestEvent = 'selection-request-event';
  2432. sgSelectionNotifyEvent = 'selection-notify-event';
  2433. sgProximityInEvent = 'proximity-in-event';
  2434. sgProximityOutEvent = 'proximity-out-event';
  2435. sgClientEvent = 'client-event';
  2436. sgNoExposeEvent = 'no-expose-event';
  2437. sgVisibilityNotifyEvent = 'visibility-notify-event';
  2438. // TFPgtkContainer
  2439. sgAdd = 'add';
  2440. sgRemove = 'remove';
  2441. sgCheckResize = 'check-resize';
  2442. sgFocus = 'focus';
  2443. sgSetFocusChild = 'set-focus';
  2444. // TFPgtkButton
  2445. sgClicked = 'clicked';
  2446. sgPressed = 'pressed';
  2447. sgReleased = 'released';
  2448. sgEnter = 'enter';
  2449. sgLeave = 'leave';
  2450. // TFPgtkToggleButton
  2451. sgToggled = 'toggled';
  2452. // TFPgtkItem
  2453. sgSelect = 'select';
  2454. sgDeselect = 'deselect';
  2455. sgToggle = 'toggle';
  2456. // TFPgtkMenuItem
  2457. sgActivate = 'activate';
  2458. sgActivateItem = 'activate-item';
  2459. // TFPgtkListItem
  2460. sgToggleFocusRow = 'toggle-focus-row';
  2461. sgSelectAll = 'select-all';
  2462. sgUnselectAll = 'unselect-all';
  2463. sgUndoSelection = 'undo-selection';
  2464. sgStartSelection = 'start-selection';
  2465. sgEndSelection = 'end-selection';
  2466. sgToggleAddMode = 'toggle-add-mode';
  2467. sgExtendSelection = 'extend-selection';
  2468. sgScrollVertical = 'scroll-vertical';
  2469. sgScrollHorizontal = 'scroll-horizontal';
  2470. // TFPgtkTreeItem
  2471. sgCollapse = 'collapse';
  2472. sgExpand = 'expand';
  2473. // TFPgtkWindow
  2474. sgSetFocus = 'set-focus';
  2475. // TFPgtkInputDialog
  2476. sgEnableDevice = 'enable-device';
  2477. sgDisableDevice = 'disable-device';
  2478. // TFPgtkHandleBox
  2479. sgChildAttached = 'child-attached';
  2480. sgChildDetached = 'child-detached';
  2481. // TFPgtkStatusbar
  2482. sgTextPopped = 'text-popped';
  2483. sgTextPushed = 'test-pushed';
  2484. // TFPgtkCList
  2485. sgSelectRow = 'select-row';
  2486. sgUnselectRow = 'unselect-row';
  2487. sgRowMove = 'row-move';
  2488. sgScrolHorizontal = 'scroll-horizontal';
  2489. sgAbortColumnResize = 'abort-column-resize';
  2490. sgClickColumn = 'click-column';
  2491. sgResizeColumn = 'resize-column';
  2492. // TFPgtkNotebook
  2493. sgSwitchPage = 'switch-page';
  2494. // TFPgtkList
  2495. sgSelectionChanged = 'selection-changed';
  2496. sgSelectChild = 'select-child';
  2497. sgUnselectChild = 'unselect-child';
  2498. // TFPgtkMenuShell
  2499. sgDeActivate = 'deactivate';
  2500. sgSelectionDone = 'selection-done';
  2501. sgCancel = 'cancel';
  2502. sgMoveCurrent = 'move-current';
  2503. sgActivateCurrent = 'activate-current';
  2504. // TFPgtkCalendar
  2505. sgMonthChanged = 'month-changed';
  2506. sgDaySelected = 'day-selected';
  2507. sgDaySelectedDoubleClick = 'day-selected-double-click';
  2508. sgPrevMonth = 'prev-month';
  2509. sgNextMonth = 'next-month';
  2510. sgPrevYear = 'prev-year';
  2511. sgNextYear = 'next-year';
  2512. // TFPgtkEditable
  2513. sgInsertText = 'insert-text';
  2514. sgDeleteText = 'delete-text';
  2515. sgSetEditable = 'set-editable';
  2516. sgMoveCursor = 'move-cursor';
  2517. sgMoveWord = 'move-word';
  2518. sgMovePage = 'move-page';
  2519. sgMoveToRow = 'move-to-row';
  2520. sgMoveToCol = 'move-to-column';
  2521. sgKillChar = 'kill-char';
  2522. sgKillWord = 'kill-word';
  2523. sgKillLine = 'kill-line';
  2524. sgCutClipboard = 'cut-clipboard';
  2525. sgCopyClipboard = 'copy-clipboard';
  2526. sgPasteClipboard = 'paste-clipboard';
  2527. // TFPgtkObject
  2528. function GetPascalInstance (gtkObject:PGtkObject; ObjClass:TFPgtkObjectClass) : TFPgtkObject; Overload;
  2529. function GetPascalInstance (gtkObject:PGtkObject) : TFPgtkObject; Overload;
  2530. function ConvertToGtkObject (AnObject:TFPgtkObject) : PGtkObject;
  2531. function ConvertToPgChar (AString:string) : PgChar;
  2532. function FreeFPgtkObjects (Data:pointer) : longbool; Cdecl;
  2533. procedure DestroyData (data:pointer); Cdecl;
  2534. function IntToPointer (Value:integer) : pointer;
  2535. function PointerToInt (Value:pointer) : integer;
  2536. // TFPgtkToolTips
  2537. function GetTooltipsData (Widget:TFPgtkWidget) : PGtkTooltipsData;
  2538. function ComposeTooltip (TooltipText:string; PrivText:string) : string;
  2539. procedure DecomposeTooltip (Tooltip:string; var TooltipText:string; var PrivText:string);
  2540. // TFPgtkWidget
  2541. function GetPascalInstance (Widget:PGtkWidget) : TFPgtkWidget; Overload;
  2542. function GetPascalInstance (Widget:PGtkWidget; ObjClass:TFPgtkObjectClass) : TFPgtkWidget; Overload;
  2543. function ConvertToGtkWidget (AnObject:TFPgtkWidget) : PGtkWidget;
  2544. // TFPgtkImage
  2545. function NewImage (aWidth:integer; aHeight:integer) : PGdkImage;
  2546. // TFPgtkPixmap
  2547. function StringsToPPgchar (Data:TStrings) : PPgchar;
  2548. function ArrayToPPgchar (Data:array of string) : PPgchar;
  2549. procedure CreateGdkPixmap (var ThePixmap:PGdkPixmap; var TheMask:PGdkBitmap; aWindow:PGdkWindow; data:array of string);
  2550. // TFPgtkRadioButtonGroup
  2551. function RadioButtonGroupCreateFromStrings (TheItems:TStrings; ToggledFunction:TFPgtkSignalFunction) : TFPgtkRadioButtonGroup;
  2552. // TFPgtkWindow
  2553. procedure AcceleratorAdd (AG:PGtkAccelGroup; aWidget:TFPgtkWidget; aSignal:string; Key:guint; Mods:TGdkModifierType; Flags:TGtkAccelFlags);
  2554. procedure AcceleratorRemove (AG:PGtkAccelGroup; aWidget:TFPgtkWidget; Key:guint; Mods:TGdkModifierType); Overload;
  2555. procedure AccelGroupLock (AG:PGtkAccelGroup);
  2556. procedure AccelGroupUnlock (AG:PGtkAccelGroup);
  2557. function AccelKeyName (Key:guint; Mods:TGdkModifierType) : string;
  2558. procedure AccelKeyParse (AccelName:string; var Key:guint; var Mods:TGdkModifierType);
  2559. procedure AccelGroupActivate (AG:PGtkAccelGroup; Key:guint; Mods:TGdkModifierType);
  2560. // TFPgtkButtonBox
  2561. procedure SetButtonBoxDefaultSize (aMinWidth:integer; aMinHeight:integer);
  2562. procedure GetButtonBoxDefaultSize (var aMinWidth:integer; var aMinHeight:integer);
  2563. procedure SetButtonBoxDefaultPadding (aIPadX:integer; aIPadY:integer);
  2564. procedure GetButtonBoxDefaultPadding (var aIPadX:integer; var aIPadY:integer);
  2565. // TFPgtkPreview
  2566. procedure SetGamma (aGamma:double);
  2567. IMPLEMENTATION
  2568. { TFPgtkObject }
  2569. function TFPgtkObject.TheGtkObject : PGtkObject;
  2570. begin
  2571. result := PgtkObject(FGtkObject);
  2572. end;
  2573. const
  2574. dtPascalInstance = 'Pascal_Instance';
  2575. type
  2576. TIntegerPointer = record
  2577. case word of
  2578. 0 : (i : integer);
  2579. 1 : (p : pointer);
  2580. end;
  2581. var
  2582. ObjectsToFree : TList;
  2583. ip : TIntegerPointer;
  2584. procedure Signalproc (Sender:PGtkobject; Data:pointer); cdecl;
  2585. var p : TFPgtkSignalFunction;
  2586. begin
  2587. with PSignalData(data)^ do
  2588. begin
  2589. p := TFPgtkSignalFunction (TheSignalProc);
  2590. p (TheWidget as TFPgtkObject, TheData)
  2591. end;
  2592. end;
  2593. function TFPgtkObject.SignalConnect (signal:string; proc:TFPgtkSignalFunction; data:pointer) : guint;
  2594. begin
  2595. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@Signalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  2596. end;
  2597. function TFPgtkObject.SignalConnectAfter (signal:string; proc:TFPgtkSignalFunction; data:pointer) : guint;
  2598. begin
  2599. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@Signalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  2600. end;
  2601. procedure BooleanSignalproc (Sender:PGtkobject; Bool:boolean; data:pointer); cdecl;
  2602. var p : TFPgtkBooleanSignalFunction;
  2603. begin
  2604. with PSignalData(data)^ do
  2605. begin
  2606. p := TFPgtkBooleanSignalFunction (TheSignalProc);
  2607. p (TheWidget as TFPgtkObject, Bool, TheData)
  2608. end;
  2609. end;
  2610. function TFPgtkObject.BooleanSignalConnect (signal:string; proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  2611. begin
  2612. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@BooleanSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  2613. end;
  2614. function TFPgtkObject.BooleanSignalConnectAfter (signal:string; proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  2615. begin
  2616. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@BooleanSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  2617. end;
  2618. function GetPascalInstance (gtkObject:PGtkObject; ObjClass:TFPgtkObjectClass) : TFPgtkObject; Overload;
  2619. begin
  2620. result := GetPascalInstance(GtkObject);
  2621. if not assigned(result) and assigned(GtkObject) then
  2622. result := ObjClass.CreateFromObject (GtkObject);
  2623. end;
  2624. function GetPascalInstance (gtkObject:PGtkObject) : TFPgtkObject; Overload;
  2625. var p : pointer;
  2626. begin
  2627. result := nil;
  2628. if assigned (gtkobject) then
  2629. begin
  2630. p := gtk_object_get_data (gtkObject, dtPascalInstance);
  2631. if assigned(p) then
  2632. result := PPascalClassData(p)^.TheInstance;
  2633. end;
  2634. end;
  2635. function ConvertToGtkObject (AnObject:TFPgtkObject) : PGtkObject;
  2636. begin
  2637. if assigned(AnObject) then
  2638. result := AnObject.TheGtkObject
  2639. else
  2640. result := nil;
  2641. end;
  2642. function ConvertToPgChar (AString:string) : PgChar;
  2643. begin
  2644. result := pointer(aString);
  2645. end;
  2646. function TFPgtkObject.ConvertSignalData (proc:TFPgtkSignalFunction; data:pointer; FreeIt:boolean) : PSignalData;
  2647. begin
  2648. new (result);
  2649. with result^ do
  2650. begin
  2651. TheSignalProc := proc;
  2652. TheWidget := self;
  2653. TheData := data;
  2654. end;
  2655. if FreeIt then
  2656. SignalDatas.Add (result);
  2657. end;
  2658. function FreeFPgtkObjects (Data:pointer) : longbool; Cdecl;
  2659. var r : integer;
  2660. obj : TFPgtkObject;
  2661. begin
  2662. for r := ObjectsToFree.Count-1 downto 0 do
  2663. begin
  2664. obj := TFPgtkObject(ObjectsToFree[r]);
  2665. if assigned (Obj) then
  2666. Obj.Free;
  2667. end;
  2668. ObjectsToFree.Clear;
  2669. result := False;
  2670. end;
  2671. procedure TFPgtkObject.FreeClass (Sender:TFPgtkObject; Data:pointer);
  2672. begin
  2673. if FDestroying = dsAlive then
  2674. begin
  2675. if ObjectsToFree.Count = 0 then
  2676. g_idle_Add (@FreeFPgtkObjects, null);
  2677. ObjectsToFree.Add (self);
  2678. FGtkObject := null;
  2679. FDestroying := dsWaiting;
  2680. end;
  2681. end;
  2682. procedure TFPgtkObject.CheckConvertDatas;
  2683. begin
  2684. if not assigned (ConvertDatas) then
  2685. begin
  2686. ConvertDatas := TStringList.Create;
  2687. ConvertDatas.Sorted := True;
  2688. end;
  2689. end;
  2690. procedure TFPgtkObject.CheckNotifyList;
  2691. begin
  2692. if not assigned (Notifylist) then
  2693. NotifyList := TList.Create;
  2694. end;
  2695. procedure TFPgtkObject.InitCreate;
  2696. begin
  2697. inherited create;
  2698. SignalDatas := TList.Create;
  2699. end;
  2700. procedure TFPgtkObject.FinalCreate;
  2701. begin
  2702. PascalInstance.TheInstance := Self;
  2703. SetData (dtPascalInstance, @PascalInstance);
  2704. ConnectDestroy (@FreeClass, nil);
  2705. end;
  2706. constructor TFPgtkObject.Create;
  2707. begin
  2708. InitCreate;
  2709. CreateGtkObject;
  2710. FinalCreate;
  2711. end;
  2712. constructor TFPgtkObject.CreateFromObject (GtkObject:PGtkObject);
  2713. begin
  2714. InitCreate;
  2715. FGtkObject := GtkObject;
  2716. FinalCreate;
  2717. end;
  2718. procedure TFPgtkObject.AskNotification (AnObject:TFPgtkObject);
  2719. begin
  2720. CheckNotifyList;
  2721. with NotifyList do
  2722. if indexof(AnObject) < 0 then
  2723. begin
  2724. Add (AnObject);
  2725. AnObject.AskNotification (Self);
  2726. end;
  2727. end;
  2728. destructor TFPgtkObject.Destroy;
  2729. var r : integer;
  2730. datapointer : PSignalData;
  2731. begin
  2732. FDestroying := dsDestroying;
  2733. if assigned(NotifyList) then
  2734. begin
  2735. for r := 0 to NotifyList.count-1 do
  2736. TFPgtkObject(NotifyList[r]).NotifyDestroy (Self);
  2737. NotifyList.Free;
  2738. NotifyList := nil;
  2739. end;
  2740. if assigned(FGtkObject) and not Gtk_Object_destroyed(FGtkObject) then
  2741. begin
  2742. gtk_object_destroy (FGtkObject);
  2743. FGtkObject := nil;
  2744. end;
  2745. for r := 0 to SignalDatas.count-1 do
  2746. begin
  2747. datapointer := signaldatas[r];
  2748. dispose (datapointer);
  2749. end;
  2750. signaldatas.Free;
  2751. if assigned (convertDatas) then
  2752. ConvertDatas.Free;
  2753. r := ObjectsToFree.indexof (self);
  2754. if r >= 0 then
  2755. ObjectsToFree[r] := nil;
  2756. inherited destroy;
  2757. end;
  2758. procedure TFPgtkObject.NotifyDestroy (AnObject:TFPgtkObject);
  2759. var r : integer;
  2760. begin
  2761. if assigned(NotifyList) then
  2762. begin
  2763. r := NotifyList.indexOf (AnObject);
  2764. if r >= 0 then
  2765. NotifyList.Delete (r);
  2766. end;
  2767. end;
  2768. function TFPgtkObject.ConnectDestroy (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2769. begin
  2770. result := SignalConnect (sgDestroy, proc, data);
  2771. end;
  2772. function TFPgtkObject.ConnectAfterDestroy (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2773. begin
  2774. result := SignalConnectAfter (sgDestroy, proc, data);
  2775. end;
  2776. procedure TFPgtkObject.SignalDisconnect (SignalHandler:guint);
  2777. begin
  2778. gtk_signal_disconnect (TheGtkObject, SignalHandler);
  2779. end;
  2780. procedure TFPgtkObject.SignalBlockHandler (SignalHandler:guint);
  2781. begin
  2782. gtk_signal_handler_block (TheGtkObject, SignalHandler);
  2783. end;
  2784. procedure TFPgtkObject.SignalUnblockHandler (SignalHandler:guint);
  2785. begin
  2786. gtk_signal_handler_unblock (TheGtkObject, SignalHandler);
  2787. end;
  2788. procedure TFPgtkObject.SignalEmit (aName:string; Args:array of const);
  2789. begin
  2790. // gtk_signal_emit_by_name (TheGtkObject, pgchar(aName), Args);
  2791. end;
  2792. function TFPgtkObject.SignalNEmissions (aName:string) : guint;
  2793. begin
  2794. result := gtk_signal_n_emissions_by_name (FGtkObject, pgchar(aName));
  2795. end;
  2796. procedure TFPgtkObject.SignalEmitStop (aName:string);
  2797. begin
  2798. gtk_signal_emit_stop_by_name (FGtkObject, pgchar(aName));
  2799. end;
  2800. procedure TFPgtkObject.SetData (Key:string; Data:pointer);
  2801. begin
  2802. gtk_object_set_data (TheGtkObject, ConvertToPgchar(Key), Data);
  2803. end;
  2804. function TFPgtkObject.GetUserData : pointer;
  2805. begin
  2806. result := gtk_object_get_user_data(TheGtkObject);
  2807. end;
  2808. procedure TFPgtkObject.SetUserData (TheValue:pointer);
  2809. begin
  2810. gtk_object_set_user_data(TheGtkObject,TheValue);
  2811. end;
  2812. procedure TFPgtkObject.SetDataFull (Key:string; Data:pointer; Destroyer:TFPgtkSignalFunction);
  2813. begin
  2814. gtk_object_set_data_full (TheGtkObject, pgChar(Key), ConvertSignalData (Destroyer, data, false), TGtkDestroyNotify(@DestroyData));
  2815. CheckConvertDatas;
  2816. ConvertDatas.Add (Key);
  2817. end;
  2818. procedure TFPgtkObject.RemoveData (Key:string);
  2819. var r : integer;
  2820. begin
  2821. gtk_object_remove_data (TheGtkObject, pgChar(Key));
  2822. if assigned (ConvertDatas) then
  2823. begin
  2824. r := ConvertDatas.indexof (Key);
  2825. if r >= 0 then
  2826. ConvertDatas.Delete (r);
  2827. end;
  2828. end;
  2829. function TFPgtkObject.GetData (Key:string) : pointer;
  2830. var p : pointer;
  2831. begin
  2832. p := gtk_object_get_data (TheGtkObject, pgChar(Key));
  2833. if assigned(ConvertDatas) and (ConvertDatas.IndexOf (Key) >= 0) then
  2834. result := PPascalClassData (PSignalData(p)^.TheData)^.TheInstance
  2835. else
  2836. result := p;
  2837. end;
  2838. procedure DestroyData (data:pointer); Cdecl;
  2839. begin
  2840. with PSignaldata(data)^ do
  2841. TheSignalProc (TheWidget, TheData);
  2842. end;
  2843. function IntToPointer (Value:integer) : pointer;
  2844. begin
  2845. ip.i := Value;
  2846. result := ip.p;
  2847. end;
  2848. function PointerToInt (Value:pointer) : integer;
  2849. begin
  2850. ip.p := Value;
  2851. result := ip.i;
  2852. end;
  2853. function TFPgtkObject.GtkDestroyed : boolean;
  2854. begin
  2855. result := gtk_object_destroyed (TheGtkObject);
  2856. end;
  2857. procedure TFPgtkObject.Constructed;
  2858. begin
  2859. gtk_object_constructed (TheGtkObject);
  2860. end;
  2861. procedure TFPgtkObject.ConstructedDefault;
  2862. begin
  2863. gtk_object_default_construct (TheGtkObject);
  2864. end;
  2865. procedure TFPgtkObject.Sink;
  2866. begin
  2867. gtk_object_sink (TheGtkObject);
  2868. end;
  2869. procedure TFPgtkObject.Ref;
  2870. begin
  2871. gtk_object_ref (TheGtkObject);
  2872. end;
  2873. procedure TFPgtkObject.Unref;
  2874. begin
  2875. gtk_object_unref (TheGtkObject);
  2876. end;
  2877. procedure TFPgtkObject.WeakRef (Notify:TFPgtkSignalFunction; data:pointer);
  2878. begin
  2879. gtk_object_weakref (TheGtkObject, TGtkDestroyNotify(@DestroyData), ConvertSignalData (Notify, data, true));
  2880. end;
  2881. procedure TFPgtkObject.WeakUnref (notify:TFPgtkSignalFunction; data:pointer);
  2882. begin
  2883. gtk_object_weakunref (TheGtkObject, TGtkDestroyNotify(@DestroyData), ConvertSignalData (Notify, data, true));
  2884. end;
  2885. { TFPgtkData }
  2886. function TFPgtkData.TheGtkObject : PGtkData;
  2887. begin
  2888. result := PgtkData(FGtkObject);
  2889. end;
  2890. function TFPgtkData.ConnectDisconnect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2891. begin
  2892. result := SignalConnect (sgDisconnect, proc, data);
  2893. end;
  2894. function TFPgtkData.ConnectAfterDisconnect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2895. begin
  2896. result := SignalConnectAfter (sgDisconnect, proc, data);
  2897. end;
  2898. { TFPgtkAdjustment }
  2899. function TFPgtkAdjustment.TheGtkObject : PGtkAdjustment;
  2900. begin
  2901. result := PgtkAdjustment(FGtkObject);
  2902. end;
  2903. procedure TFPgtkAdjustment.CreateGtkObject;
  2904. begin
  2905. FGtkObject := PGtkObject(gtk_Adjustment_new (0,0,10,1,2,2));
  2906. end;
  2907. procedure TFPgtkAdjustment.Configure (aLower:gfloat; anUpper:gfloat; aValue:gfloat; aStepInc:gfloat; aPageInc:gfloat; aPageSize:gfloat);
  2908. begin
  2909. Lower := aLower;
  2910. Upper := anUpper;
  2911. Value := aValue;
  2912. StepIncrement := aStepInc;
  2913. PageIncrement := aPageInc;
  2914. PageSize := aPageSize;
  2915. end;
  2916. function TFPgtkAdjustment.ConnectValueChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2917. begin
  2918. result := SignalConnect (sgValueChanged, proc, data);
  2919. end;
  2920. function TFPgtkAdjustment.ConnectAfterValueChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2921. begin
  2922. result := SignalConnectAfter (sgValueChanged, proc, data);
  2923. end;
  2924. function TFPgtkAdjustment.ConnectChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2925. begin
  2926. result := SignalConnect (sgChanged, proc, data);
  2927. end;
  2928. function TFPgtkAdjustment.ConnectAfterChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  2929. begin
  2930. result := SignalConnectAfter (sgChanged, proc, data);
  2931. end;
  2932. procedure TFPgtkAdjustment.ValueChanged;
  2933. begin
  2934. gtk_Adjustment_Value_Changed (TheGtkObject);
  2935. end;
  2936. procedure TFPgtkAdjustment.Changed;
  2937. begin
  2938. gtk_Adjustment_Changed (TheGtkObject);
  2939. end;
  2940. procedure TFPgtkAdjustment.ClampPage (aLower:gfloat; aUpper:gfloat);
  2941. begin
  2942. gtk_Adjustment_Clamp_Page (TheGtkObject, aLower, aUpper);
  2943. end;
  2944. function TFPgtkAdjustment.GetValue : gfloat;
  2945. begin
  2946. result := TheGtkObject^.Value;
  2947. end;
  2948. procedure TFPgtkAdjustment.SetValue (TheValue:gfloat);
  2949. begin
  2950. gtk_Adjustment_set_Value(TheGtkObject,TheValue);
  2951. end;
  2952. function TFPgtkAdjustment.GetLower : gfloat;
  2953. begin
  2954. result := TheGtkObject^.Lower;
  2955. end;
  2956. procedure TFPgtkAdjustment.SetLower (TheValue:gfloat);
  2957. begin
  2958. TheGtkObject^.Lower := TheValue;
  2959. end;
  2960. function TFPgtkAdjustment.GetUpper : gfloat;
  2961. begin
  2962. result := TheGtkObject^.Upper;
  2963. end;
  2964. procedure TFPgtkAdjustment.SetUpper (TheValue:gfloat);
  2965. begin
  2966. TheGtkObject^.Upper := TheValue;
  2967. end;
  2968. function TFPgtkAdjustment.GetStepIncrement : gfloat;
  2969. begin
  2970. result := TheGtkObject^.Step_Increment;
  2971. end;
  2972. procedure TFPgtkAdjustment.SetStepIncrement (TheValue:gfloat);
  2973. begin
  2974. TheGtkObject^.Step_Increment := TheValue;
  2975. end;
  2976. function TFPgtkAdjustment.GetPageIncrement : gfloat;
  2977. begin
  2978. result := TheGtkObject^.Page_Increment;
  2979. end;
  2980. procedure TFPgtkAdjustment.SetPageIncrement (TheValue:gfloat);
  2981. begin
  2982. TheGtkObject^.Page_increment := TheValue;
  2983. end;
  2984. function TFPgtkAdjustment.GetPageSize : gfloat;
  2985. begin
  2986. result := TheGtkObject^.Page_Size;
  2987. end;
  2988. procedure TFPgtkAdjustment.SetPageSize (TheValue:gfloat);
  2989. begin
  2990. TheGtkObject^.Page_Size := TheValue;
  2991. end;
  2992. { TFPgtkToolTips }
  2993. function TFPgtkToolTips.TheGtkObject : PGtkToolTips;
  2994. begin
  2995. result := PgtkToolTips(FGtkObject);
  2996. end;
  2997. procedure TFPgtkToolTips.CreateGtkObject;
  2998. begin
  2999. FGtkObject := PGtkObject(gtk_tooltips_new);
  3000. end;
  3001. procedure TFPgtkToolTips.SetColors (Fore:PGdkColor; Back:PGdkColor);
  3002. begin
  3003. gtk_tooltips_set_colors (TheGtkObject, Fore, Back);
  3004. end;
  3005. procedure TFPgtkToolTips.SetTip (Widget:TFPgtkWidget; TipText:string; TipPrivate:string);
  3006. begin
  3007. gtk_tooltips_set_tip (TheGtkObject, PGtkwidget(ConvertToGtkObject(Widget)), ConvertToPgchar(TipText), ConvertToPgchar(TipPrivate));
  3008. end;
  3009. function TFPgtkToolTips.GetEnabled : boolean;
  3010. begin
  3011. result := boolean(gtk.enabled(TheGtkObject^));
  3012. end;
  3013. procedure TFPgtkToolTips.SetEnabled (TheValue:boolean);
  3014. begin
  3015. if TheValue then
  3016. gtk_tooltips_enable (TheGtkObject)
  3017. else
  3018. gtk_tooltips_disable (TheGtkObject);
  3019. end;
  3020. function TFPgtkToolTips.GetDelay : integer;
  3021. begin
  3022. result := gtk.delay(TheGtkObject^);
  3023. end;
  3024. procedure TFPgtkToolTips.SetDelay (TheValue:integer);
  3025. begin
  3026. gtk_tooltips_set_delay(TheGtkObject,TheValue);
  3027. end;
  3028. function TFPgtkToolTips.GetColorForeground : PGdkColor;
  3029. begin
  3030. result := TheGtkObject^.foreground;
  3031. end;
  3032. procedure TFPgtkToolTips.SetColorForeground (TheValue:PGdkColor);
  3033. begin
  3034. SetColors (TheValue, ColorBackGround);
  3035. end;
  3036. function TFPgtkToolTips.GetColorBackground : PGdkColor;
  3037. begin
  3038. result := TheGtkObject^.background;
  3039. end;
  3040. procedure TFPgtkToolTips.SetColorBackground (TheValue:PGdkColor);
  3041. begin
  3042. SetColors (ColorForeground, TheValue);
  3043. end;
  3044. function GetTooltipsData (Widget:TFPgtkWidget) : PGtkTooltipsData;
  3045. begin
  3046. result := gtk_tooltips_data_get (ConvertToGtkWidget(Widget));
  3047. end;
  3048. function ComposeTooltip (TooltipText:string; PrivText:string) : string;
  3049. begin
  3050. result := TooltipText;
  3051. if PrivText <> '' then
  3052. result := result + '|' + PrivText;
  3053. end;
  3054. procedure DecomposeTooltip (Tooltip:string; var TooltipText:string; var PrivText:string);
  3055. var r : integer;
  3056. begin
  3057. r := pos ('|', tooltip);
  3058. if r > 0 then
  3059. begin
  3060. TooltipText := copy(Tooltip, 1, r-1);
  3061. PrivText := copy (Tooltip, r+1, maxint);
  3062. end
  3063. else
  3064. begin
  3065. TooltipText := Tooltip;
  3066. PrivText := '';
  3067. end;
  3068. end;
  3069. procedure CheckTooltips;
  3070. begin
  3071. if not assigned (TheTooltips) then
  3072. TheTooltips := TFPgtkTooltips.Create;
  3073. end;
  3074. procedure TFPgtkToolTips.ForceWindow;
  3075. begin
  3076. gtk_tooltips_force_window (TheGtkObject);
  3077. end;
  3078. { TFPgtkWidget }
  3079. function TFPgtkWidget.TheGtkObject : PGtkWidget;
  3080. begin
  3081. result := PgtkWidget(FGtkObject);
  3082. end;
  3083. function TFPgtkWidget.GetTheGtkWidget : PGtkWidget;
  3084. begin
  3085. result := PGtkWidget (TheGtkObject);
  3086. end;
  3087. procedure TFPgtkWidget.SetTheGtkWidget (TheValue:PGtkWidget);
  3088. begin
  3089. FGtkObject := PgtkObject (TheValue);
  3090. end;
  3091. function GetPascalInstance (Widget:PGtkWidget) : TFPgtkWidget; Overload;
  3092. begin
  3093. result := TFPgtkWidget (GetPascalInstance (PGtkObject(widget)));
  3094. end;
  3095. function GetPascalInstance (Widget:PGtkWidget; ObjClass:TFPgtkObjectClass) : TFPgtkWidget; Overload;
  3096. begin
  3097. result := TFPgtkWidget (GetPascalInstance (PGtkObject(Widget), ObjClass));
  3098. end;
  3099. function ConvertToGtkWidget (AnObject:TFPgtkWidget) : PGtkWidget;
  3100. begin
  3101. if assigned(AnObject) then
  3102. result := AnObject.TheGtkWidget
  3103. else
  3104. result := nil;
  3105. end;
  3106. procedure WidgetSignalproc (Sender:PGtkobject; Widget:PGtkwidget; Data:pointer); cdecl;
  3107. var p : TFPgtkWidgetSignalFunction;
  3108. begin
  3109. with PSignalData(data)^ do
  3110. begin
  3111. p := TFPgtkWidgetSignalFunction (TheSignalProc);
  3112. p (TheWidget as TFPgtkObject, GetPascalInstance(PGtkObject(Widget),TFPgtkwidget) as TFPgtkwidget, TheData)
  3113. end;
  3114. end;
  3115. function TFPgtkWidget.WidgetSignalConnect (signal:string; proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  3116. begin
  3117. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@WidgetSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3118. end;
  3119. function TFPgtkWidget.WidgetSignalConnectAfter (signal:string; proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  3120. begin
  3121. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@WidgetSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3122. end;
  3123. procedure TFPgtkWidget.SetFlags (NewFlags:longint);
  3124. begin
  3125. gtk_widget_set_flags (TheGtkObject, NewFlags);
  3126. end;
  3127. procedure TFPgtkWidget.UnsetFlags (NewUnsetFlags:longint);
  3128. begin
  3129. gtk_widget_unset_flags (TheGtkObject, NewUnsetFlags);
  3130. end;
  3131. procedure TFPgtkWidget.Map;
  3132. begin
  3133. gtk_widget_map (TheGtkObject);
  3134. end;
  3135. procedure TFPgtkWidget.Unmap;
  3136. begin
  3137. gtk_widget_unmap (TheGtkObject);
  3138. end;
  3139. procedure TFPgtkWidget.QueueDraw;
  3140. begin
  3141. gtk_widget_queue_draw (TheGtkObject);
  3142. end;
  3143. procedure TFPgtkWidget.QueueResize;
  3144. begin
  3145. gtk_widget_queue_resize (TheGtkObject);
  3146. end;
  3147. procedure TFPgtkWidget.Draw (Rectangle:PGdkRectangle); Overload;
  3148. begin
  3149. gtk_widget_draw (TheGtkObject, Rectangle);
  3150. end;
  3151. procedure TFPgtkWidget.DrawFocus;
  3152. begin
  3153. gtk_widget_draw_focus (TheGtkObject);
  3154. end;
  3155. procedure TFPgtkWidget.DrawDefault;
  3156. begin
  3157. gtk_widget_draw_default (TheGtkObject);
  3158. end;
  3159. procedure TFPgtkWidget.Show;
  3160. begin
  3161. gtk_widget_show (TheGtkObject);
  3162. end;
  3163. procedure TFPgtkWidget.Hide;
  3164. begin
  3165. gtk_widget_hide (TheGtkObject);
  3166. end;
  3167. procedure TFPgtkWidget.Realize;
  3168. begin
  3169. gtk_widget_realize (TheGtkObject);
  3170. end;
  3171. procedure TFPgtkWidget.Unrealize;
  3172. begin
  3173. gtk_widget_unrealize (TheGtkObject);
  3174. end;
  3175. procedure TFPgtkWidget.ShowNow;
  3176. begin
  3177. gtk_widget_show_now (TheGtkObject);
  3178. end;
  3179. procedure TFPgtkWidget.ShowAll;
  3180. begin
  3181. gtk_widget_show_all (TheGtkObject);
  3182. end;
  3183. procedure TFPgtkWidget.HideAll;
  3184. begin
  3185. gtk_widget_hide_all (TheGtkObject);
  3186. end;
  3187. procedure TFPgtkWidget.SetAllocation (AnAllocation:TGtkAllocation); Overload;
  3188. begin
  3189. with AnAllocation do
  3190. SetAllocation (x, y, width, height);
  3191. end;
  3192. procedure TFPgtkWidget.SetAllocation (x:integer; y:integer; width:integer; height:integer); Overload;
  3193. begin
  3194. SetUPosition (x, y);
  3195. SetUSize (width, height);
  3196. end;
  3197. function TFPgtkWidget.GetAllocation : TGtkAllocation;
  3198. begin
  3199. result := TheGtkObject^.allocation;
  3200. end;
  3201. procedure TFPgtkWidget.SetUPosition (x:integer; y:integer);
  3202. begin
  3203. gtk_widget_set_uposition (TheGtkObject, x, y);
  3204. end;
  3205. procedure TFPgtkWidget.SetUsize (width:integer; height:integer);
  3206. begin
  3207. gtk_widget_set_usize (TheGtkObject, width, height);
  3208. end;
  3209. function TFPgtkWidget.GetName : string;
  3210. begin
  3211. result := gtk_widget_get_name(TheGtkObject);
  3212. end;
  3213. procedure TFPgtkWidget.SetName (TheValue:string);
  3214. begin
  3215. gtk_widget_set_name(TheGtkObject,ConvertToPgchar(TheValue));
  3216. end;
  3217. function TFPgtkWidget.GetPropFlags : longint;
  3218. begin
  3219. result := gtk_widget_Flags (TheGtkObject);
  3220. end;
  3221. procedure TFPgtkWidget.SetPropFlags (TheValue:longint);
  3222. var f : integer;
  3223. begin
  3224. f := GetPropFlags;
  3225. UnsetFlags (f and not TheValue);
  3226. SetFlags (not f and TheValue);
  3227. end;
  3228. function TFPgtkWidget.GetState : longint;
  3229. begin
  3230. result := gtk_widget_State(TheGtkObject);
  3231. end;
  3232. function TFPgtkWidget.GetSavedState : longint;
  3233. begin
  3234. result := gtk_widget_Saved_State(TheGtkObject);
  3235. end;
  3236. function TFPgtkWidget.GetParent : TFPgtkWidget;
  3237. var gtkparent : PgtkWidget;
  3238. o : TFPgtkObject;
  3239. begin
  3240. gtkParent := TheGtkObject^.parent;
  3241. o := GetPascalInstance (PgtkObject(GtkParent));
  3242. if o is TFPgtkWidget then
  3243. result := TFPgtkWidget(o)
  3244. else
  3245. result := nil;
  3246. end;
  3247. procedure TFPgtkWidget.SetParent (TheValue:TFPgtkWidget);
  3248. var gtkparent : PgtkWidget;
  3249. begin
  3250. gtkParent := TheGtkObject^.parent;
  3251. if assigned(TheValue) then
  3252. if assigned(gtkParent) then
  3253. reparent (TheValue)
  3254. else
  3255. gtk_widget_set_parent (TheGtkWidget, ConvertToGtkWidget(TheValue))
  3256. else
  3257. if assigned(gtkParent) then
  3258. gtk_widget_unparent (TheGtkWidget);
  3259. end;
  3260. function TFPgtkWidget.GetParentWindow : PGdkWindow;
  3261. begin
  3262. result := gtk_widget_get_parent_window(TheGtkObject);
  3263. end;
  3264. procedure TFPgtkWidget.SetParentWindow (TheValue:PGdkWindow);
  3265. begin
  3266. gtk_widget_set_parent_window(TheGtkObject,TheValue);
  3267. end;
  3268. procedure TFPgtkWidget.Unparent;
  3269. begin
  3270. gtk_widget_unparent (TheGtkObject);
  3271. end;
  3272. procedure TFPgtkWidget.Reparent (NewParent:TFPgtkWidget);
  3273. begin
  3274. if (NewParent is TFpgtkContainer) then
  3275. begin
  3276. ref;
  3277. TFPgtkContainer(Parent).remove (self);
  3278. TFPgtkContainer(NewParent).Add (Self);
  3279. unref;
  3280. end;
  3281. end;
  3282. function TFPgtkWidget.GetVisible : boolean;
  3283. begin
  3284. result := gtk_widget_Visible(TheGtkObject);
  3285. end;
  3286. procedure TFPgtkWidget.SetVisible (TheValue:boolean);
  3287. begin
  3288. if TheValue then
  3289. Show
  3290. else
  3291. Hide;
  3292. end;
  3293. function TFPgtkWidget.GetNoWindow : boolean;
  3294. begin
  3295. result := gtk_widget_No_Window(TheGtkObject);
  3296. end;
  3297. procedure TFPgtkWidget.SetNoWindow (TheValue:boolean);
  3298. begin
  3299. if TheValue then
  3300. SetFlags (GTK_NO_WINDOW)
  3301. else
  3302. UnSetFlags (GTK_NO_WINDOW);
  3303. end;
  3304. function TFPgtkWidget.GetRealized : boolean;
  3305. begin
  3306. result := gtk_widget_realized(TheGtkObject);
  3307. end;
  3308. procedure TFPgtkWidget.SetRealized (TheValue:boolean);
  3309. begin
  3310. if TheValue then
  3311. Realize
  3312. else
  3313. Unrealize;
  3314. end;
  3315. function TFPgtkWidget.GetMapped : boolean;
  3316. begin
  3317. result := gtk_widget_Mapped(TheGtkObject);
  3318. end;
  3319. procedure TFPgtkWidget.SetMapped (TheValue:boolean);
  3320. begin
  3321. if TheValue then
  3322. Map
  3323. else
  3324. Unmap;
  3325. end;
  3326. function TFPgtkWidget.GetDrawable : boolean;
  3327. begin
  3328. result := gtk_widget_Drawable(TheGtkObject);
  3329. end;
  3330. function TFPgtkWidget.GetIsSensitive : boolean;
  3331. begin
  3332. result := gtk_widget_Is_Sensitive(TheGtkObject);
  3333. end;
  3334. function TFPgtkWidget.GetSensitive : boolean;
  3335. begin
  3336. result := gtk_widget_Sensitive(TheGtkObject);
  3337. end;
  3338. procedure TFPgtkWidget.SetSensitive (TheValue:boolean);
  3339. begin
  3340. gtk_widget_set_sensitive(TheGtkObject,TheValue);
  3341. end;
  3342. function TFPgtkWidget.GetParentSensitive : boolean;
  3343. begin
  3344. result := gtk_widget_Parent_Sensitive(TheGtkObject);
  3345. end;
  3346. procedure TFPgtkWidget.SetParentSensitive (TheValue:boolean);
  3347. begin
  3348. if TheValue then
  3349. SetFlags (GTK_PARENT_SENSITIVE)
  3350. else
  3351. UnSetFlags (GTK_PARENT_SENSITIVE);
  3352. end;
  3353. function TFPgtkWidget.GetAppPaintable : boolean;
  3354. begin
  3355. result := gtk_widget_App_Paintable(TheGtkObject);
  3356. end;
  3357. function TFPgtkWidget.GetCanFocus : boolean;
  3358. begin
  3359. result := gtk_widget_Can_Focus(TheGtkObject);
  3360. end;
  3361. procedure TFPgtkWidget.SetCanFocus (TheValue:boolean);
  3362. begin
  3363. if TheValue then
  3364. SetFlags (GTK_CAN_FOCUS)
  3365. else
  3366. UnSetFlags (GTK_CAN_FOCUS);
  3367. end;
  3368. procedure TFPgtkWidget.GrabFocus;
  3369. begin
  3370. gtk_widget_grab_focus (TheGtkObject);
  3371. end;
  3372. function TFPgtkWidget.GetHasFocus : boolean;
  3373. begin
  3374. result := gtk_widget_Has_Focus(TheGtkObject);
  3375. end;
  3376. function TFPgtkWidget.GetCanDefault : boolean;
  3377. begin
  3378. result := gtk_widget_Can_Default(TheGtkObject);
  3379. end;
  3380. procedure TFPgtkWidget.SetCanDefault (TheValue:boolean);
  3381. begin
  3382. if TheValue then
  3383. SetFlags (GTK_CAN_DEFAULT)
  3384. else
  3385. UnSetFlags (GTK_CAN_DEFAULT);
  3386. end;
  3387. procedure TFPgtkWidget.GrabDefault;
  3388. begin
  3389. gtk_widget_grab_default (TheGtkObject);
  3390. end;
  3391. function TFPgtkWidget.GetHasDefault : boolean;
  3392. begin
  3393. result := gtk_widget_Has_Default(TheGtkObject);
  3394. end;
  3395. function TFPgtkWidget.GetReceivesDefault : boolean;
  3396. begin
  3397. result := gtk_widget_Receives_Default(TheGtkObject);
  3398. end;
  3399. function TFPgtkWidget.GetCompositeChild : boolean;
  3400. begin
  3401. result := gtk_widget_Composite_Child(TheGtkObject);
  3402. end;
  3403. function TFPgtkWidget.GetTooltip : string;
  3404. var data : PGtkTooltipsData;
  3405. begin
  3406. data := Gtk_Tooltips_Data_Get (TheGtkObject);
  3407. if assigned(data) then
  3408. with data^ do
  3409. result := ComposeTooltip (Tip_Text, tip_private)
  3410. else
  3411. result := '';
  3412. end;
  3413. procedure TFPgtkWidget.SetTooltip (TheValue:string);
  3414. var t, p : string;
  3415. ttdata : PGtkTooltipsData;
  3416. begin
  3417. if TheValue = '' then
  3418. begin
  3419. ttdata := GetTooltipsData (Self);
  3420. if assigned (ttdata) then
  3421. ; // find a way to remove the hint. Setting '' does not remove
  3422. end
  3423. else
  3424. begin
  3425. CheckTooltips;
  3426. DecomposeTooltip (TheValue, t, p);
  3427. TheToolTips.SetTip (self, t, p);
  3428. end;
  3429. end;
  3430. procedure TFPgtkWidget.HideOnDelete;
  3431. begin
  3432. gtk_widget_hide_on_delete (TheGtkObject);
  3433. end;
  3434. function TFPgtkWidget.GetColormap : PGdkColormap;
  3435. begin
  3436. result := gtk_widget_get_colormap(TheGtkObject);
  3437. end;
  3438. procedure TFPgtkWidget.SetColormap (TheValue:PGdkColormap);
  3439. begin
  3440. gtk_widget_set_colormap(TheGtkObject,TheValue);
  3441. end;
  3442. function TFPgtkWidget.ConnectShow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3443. begin
  3444. result := SignalConnect (sgShow, proc, data);
  3445. end;
  3446. function TFPgtkWidget.ConnectAfterShow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3447. begin
  3448. result := SignalConnectAfter (sgShow, proc, data);
  3449. end;
  3450. function TFPgtkWidget.Connecthide (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3451. begin
  3452. result := SignalConnect (sghide, proc, data);
  3453. end;
  3454. function TFPgtkWidget.ConnectAfterhide (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3455. begin
  3456. result := SignalConnectAfter (sghide, proc, data);
  3457. end;
  3458. function TFPgtkWidget.Connectmap (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3459. begin
  3460. result := SignalConnect (sgmap, proc, data);
  3461. end;
  3462. function TFPgtkWidget.ConnectAftermap (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3463. begin
  3464. result := SignalConnectAfter (sgmap, proc, data);
  3465. end;
  3466. function TFPgtkWidget.Connectunmap (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3467. begin
  3468. result := SignalConnect (sgunmap, proc, data);
  3469. end;
  3470. function TFPgtkWidget.ConnectAfterunmap (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3471. begin
  3472. result := SignalConnectAfter (sgunmap, proc, data);
  3473. end;
  3474. function TFPgtkWidget.Connectrealize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3475. begin
  3476. result := SignalConnect (sgrealize, proc, data);
  3477. end;
  3478. function TFPgtkWidget.ConnectAfterrealize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3479. begin
  3480. result := SignalConnectAfter (sgrealize, proc, data);
  3481. end;
  3482. function TFPgtkWidget.Connectunrealize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3483. begin
  3484. result := SignalConnect (sgunrealize, proc, data);
  3485. end;
  3486. function TFPgtkWidget.ConnectAfterunrealize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3487. begin
  3488. result := SignalConnectAfter (sgunrealize, proc, data);
  3489. end;
  3490. function TFPgtkWidget.ConnectDrawFocus (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3491. begin
  3492. result := SignalConnect (sgDrawFocus, proc, data);
  3493. end;
  3494. function TFPgtkWidget.ConnectAfterDrawFocus (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3495. begin
  3496. result := SignalConnectAfter (sgDrawFocus, proc, data);
  3497. end;
  3498. function TFPgtkWidget.ConnectDrawDefault (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3499. begin
  3500. result := SignalConnect (sgDrawDefault, proc, data);
  3501. end;
  3502. function TFPgtkWidget.ConnectAfterDrawDefault (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3503. begin
  3504. result := SignalConnectAfter (sgDrawDefault, proc, data);
  3505. end;
  3506. function TFPgtkWidget.ConnectParentSet (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  3507. begin
  3508. result := WidgetSignalConnect (sgParentSet, proc, data);
  3509. end;
  3510. function TFPgtkWidget.ConnectAfterParentSet (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  3511. begin
  3512. result := WidgetSignalConnectAfter (sgParentSet, proc, data);
  3513. end;
  3514. function TFPgtkWidget.ConnectGrabFocus (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3515. begin
  3516. result := SignalConnect (sgGrabFocus, proc, data);
  3517. end;
  3518. function TFPgtkWidget.ConnectAfterGrabFocus (proc:TFPgtkSignalFunction; data:pointer) : guint;
  3519. begin
  3520. result := SignalConnectAfter (sgGrabFocus, proc, data);
  3521. end;
  3522. function Eventfunc (Sender:PGtkwidget; Event:PGdkEvent; data:pointer) : boolean; cdecl;
  3523. var p : TFPgtkEventFunction;
  3524. begin
  3525. with PSignalData(data)^ do
  3526. begin
  3527. p := TFPgtkEventFunction (TheSignalProc);
  3528. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3529. end;
  3530. end;
  3531. function TFPgtkWidget.EventConnect (signal:string; proc:TFPgtkEventFunction; data:pointer) : guint;
  3532. begin
  3533. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@Eventfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3534. end;
  3535. function TFPgtkWidget.EventConnectAfter (signal:string; proc:TFPgtkEventFunction; data:pointer) : guint;
  3536. begin
  3537. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@Eventfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3538. end;
  3539. function TFPgtkWidget.ConnectEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3540. begin
  3541. result := EventConnect (sgEvent, proc, data);
  3542. end;
  3543. function TFPgtkWidget.ConnectAfterEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3544. begin
  3545. result := EventConnectAfter (sgEvent, proc, data);
  3546. end;
  3547. function EventButtonfunc (Sender:PGtkwidget; Event:PGdkEventButton; data:pointer) : boolean; cdecl;
  3548. var p : TFPgtkEventButtonFunction;
  3549. begin
  3550. with PSignalData(data)^ do
  3551. begin
  3552. p := TFPgtkEventButtonFunction (TheSignalProc);
  3553. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3554. end;
  3555. end;
  3556. function TFPgtkWidget.EventButtonConnect (signal:string; proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  3557. begin
  3558. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventButtonfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3559. end;
  3560. function TFPgtkWidget.EventButtonConnectAfter (signal:string; proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  3561. begin
  3562. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventButtonfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3563. end;
  3564. function TFPgtkWidget.ConnectButtonPressEvent (proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  3565. begin
  3566. result := EventButtonConnect (sgButtonPressEvent, proc, data);
  3567. end;
  3568. function TFPgtkWidget.ConnectAfterButtonPressEvent (proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  3569. begin
  3570. result := EventButtonConnectAfter (sgButtonPressEvent, proc, data);
  3571. end;
  3572. function TFPgtkWidget.ConnectButtonReleaseEvent (proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  3573. begin
  3574. result := EventButtonConnect (sgButtonReleaseEvent, proc, data);
  3575. end;
  3576. function TFPgtkWidget.ConnectAfterButtonReleaseEvent (proc:TFPgtkEventButtonFunction; data:pointer) : guint;
  3577. begin
  3578. result := EventButtonConnectAfter (sgButtonReleaseEvent, proc, data);
  3579. end;
  3580. function EventMotionfunc (Sender:PGtkwidget; Event:PGdkEventMotion; data:pointer) : boolean; cdecl;
  3581. var p : TFPgtkEventMotionFunction;
  3582. begin
  3583. with PSignalData(data)^ do
  3584. begin
  3585. p := TFPgtkEventMotionFunction (TheSignalProc);
  3586. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3587. end;
  3588. end;
  3589. function TFPgtkWidget.EventMotionConnect (signal:string; proc:TFPgtkEventMotionFunction; data:pointer) : guint;
  3590. begin
  3591. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventMotionfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3592. end;
  3593. function TFPgtkWidget.EventMotionConnectAfter (signal:string; proc:TFPgtkEventMotionFunction; data:pointer) : guint;
  3594. begin
  3595. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventMotionfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3596. end;
  3597. function TFPgtkWidget.ConnectMotionNotifyEvent (proc:TFPgtkEventMotionFunction; data:pointer) : guint;
  3598. begin
  3599. result := EventMotionConnect (sgMotionNotifyEvent, proc, data);
  3600. end;
  3601. function TFPgtkWidget.ConnectAfterMotionNotifyEvent (proc:TFPgtkEventMotionFunction; data:pointer) : guint;
  3602. begin
  3603. result := EventMotionConnectAfter (sgMotionNotifyEvent, proc, data);
  3604. end;
  3605. function TFPgtkWidget.ConnectDeleteEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3606. begin
  3607. result := EventConnect (sgDeleteEvent, proc, data);
  3608. end;
  3609. function TFPgtkWidget.ConnectAfterDeleteEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3610. begin
  3611. result := EventConnectAfter (sgDeleteEvent, proc, data);
  3612. end;
  3613. function TFPgtkWidget.ConnectDestroyEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3614. begin
  3615. result := EventConnect (sgDestroyEvent, proc, data);
  3616. end;
  3617. function TFPgtkWidget.ConnectAfterDestroyEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3618. begin
  3619. result := EventConnectAfter (sgDestroyEvent, proc, data);
  3620. end;
  3621. function EventExposefunc (Sender:PGtkwidget; Event:PGdkEventExpose; data:pointer) : boolean; cdecl;
  3622. var p : TFPgtkEventExposeFunction;
  3623. begin
  3624. with PSignalData(data)^ do
  3625. begin
  3626. p := TFPgtkEventExposeFunction (TheSignalProc);
  3627. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3628. end;
  3629. end;
  3630. function TFPgtkWidget.EventExposeConnect (signal:string; proc:TFPgtkEventExposeFunction; data:pointer) : guint;
  3631. begin
  3632. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventExposefunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3633. end;
  3634. function TFPgtkWidget.EventExposeConnectAfter (signal:string; proc:TFPgtkEventExposeFunction; data:pointer) : guint;
  3635. begin
  3636. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventExposefunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3637. end;
  3638. function TFPgtkWidget.ConnectExposeEvent (proc:TFPgtkEventExposeFunction; data:pointer) : guint;
  3639. begin
  3640. result := EventExposeConnect (sgExposeEvent, proc, data);
  3641. end;
  3642. function TFPgtkWidget.ConnectAfterExposeEvent (proc:TFPgtkEventExposeFunction; data:pointer) : guint;
  3643. begin
  3644. result := EventExposeConnectAfter (sgExposeEvent, proc, data);
  3645. end;
  3646. function EventKeyfunc (Sender:PGtkwidget; Event:PGdkEventKey; data:pointer) : boolean; cdecl;
  3647. var p : TFPgtkEventKeyFunction;
  3648. begin
  3649. with PSignalData(data)^ do
  3650. begin
  3651. p := TFPgtkEventKeyFunction (TheSignalProc);
  3652. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3653. end;
  3654. end;
  3655. function TFPgtkWidget.EventKeyConnect (signal:string; proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  3656. begin
  3657. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventKeyfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3658. end;
  3659. function TFPgtkWidget.EventKeyConnectAfter (signal:string; proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  3660. begin
  3661. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventKeyfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3662. end;
  3663. function TFPgtkWidget.ConnectKeyPressEvent (proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  3664. begin
  3665. result := EventKeyConnect (sgKeyPressEvent, proc, data);
  3666. end;
  3667. function TFPgtkWidget.ConnectAfterKeyPressEvent (proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  3668. begin
  3669. result := EventKeyConnectAfter (sgKeyPressEvent, proc, data);
  3670. end;
  3671. function TFPgtkWidget.ConnectKeyReleaseEvent (proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  3672. begin
  3673. result := EventKeyConnect (sgKeyReleaseEvent, proc, data);
  3674. end;
  3675. function TFPgtkWidget.ConnectAfterKeyReleaseEvent (proc:TFPgtkEventKeyFunction; data:pointer) : guint;
  3676. begin
  3677. result := EventKeyConnectAfter (sgKeyReleaseEvent, proc, data);
  3678. end;
  3679. function EventCrossingfunc (Sender:PGtkwidget; Event:PGdkEventCrossing; data:pointer) : boolean; cdecl;
  3680. var p : TFPgtkEventCrossingFunction;
  3681. begin
  3682. with PSignalData(data)^ do
  3683. begin
  3684. p := TFPgtkEventCrossingFunction (TheSignalProc);
  3685. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3686. end;
  3687. end;
  3688. function TFPgtkWidget.EventCrossingConnect (signal:string; proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  3689. begin
  3690. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventCrossingfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3691. end;
  3692. function TFPgtkWidget.EventCrossingConnectAfter (signal:string; proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  3693. begin
  3694. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventCrossingfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3695. end;
  3696. function TFPgtkWidget.ConnectEnterNotifyEvent (proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  3697. begin
  3698. result := EventCrossingConnect (sgEnterNotifyEvent, proc, data);
  3699. end;
  3700. function TFPgtkWidget.ConnectAfterEnterNotifyEvent (proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  3701. begin
  3702. result := EventCrossingConnectAfter (sgEnterNotifyEvent, proc, data);
  3703. end;
  3704. function TFPgtkWidget.ConnectLeaveNotifyEvent (proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  3705. begin
  3706. result := EventCrossingConnect (sgLeaveNotifyEvent, proc, data);
  3707. end;
  3708. function TFPgtkWidget.ConnectAfterLeaveNotifyEvent (proc:TFPgtkEventCrossingFunction; data:pointer) : guint;
  3709. begin
  3710. result := EventCrossingConnectAfter (sgLeaveNotifyEvent, proc, data);
  3711. end;
  3712. function EventConfigurefunc (Sender:PGtkwidget; Event:PGdkEventConfigure; data:pointer) : boolean; cdecl;
  3713. var p : TFPgtkEventConfigureFunction;
  3714. begin
  3715. with PSignalData(data)^ do
  3716. begin
  3717. p := TFPgtkEventConfigureFunction (TheSignalProc);
  3718. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3719. end;
  3720. end;
  3721. function TFPgtkWidget.EventConfigureConnect (signal:string; proc:TFPgtkEventConfigureFunction; data:pointer) : guint;
  3722. begin
  3723. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventConfigurefunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3724. end;
  3725. function TFPgtkWidget.EventConfigureConnectAfter (signal:string; proc:TFPgtkEventConfigureFunction; data:pointer) : guint;
  3726. begin
  3727. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventConfigurefunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3728. end;
  3729. function TFPgtkWidget.ConnectConfigureEvent (proc:TFPgtkEventConfigureFunction; data:pointer) : guint;
  3730. begin
  3731. result := EventConfigureConnect (sgConfigureEvent, proc, data);
  3732. end;
  3733. function TFPgtkWidget.ConnectAfterConfigureEvent (proc:TFPgtkEventConfigureFunction; data:pointer) : guint;
  3734. begin
  3735. result := EventConfigureConnectAfter (sgConfigureEvent, proc, data);
  3736. end;
  3737. function EventFocusfunc (Sender:PGtkwidget; Event:PGdkEventFocus; data:pointer) : boolean; cdecl;
  3738. var p : TFPgtkEventFocusFunction;
  3739. begin
  3740. with PSignalData(data)^ do
  3741. begin
  3742. p := TFPgtkEventFocusFunction (TheSignalProc);
  3743. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3744. end;
  3745. end;
  3746. function TFPgtkWidget.EventFocusConnect (signal:string; proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  3747. begin
  3748. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventFocusfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3749. end;
  3750. function TFPgtkWidget.EventFocusConnectAfter (signal:string; proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  3751. begin
  3752. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventFocusfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3753. end;
  3754. function TFPgtkWidget.ConnectFocusInEvent (proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  3755. begin
  3756. result := EventFocusConnect (sgFocusInEvent, proc, data);
  3757. end;
  3758. function TFPgtkWidget.ConnectAfterFocusInEvent (proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  3759. begin
  3760. result := EventFocusConnectAfter (sgFocusInEvent, proc, data);
  3761. end;
  3762. function TFPgtkWidget.ConnectFocusOutEvent (proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  3763. begin
  3764. result := EventFocusConnect (sgFocusOutEvent, proc, data);
  3765. end;
  3766. function TFPgtkWidget.ConnectAfterFocusOutEvent (proc:TFPgtkEventFocusFunction; data:pointer) : guint;
  3767. begin
  3768. result := EventFocusConnectAfter (sgFocusOutEvent, proc, data);
  3769. end;
  3770. function TFPgtkWidget.ConnectMapEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3771. begin
  3772. result := EventConnect (sgMapEvent, proc, data);
  3773. end;
  3774. function TFPgtkWidget.ConnectAfterMapEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3775. begin
  3776. result := EventConnectAfter (sgMapEvent, proc, data);
  3777. end;
  3778. function TFPgtkWidget.ConnectUnmapEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3779. begin
  3780. result := EventConnect (sgUnmapEvent, proc, data);
  3781. end;
  3782. function TFPgtkWidget.ConnectAfterUnmapEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3783. begin
  3784. result := EventConnectAfter (sgUnmapEvent, proc, data);
  3785. end;
  3786. function EventPropertyfunc (Sender:PGtkwidget; Event:PGdkEventProperty; data:pointer) : boolean; cdecl;
  3787. var p : TFPgtkEventPropertyFunction;
  3788. begin
  3789. with PSignalData(data)^ do
  3790. begin
  3791. p := TFPgtkEventPropertyFunction (TheSignalProc);
  3792. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3793. end;
  3794. end;
  3795. function TFPgtkWidget.EventPropertyConnect (signal:string; proc:TFPgtkEventPropertyFunction; data:pointer) : guint;
  3796. begin
  3797. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventPropertyfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3798. end;
  3799. function TFPgtkWidget.EventPropertyConnectAfter (signal:string; proc:TFPgtkEventPropertyFunction; data:pointer) : guint;
  3800. begin
  3801. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventPropertyfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3802. end;
  3803. function TFPgtkWidget.ConnectPropertyNotifyEvent (proc:TFPgtkEventPropertyFunction; data:pointer) : guint;
  3804. begin
  3805. result := EventPropertyConnect (sgPropertyNotifyEvent, proc, data);
  3806. end;
  3807. function TFPgtkWidget.ConnectAfterPropertyNotifyEvent (proc:TFPgtkEventPropertyFunction; data:pointer) : guint;
  3808. begin
  3809. result := EventPropertyConnectAfter (sgPropertyNotifyEvent, proc, data);
  3810. end;
  3811. function EventSelectionfunc (Sender:PGtkwidget; Event:PGdkEventSelection; data:pointer) : boolean; cdecl;
  3812. var p : TFPgtkEventSelectionFunction;
  3813. begin
  3814. with PSignalData(data)^ do
  3815. begin
  3816. p := TFPgtkEventSelectionFunction (TheSignalProc);
  3817. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3818. end;
  3819. end;
  3820. function TFPgtkWidget.EventSelectionConnect (signal:string; proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  3821. begin
  3822. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventSelectionfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3823. end;
  3824. function TFPgtkWidget.EventSelectionConnectAfter (signal:string; proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  3825. begin
  3826. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventSelectionfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3827. end;
  3828. function TFPgtkWidget.ConnectSelectionClearEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  3829. begin
  3830. result := EventSelectionConnect (sgSelectionClearEvent, proc, data);
  3831. end;
  3832. function TFPgtkWidget.ConnectAfterSelectionClearEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  3833. begin
  3834. result := EventSelectionConnectAfter (sgSelectionClearEvent, proc, data);
  3835. end;
  3836. function TFPgtkWidget.ConnectSelectionRequestEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  3837. begin
  3838. result := EventSelectionConnect (sgSelectionRequestEvent, proc, data);
  3839. end;
  3840. function TFPgtkWidget.ConnectAfterSelectionRequestEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  3841. begin
  3842. result := EventSelectionConnectAfter (sgSelectionRequestEvent, proc, data);
  3843. end;
  3844. function TFPgtkWidget.ConnectSelectionNotifyEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  3845. begin
  3846. result := EventSelectionConnect (sgSelectionNotifyEvent, proc, data);
  3847. end;
  3848. function TFPgtkWidget.ConnectAfterSelectionNotifyEvent (proc:TFPgtkEventSelectionFunction; data:pointer) : guint;
  3849. begin
  3850. result := EventSelectionConnectAfter (sgSelectionNotifyEvent, proc, data);
  3851. end;
  3852. function EventProximityfunc (Sender:PGtkwidget; Event:PGdkEventProximity; data:pointer) : boolean; cdecl;
  3853. var p : TFPgtkEventProximityFunction;
  3854. begin
  3855. with PSignalData(data)^ do
  3856. begin
  3857. p := TFPgtkEventProximityFunction (TheSignalProc);
  3858. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3859. end;
  3860. end;
  3861. function TFPgtkWidget.EventProximityConnect (signal:string; proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  3862. begin
  3863. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventProximityfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3864. end;
  3865. function TFPgtkWidget.EventProximityConnectAfter (signal:string; proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  3866. begin
  3867. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventProximityfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3868. end;
  3869. function TFPgtkWidget.ConnectProximityInEvent (proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  3870. begin
  3871. result := EventProximityConnect (sgProximityInEvent, proc, data);
  3872. end;
  3873. function TFPgtkWidget.ConnectAfterProximityInEvent (proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  3874. begin
  3875. result := EventProximityConnectAfter (sgProximityInEvent, proc, data);
  3876. end;
  3877. function TFPgtkWidget.ConnectProximityOutEvent (proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  3878. begin
  3879. result := EventProximityConnect (sgProximityOutEvent, proc, data);
  3880. end;
  3881. function TFPgtkWidget.ConnectAfterProximityOutEvent (proc:TFPgtkEventProximityFunction; data:pointer) : guint;
  3882. begin
  3883. result := EventProximityConnectAfter (sgProximityOutEvent, proc, data);
  3884. end;
  3885. function EventClientfunc (Sender:PGtkwidget; Event:PGdkEventClient; data:pointer) : boolean; cdecl;
  3886. var p : TFPgtkEventClientFunction;
  3887. begin
  3888. with PSignalData(data)^ do
  3889. begin
  3890. p := TFPgtkEventClientFunction (TheSignalProc);
  3891. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3892. end;
  3893. end;
  3894. function TFPgtkWidget.EventClientConnect (signal:string; proc:TFPgtkEventClientFunction; data:pointer) : guint;
  3895. begin
  3896. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventClientfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3897. end;
  3898. function TFPgtkWidget.EventClientConnectAfter (signal:string; proc:TFPgtkEventClientFunction; data:pointer) : guint;
  3899. begin
  3900. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventClientfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3901. end;
  3902. function TFPgtkWidget.ConnectClientEvent (proc:TFPgtkEventClientFunction; data:pointer) : guint;
  3903. begin
  3904. result := EventClientConnect (sgClientEvent, proc, data);
  3905. end;
  3906. function TFPgtkWidget.ConnectAfterClientEvent (proc:TFPgtkEventClientFunction; data:pointer) : guint;
  3907. begin
  3908. result := EventClientConnectAfter (sgClientEvent, proc, data);
  3909. end;
  3910. function EventNoExposefunc (Sender:PGtkwidget; Event:PGdkEventNoExpose; data:pointer) : boolean; cdecl;
  3911. var p : TFPgtkEventNoExposeFunction;
  3912. begin
  3913. with PSignalData(data)^ do
  3914. begin
  3915. p := TFPgtkEventNoExposeFunction (TheSignalProc);
  3916. result := p (TheWidget as TFPgtkWidget, Event, TheData)
  3917. end;
  3918. end;
  3919. function TFPgtkWidget.EventNoExposeConnect (signal:string; proc:TFPgtkEventNoExposeFunction; data:pointer) : guint;
  3920. begin
  3921. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@EventNoExposefunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3922. end;
  3923. function TFPgtkWidget.EventNoExposeConnectAfter (signal:string; proc:TFPgtkEventNoExposeFunction; data:pointer) : guint;
  3924. begin
  3925. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@EventNoExposefunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  3926. end;
  3927. function TFPgtkWidget.ConnectNoExposeEvent (proc:TFPgtkEventNoExposeFunction; data:pointer) : guint;
  3928. begin
  3929. result := EventNoExposeConnect (sgNoExposeEvent, proc, data);
  3930. end;
  3931. function TFPgtkWidget.ConnectAfterNoExposeEvent (proc:TFPgtkEventNoExposeFunction; data:pointer) : guint;
  3932. begin
  3933. result := EventNoExposeConnectAfter (sgNoExposeEvent, proc, data);
  3934. end;
  3935. function TFPgtkWidget.ConnectVisibilityNotifyEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3936. begin
  3937. result := EventConnect (sgVisibilityNotifyEvent, proc, data);
  3938. end;
  3939. function TFPgtkWidget.ConnectAfterVisibilityNotifyEvent (proc:TFPgtkEventFunction; data:pointer) : guint;
  3940. begin
  3941. result := EventConnectAfter (sgVisibilityNotifyEvent, proc, data);
  3942. end;
  3943. procedure TFPgtkWidget.LockAccelerators;
  3944. begin
  3945. gtk_widget_lock_accelerators (TheGtkObject);
  3946. end;
  3947. procedure TFPgtkWidget.UnlockAccelerators;
  3948. begin
  3949. gtk_widget_unlock_accelerators (TheGtkObject);
  3950. end;
  3951. procedure TFPgtkWidget.RemoveAccelerators (aSignal:string; OnlyVisible:boolean);
  3952. begin
  3953. gtk_widget_remove_accelerators (TheGtkObject, ConvertToPgchar(aSignal), OnlyVisible);
  3954. end;
  3955. procedure TFPgtkWidget.ActivateAccelGroups (Key:guint; Mods:TGdkModifierType);
  3956. begin
  3957. gtk_accel_groups_activate (FGtkObject, Key, Mods);
  3958. end;
  3959. procedure TFPgtkWidget.AcceleratorAdd (AG:PGtkAccelGroup; aSignal:string; Key:guint; Mods:TGdkModifierType; acFlags:TGtkAccelFlags); Overload;
  3960. begin
  3961. gtk_widget_add_accelerator (TheGtkWidget, pgchar(aSignal),
  3962. AG, Key, Mods, acFlags);
  3963. end;
  3964. { TFPgtkGroup }
  3965. procedure TFPgtkGroup.FreeList;
  3966. begin
  3967. if FGList <> null then
  3968. begin
  3969. if FManageLists then
  3970. g_list_free (FGList);
  3971. FGList := null;
  3972. end;
  3973. end;
  3974. procedure TFPgtkGroup.FreeSList;
  3975. begin
  3976. if FGSList <> null then
  3977. begin
  3978. if FManageLists then
  3979. g_slist_free (FGSList);
  3980. FGSlist := null;
  3981. end;
  3982. end;
  3983. function TFPgtkGroup.CreateGList : PGList;
  3984. var r : integer;
  3985. begin
  3986. FreeList;
  3987. result := null;
  3988. for r := pred(count) downto 0 do
  3989. result := g_list_prepend (result, GetData(r));
  3990. FGList := result;
  3991. end;
  3992. function TFPgtkGroup.CreateGSList : PGSList;
  3993. var r : integer;
  3994. begin
  3995. FreeSList;
  3996. result := null;
  3997. for r := pred(count) downto 0 do
  3998. result := g_slist_prepend (result, GetData(r));
  3999. FGSList := result;
  4000. end;
  4001. procedure TFPgtkGroup.BuildFromGtkList;
  4002. var p : PGList;
  4003. begin
  4004. clear;
  4005. p := FGList;
  4006. while p <> null do
  4007. begin
  4008. add (UngetData(p^.data));
  4009. p := p^.Next;
  4010. end;
  4011. FListChanged := False;
  4012. FSListChanged := False;
  4013. FClassesChanged := False;
  4014. FreeSList;
  4015. end;
  4016. procedure TFPgtkGroup.BuildFromGtkSList;
  4017. var p :PGSList;
  4018. begin
  4019. clear;
  4020. p := FGSList;
  4021. while p <> null do
  4022. begin
  4023. add (UngetData(p^.data));
  4024. p := p^.Next;
  4025. end;
  4026. FListChanged := False;
  4027. FSListChanged := False;
  4028. FClassesChanged := False;
  4029. FreeList;
  4030. end;
  4031. procedure TFPgtkGroup.Notify (ptr:pointer; Action:TListNotification);
  4032. begin
  4033. inherited;
  4034. FClassesChanged := True;
  4035. end;
  4036. function TFPgtkGroup.GetData (index:integer) : pointer;
  4037. // GetData needs to give the pointer to the data in the List or SList of GTK
  4038. begin
  4039. result := items[index];
  4040. end;
  4041. function TFPgtkGroup.UngetData (data:pointer) : pointer;
  4042. // UngetData needs to give the item in this list from the datapointer of GTK
  4043. begin
  4044. result := data
  4045. end;
  4046. constructor TFPgtkGroup.Create;
  4047. begin
  4048. inherited create;
  4049. FClassesChanged := False;
  4050. FListChanged := false;
  4051. FSListChanged := False;
  4052. FGList := null;
  4053. FGSList := null;
  4054. FNotUpdating := True;
  4055. FManageLists := True;
  4056. end;
  4057. destructor TFPgtkGroup.Destroy;
  4058. begin
  4059. if ManageLists then
  4060. begin
  4061. FreeList;
  4062. FreeSList;
  4063. end;
  4064. inherited Destroy;
  4065. end;
  4066. function TFPgtkGroup.GetGtkList (buffered:boolean) : PGList;
  4067. begin
  4068. if buffered then
  4069. if FClasseschanged then
  4070. result := CreateGList
  4071. else if FSListChanged then
  4072. begin
  4073. BuildFromGtkSList;
  4074. result := CreateGList;
  4075. end
  4076. else
  4077. result := FGlist
  4078. else
  4079. result := CreateGList;
  4080. end;
  4081. function TFPgtkGroup.GetGtkSList (buffered:boolean) : PGSList;
  4082. begin
  4083. if buffered then
  4084. if FClassesChanged then
  4085. result := CreateGSList
  4086. else if FListChanged then
  4087. begin
  4088. BuildFromGtkList;
  4089. result := CreateGSList;
  4090. end
  4091. else
  4092. result := FGSlist
  4093. else
  4094. result := CreateGSList;
  4095. end;
  4096. procedure TFPgtkGroup.BeginUpdate;
  4097. begin
  4098. FNotUpdating := False;
  4099. end;
  4100. procedure TFPgtkGroup.EndUpdate;
  4101. begin
  4102. FNotUpdating := True;
  4103. if FlistChanged then
  4104. BuildFromGtkSList
  4105. else if FSListChanged then
  4106. BuildFromGtkSList
  4107. else if FClassesChanged then
  4108. begin
  4109. FreeSList;
  4110. FreeList;
  4111. end;
  4112. end;
  4113. procedure TFPgtkGroup.ForEach (Proc:TFPgtkForEachProcedure; data:pointer);
  4114. var r: integer;
  4115. begin
  4116. for r := 0 to pred(count) do
  4117. Proc (items[r], data);
  4118. end;
  4119. function TFPgtkGroup.GetGtkListProp : PGList;
  4120. begin
  4121. result := GetGtkList (True);
  4122. end;
  4123. procedure TFPgtkGroup.SetGtkListProp (TheValue:PGList);
  4124. begin
  4125. FGList := TheValue;
  4126. if FNotUpdating then
  4127. BuildFromGtkList
  4128. else
  4129. FListChanged := True;
  4130. end;
  4131. function TFPgtkGroup.GetGtkSListProp : PGSList;
  4132. begin
  4133. result := GetGtkSList (True);
  4134. end;
  4135. procedure TFPgtkGroup.SetGtkSListProp (TheValue:PGSList);
  4136. begin
  4137. FGSlist := TheValue;
  4138. if FNotUpdating then
  4139. BuildFromGtkSList
  4140. else
  4141. FSListChanged := True;
  4142. end;
  4143. { TFPgtkWidgetGroup }
  4144. function TFPgtkWidgetGroup.GetData (index:integer) : pointer;
  4145. begin
  4146. result := items[index].FgtkObject;
  4147. end;
  4148. function TFPgtkWidgetGroup.UnGetData (data:pointer) : pointer;
  4149. begin
  4150. result := GetPascalInstance (PGtkObject(Data));
  4151. end;
  4152. procedure TFPgtkWidgetGroup.AddToContainer (Container:TFPgtkContainer);
  4153. var r : integer;
  4154. begin
  4155. for r := 0 to pred(count) do
  4156. Container.Add (items[r]);
  4157. end;
  4158. procedure TFPgtkWidgetGroup.PackInBox (box:TFPgtkBox; AtStart:boolean; Expanding:boolean; Fill:boolean; Padding:integer);
  4159. var r : integer;
  4160. begin
  4161. if AtStart then
  4162. for r := 0 to pred(Count) do
  4163. box.PackStart (items[r], expanding, fill, padding)
  4164. else
  4165. for r := pred(Count) downto 0 do
  4166. box.PackEnd (items[r], expanding, fill, padding);
  4167. end;
  4168. function TFPgtkWidgetGroup.GetItem (Index:integer) : TFPgtkWidget;
  4169. begin
  4170. result := TFPgtkWidget (Inherited items[index]);
  4171. end;
  4172. procedure TFPgtkWidgetGroup.SetItem (Index:integer; TheValue:TFPgtkWidget);
  4173. begin
  4174. inherited items[index] := TheValue;
  4175. end;
  4176. function TFPgtkWidgetGroup.GetTooltips (index:integer) : string;
  4177. begin
  4178. result := items[index].Tooltip;
  4179. end;
  4180. procedure TFPgtkWidgetGroup.SetTooltips (index:integer; TheValue:string);
  4181. begin
  4182. Items[index].Tooltip := TheValue;
  4183. end;
  4184. { TFPgtkMisc }
  4185. function TFPgtkMisc.TheGtkObject : PGtkMisc;
  4186. begin
  4187. result := PgtkMisc(FGtkObject);
  4188. end;
  4189. procedure TFPgtkMisc.SetAlignment (x:gfloat; y:gfloat);
  4190. begin
  4191. gtk_misc_set_alignment (TheGtkObject, x, y);
  4192. end;
  4193. procedure TFPgtkMisc.SetPadding (x:word; y:word);
  4194. begin
  4195. gtk_misc_set_padding (TheGtkObject, x, y);
  4196. end;
  4197. function TFPgtkMisc.GetXAlign : gfloat;
  4198. begin
  4199. result := TheGtkObject^.XAlign;
  4200. end;
  4201. procedure TFPgtkMisc.SetXAlign (TheValue:gfloat);
  4202. begin
  4203. SetAlignment (TheValue, YAlign);
  4204. end;
  4205. function TFPgtkMisc.GetYAlign : gfloat;
  4206. begin
  4207. result := TheGtkObject^.YAlign;
  4208. end;
  4209. procedure TFPgtkMisc.SetYAlign (TheValue:gfloat);
  4210. begin
  4211. SetAlignment (XAlign, TheValue);
  4212. end;
  4213. function TFPgtkMisc.GetXPad : word;
  4214. begin
  4215. result := TheGtkObject^.XPad;
  4216. end;
  4217. procedure TFPgtkMisc.SetXPad (TheValue:word);
  4218. begin
  4219. SetPadding (TheValue, YPad);
  4220. end;
  4221. function TFPgtkMisc.GetYPad : word;
  4222. begin
  4223. result := TheGtkObject^.YPad;
  4224. end;
  4225. procedure TFPgtkMisc.SetYPad (TheValue:word);
  4226. begin
  4227. SetPadding (XPad, TheValue);
  4228. end;
  4229. { TFPgtkLabel }
  4230. function TFPgtkLabel.TheGtkObject : PGtkLabel;
  4231. begin
  4232. result := PgtkLabel(FGtkObject);
  4233. end;
  4234. procedure TFPgtkLabel.CreateGtkObject;
  4235. begin
  4236. FGtkObject := PGtkObject(gtk_label_new (null));
  4237. end;
  4238. constructor TFPgtkLabel.Create (aText:string);
  4239. begin
  4240. inherited create;
  4241. Text := aText;
  4242. SetAlignment (0.0, 0.5);
  4243. end;
  4244. function TFPgtkLabel.GetText : string;
  4245. begin
  4246. result := TheGtkObject^.TheLabel;
  4247. end;
  4248. procedure TFPgtkLabel.SetText (TheValue:string);
  4249. begin
  4250. gtk_label_set_text(TheGtkObject,ConvertToPgchar(TheValue));
  4251. end;
  4252. function TFPgtkLabel.GetPattern : string;
  4253. begin
  4254. result := TheGtkObject^.pattern;
  4255. end;
  4256. procedure TFPgtkLabel.SetPattern (TheValue:string);
  4257. begin
  4258. gtk_label_set_pattern(TheGtkObject,ConvertToPgchar(TheValue));
  4259. end;
  4260. function TFPgtkLabel.GetJustify : TGtkJustification;
  4261. begin
  4262. result := gtk.jtype(TheGtkObject^);
  4263. end;
  4264. procedure TFPgtkLabel.SetJustify (TheValue:TGtkJustification);
  4265. begin
  4266. gtk_label_set_justify(TheGtkObject,TheValue);
  4267. end;
  4268. function TFPgtkLabel.GetLineWrap : boolean;
  4269. begin
  4270. result := TheGtkObject^.wrap;
  4271. end;
  4272. procedure TFPgtkLabel.SetLineWrap (TheValue:boolean);
  4273. begin
  4274. gtk_label_set_line_wrap(TheGtkObject,TheValue);
  4275. end;
  4276. function TFPgtkLabel.ParseUline (aText:string) : guint;
  4277. begin
  4278. result := gtk_label_parse_uline (TheGtkObject, ConvertToPgchar(aText));
  4279. end;
  4280. { TFPgtkAccelLabel }
  4281. function TFPgtkAccelLabel.TheGtkObject : PGtkAccelLabel;
  4282. begin
  4283. result := PgtkAccelLabel(FGtkObject);
  4284. end;
  4285. procedure TFPgtkAccelLabel.CreateGtkObject;
  4286. begin
  4287. FGtkObject := PGtkObject(gtk_accel_label_new (''));
  4288. end;
  4289. function TFPgtkAccelLabel.GetAccelWidget : TFPgtkWidget;
  4290. begin
  4291. result := GetPascalInstance(PGtkObject(TheGtkObject^.accel_widget),tfpgtkwidget) as tfpgtkwidget;
  4292. end;
  4293. procedure TFPgtkAccelLabel.SetAccelWidget (TheValue:TFPgtkWidget);
  4294. begin
  4295. gtk_accel_label_set_accel_widget(TheGtkObject,PGtkwidget(ConvertToGtkObject(TheValue)));
  4296. end;
  4297. function TFPgtkAccelLabel.AccelText : string;
  4298. begin
  4299. result := TheGtkObject^.accel_string;
  4300. end;
  4301. procedure TFPgtkAccelLabel.Refetch;
  4302. begin
  4303. gtk_accel_label_refetch (TheGtkObject);
  4304. end;
  4305. { TFPgtkTipsQuery }
  4306. function TFPgtkTipsQuery.TheGtkObject : PGtkTipsQuery;
  4307. begin
  4308. result := PgtkTipsQuery(FGtkObject);
  4309. end;
  4310. procedure TFPgtkTipsQuery.CreateGtkObject;
  4311. begin
  4312. FGtkObject := PGtkObject(gtk_tips_query_new);
  4313. end;
  4314. { TFPgtkArrow }
  4315. function TFPgtkArrow.TheGtkObject : PGtkArrow;
  4316. begin
  4317. result := PgtkArrow(FGtkObject);
  4318. end;
  4319. procedure TFPgtkArrow.CreateGtkObject;
  4320. begin
  4321. FGtkObject := PGtkObject(gtk_arrow_new (GTK_ARROW_LEFT,GTK_SHADOW_NONE));
  4322. end;
  4323. function TFPgtkArrow.GetArrowType : TGtkArrowType;
  4324. begin
  4325. result := TGtkArrowType (TheGtkObject^.arrow_type);
  4326. end;
  4327. procedure TFPgtkArrow.SetArrowType (TheValue:TGtkArrowType);
  4328. begin
  4329. gtk_arrow_set (TheGtkObject, TheValue, ShadowType);
  4330. end;
  4331. function TFPgtkArrow.GetShadowType : TGtkShadowType;
  4332. begin
  4333. result := TGtkShadowtype (TheGtkObject^.shadow_type);
  4334. end;
  4335. procedure TFPgtkArrow.SetShadowType (TheValue:TGtkShadowType);
  4336. begin
  4337. gtk_arrow_set (TheGtkObject, ArrowType, TheValue);
  4338. end;
  4339. procedure TFPgtkArrow.SetTypes (AnArrowType:TGtkArrowType; AShadowtype:TGtkShadowType);
  4340. begin
  4341. gtk_arrow_set (TheGtkObject, AnArrowType, AShadowtype);
  4342. end;
  4343. constructor TFPgtkArrow.Create (AnArrowType:TGtkArrowType; AShadowType:TGtkShadowType);
  4344. begin
  4345. inherited create;
  4346. SetTypes (AnArrowType, AShadowType);
  4347. end;
  4348. { TFPgtkImage }
  4349. function TFPgtkImage.TheGtkObject : PGtkImage;
  4350. begin
  4351. result := PgtkImage(FGtkObject);
  4352. end;
  4353. procedure TFPgtkImage.CreateGtkObject;
  4354. begin
  4355. FGtkObject := PGtkObject(gtk_image_new (FImage, FMask));
  4356. end;
  4357. function TFPgtkImage.GetImageProp : PGdkImage;
  4358. var m : PGdkBitmap;
  4359. begin
  4360. gtk_image_get (TheGtkObject, @result, @m);
  4361. end;
  4362. procedure TFPgtkImage.SetImageProp (TheValue:PGdkImage);
  4363. begin
  4364. gtk_Image_set (TheGtkObject, TheValue, nil);
  4365. end;
  4366. function TFPgtkImage.GetMask : PGdkBitMap;
  4367. var p : PGdkImage;
  4368. begin
  4369. gtk_image_get (TheGtkObject, @p, @result);
  4370. end;
  4371. procedure TFPgtkImage.SetMask (TheValue:PGdkBitMap);
  4372. begin
  4373. gtk_image_set (TheGtkObject, Image, TheValue);
  4374. end;
  4375. procedure TFPgtkImage.SetImage (anImage:PGdkImage; aMask:PGdkBitmap);
  4376. begin
  4377. gtk_image_set (TheGtkObject, anImage, aMask);
  4378. end;
  4379. constructor TFPgtkImage.Create (anImage:PGdkImage; aMask:PGdkBitmap);
  4380. begin
  4381. FImage := anImage;
  4382. FMask := aMask;
  4383. inherited create;
  4384. end;
  4385. function NewImage (aWidth:integer; aHeight:integer) : PGdkImage;
  4386. begin
  4387. result := gdk_image_new (gdk_image_fastest, gdk_visual_get_system, aWidth, aHeight);
  4388. end;
  4389. { TFPgtkPixmap }
  4390. function TFPgtkPixmap.TheGtkObject : PGtkPixmap;
  4391. begin
  4392. result := PgtkPixmap(FGtkObject);
  4393. end;
  4394. procedure TFPgtkPixmap.CreateGtkObject;
  4395. begin
  4396. FGtkObject := PGtkObject(gtk_pixmap_new (FPixMap, FMask));
  4397. end;
  4398. var
  4399. EmptyBitmap : PGdkPixmap;
  4400. function StringsToPPgchar (Data:TStrings) : PPgchar;
  4401. var r : integer;
  4402. a : PStringArray;
  4403. begin
  4404. getmem (a, sizeof (pgchar) * Data.count);
  4405. for r := 0 to Data.Count-1 do
  4406. a^[r] := pchar (Data[r]);
  4407. result := ppgchar (a);
  4408. end;
  4409. function ArrayToPPgchar (Data:array of string) : PPgchar;
  4410. var r,t : integer;
  4411. a : PStringArray;
  4412. begin
  4413. getmem (a, sizeof (pgchar) * (high(data)-low(data)+1));
  4414. t := 0;
  4415. for r := low(data) to high(data) do
  4416. begin
  4417. a^[r] := pchar (data[t]);
  4418. inc (t);
  4419. end;
  4420. result := ppgchar (a);
  4421. end;
  4422. function TFPgtkPixmap.GetBuildInsensitive : longbool;
  4423. begin
  4424. result := longbool(gtk.build_insensitive(TheGtkObject^));
  4425. end;
  4426. procedure TFPgtkPixmap.SetBuildInsensitive (TheValue:longbool);
  4427. begin
  4428. gtk_pixmap_set_build_insensitive(TheGtkObject,gint(TheValue));
  4429. end;
  4430. constructor TFPgtkPixmap.Create;
  4431. begin
  4432. if not assigned (EmptyBitmap) then
  4433. EmptyBitmap := gdk_pixmap_new (null, 1, 1, 1);
  4434. FPixMap := EmptyBitmap;
  4435. FMask := PGdkBitmap (EmptyBitmap);
  4436. inherited create;
  4437. end;
  4438. constructor TFPgtkPixmap.CreateFromFile (Filename:string; Window:TFPgtkWidget);
  4439. begin
  4440. FPixMap := gdk_pixmap_create_from_xpm (ConvertToGtkWidget(Window)^.window, @FMask, nil, pgchar(Filename));
  4441. inherited create;
  4442. end;
  4443. constructor TFPgtkPixmap.CreateFromStrings (Data:TStrings; Window:TFPgtkWidget);
  4444. var ppdata : ppgchar;
  4445. begin
  4446. ppdata := StringsToPPgchar(Data);
  4447. FPixMap := gdk_pixmap_create_from_xpm_d (ConvertToGtkWidget(Window)^.window, @FMask, nil, ppdata);
  4448. inherited create;
  4449. freemem (ppdata, sizeof (pgchar) * Data.count);
  4450. end;
  4451. constructor TFPgtkPixmap.CreateFromText (Data:string; Window:TFPgtkWidget);
  4452. var l : TStrings;
  4453. begin
  4454. l := TStringList.Create;
  4455. try
  4456. l.Text := data;
  4457. CreateFromStrings (l, Window);
  4458. finally
  4459. l.Free;
  4460. end;
  4461. end;
  4462. function TFPgtkPixmap.GetPixmapProp : PGdkPixMap;
  4463. var m : PGdkBitmap;
  4464. begin
  4465. gtk_pixmap_get (TheGtkObject, @result, @m);
  4466. end;
  4467. procedure TFPgtkPixmap.SetPixmapProp (TheValue:PGdkPixMap);
  4468. begin
  4469. gtk_pixmap_set (TheGtkObject, TheValue, nil);
  4470. end;
  4471. function TFPgtkPixmap.GetMask : PGdkBitMap;
  4472. var p : PGdkPixmap;
  4473. begin
  4474. gtk_pixmap_get (TheGtkObject, @p, @result);
  4475. end;
  4476. procedure TFPgtkPixmap.SetMask (TheValue:PGdkBitMap);
  4477. begin
  4478. gtk_pixmap_set (TheGtkObject, Pixmap, TheValue);
  4479. end;
  4480. procedure TFPgtkPixmap.SetPixmap (aPixmap:PGdkPixMap; aMask:PGdkBitmap);
  4481. begin
  4482. gtk_pixmap_set (TheGtkObject, aPixmap, aMask);
  4483. end;
  4484. procedure TFPgtkPixmap.GetPixmap (var aPixmap:PGdkPixmap; var aMask:PGdkBitmap);
  4485. var P:PGdkPixmap;
  4486. M:PGdkBitmap;
  4487. begin
  4488. gtk_pixmap_get (TheGtkObject, @p, @m);
  4489. apixmap := p;
  4490. amask := m;
  4491. end;
  4492. procedure TFPgtkPixmap.LoadFromFile (Filename:string);
  4493. var bm : PGdkBitmap;
  4494. pm : PGdkPixmap;
  4495. begin
  4496. pm := gdk_pixmap_colormap_create_from_xpm (nil, Colormap, @bm, nil, pgchar(Filename));
  4497. SetPixmap (pm, bm);
  4498. end;
  4499. procedure TFPgtkPixmap.LoadFromStrings (data:TStrings);
  4500. var bm : PGdkBitmap;
  4501. pm : PGdkPixmap;
  4502. ppdata : ppgchar;
  4503. begin
  4504. ppdata := StringsToPPgchar(Data);
  4505. pm := gdk_pixmap_colormap_create_from_xpm_d (nil, Colormap, @bm, nil, ppdata);
  4506. SetPixmap (pm, bm);
  4507. freemem (ppdata, sizeof (pgchar) * Data.count);
  4508. end;
  4509. procedure TFPgtkPixmap.LoadFromText (data:string);
  4510. var l : TStrings;
  4511. begin
  4512. l := TStringList.Create;
  4513. try
  4514. l.Text := data;
  4515. LoadFromStrings (l);
  4516. finally
  4517. l.Free;
  4518. end;
  4519. end;
  4520. procedure TFPgtkPixmap.LoadFromArray (data:array of string);
  4521. var bm : PGdkBitmap;
  4522. pm : PGdkPixmap;
  4523. ppdata : ppgchar;
  4524. begin
  4525. ppdata := ArrayToPPgchar(Data);
  4526. pm := gdk_pixmap_colormap_create_from_xpm_d (nil, Colormap, @bm, nil, ppdata);
  4527. SetPixmap (pm, bm);
  4528. freemem (ppdata, sizeof (pgchar) * (high(data)-low(data)+1));
  4529. end;
  4530. procedure CreateGdkPixmap (var ThePixmap:PGdkPixmap; var TheMask:PGdkBitmap; aWindow:PGdkWindow; data:array of string);
  4531. var ppdata : ppgchar;
  4532. begin
  4533. ppdata := ArrayToPPgchar(Data);
  4534. ThePixmap := gdk_pixmap_create_from_xpm_d (aWindow, @TheMask, nil, ppdata);
  4535. freemem (ppdata, sizeof (pgchar) * (high(data)-low(data)+1));
  4536. end;
  4537. { TFPgtkContainer }
  4538. function TFPgtkContainer.TheGtkObject : PGtkContainer;
  4539. begin
  4540. result := PgtkContainer(FGtkObject);
  4541. end;
  4542. function TFPgtkContainer.GetBorder : integer;
  4543. begin
  4544. result := gtk.border_width(TheGtkObject^);
  4545. end;
  4546. procedure TFPgtkContainer.SetBorder (TheValue:integer);
  4547. begin
  4548. gtk_container_set_border_width(TheGtkObject,TheValue);
  4549. end;
  4550. procedure TFPgtkContainer.Add (AWidget:TFPgtkWidget; IsVisible:boolean); Overload;
  4551. begin
  4552. gtk_container_add (TheGtkObject, ConvertToGtkWidget(AWidget));
  4553. if IsVisible then
  4554. AWidget.Show;
  4555. end;
  4556. procedure TFPgtkContainer.Add (AWidget:TFPgtkWidget); Overload;
  4557. begin
  4558. gtk_container_add (TheGtkObject, ConvertToGtkWidget(AWidget));
  4559. AWidget.Show;
  4560. end;
  4561. procedure TFPgtkContainer.Remove (AWidget:TFPgtkWidget);
  4562. begin
  4563. gtk_container_remove (TheGtkObject, PGtkwidget(ConvertToGtkObject(AWidget)));
  4564. end;
  4565. constructor TFPgtkContainer.Create;
  4566. begin
  4567. inherited create;
  4568. FChildren := TFPgtkWidgetGroup.Create;
  4569. end;
  4570. destructor TFPgtkContainer.Destroy;
  4571. begin
  4572. if assigned(FChildren) then
  4573. FChildren.Free;
  4574. inherited destroy;
  4575. end;
  4576. function TFPgtkContainer.GetChildren : TFPgtkWidgetGroup;
  4577. begin
  4578. FChildren.GtkList := gtk_container_children (TheGtkObject);
  4579. result := FChildren;
  4580. end;
  4581. procedure TFPgtkContainer.Focus (Direction:TGtkDirectionType);
  4582. begin
  4583. gtk_container_focus (TheGtkObject, Direction);
  4584. end;
  4585. procedure TFPgtkContainer.FocusChild (Child:TFPgtkWidget);
  4586. begin
  4587. gtk_container_set_focus_child (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)));
  4588. end;
  4589. procedure TFPgtkContainer.RegisterToplevel;
  4590. begin
  4591. gtk_container_register_toplevel (TheGtkObject);
  4592. end;
  4593. procedure TFPgtkContainer.UnregisterToplevel;
  4594. begin
  4595. gtk_container_unregister_toplevel (TheGtkObject);
  4596. end;
  4597. procedure TFPgtkContainer.ResizeChildren;
  4598. begin
  4599. gtk_container_resize_children (TheGtkObject);
  4600. end;
  4601. function DirectionFunctionSignalfunc (Sender:PGtkobject; Direction:TGtkDirectionType; data:pointer) : TGtkDirectionType; cdecl;
  4602. var p : TFPgtkDirectionFunctionSignalFunction;
  4603. begin
  4604. with PSignalData(data)^ do
  4605. begin
  4606. p := TFPgtkDirectionFunctionSignalFunction (TheSignalProc);
  4607. result := p (TheWidget as TFPgtkObject, Direction, TheData)
  4608. end;
  4609. end;
  4610. function TFPgtkContainer.DirectionFunctionSignalConnect (signal:string; proc:TFPgtkDirectionFunctionSignalFunction; data:pointer) : guint;
  4611. begin
  4612. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@DirectionFunctionSignalfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  4613. end;
  4614. function TFPgtkContainer.DirectionFunctionSignalConnectAfter (signal:string; proc:TFPgtkDirectionFunctionSignalFunction; data:pointer) : guint;
  4615. begin
  4616. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@DirectionFunctionSignalfunc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  4617. end;
  4618. function TFPgtkContainer.ConnectAdd (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  4619. begin
  4620. result := WidgetSignalConnect (sgAdd, proc, data);
  4621. end;
  4622. function TFPgtkContainer.ConnectAfterAdd (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  4623. begin
  4624. result := WidgetSignalConnectAfter (sgAdd, proc, data);
  4625. end;
  4626. function TFPgtkContainer.ConnectRemove (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  4627. begin
  4628. result := WidgetSignalConnect (sgRemove, proc, data);
  4629. end;
  4630. function TFPgtkContainer.ConnectAfterRemove (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  4631. begin
  4632. result := WidgetSignalConnectAfter (sgRemove, proc, data);
  4633. end;
  4634. function TFPgtkContainer.ConnectCheckResize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4635. begin
  4636. result := SignalConnect (sgCheckResize, proc, data);
  4637. end;
  4638. function TFPgtkContainer.ConnectAfterCheckResize (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4639. begin
  4640. result := SignalConnectAfter (sgCheckResize, proc, data);
  4641. end;
  4642. function TFPgtkContainer.ConnectFocus (proc:TFPgtkDirectionFunctionSignalFunction; data:pointer) : guint;
  4643. begin
  4644. result := DirectionFunctionSignalConnect (sgFocus, proc, data);
  4645. end;
  4646. function TFPgtkContainer.ConnectAfterFocus (proc:TFPgtkDirectionFunctionSignalFunction; data:pointer) : guint;
  4647. begin
  4648. result := DirectionFunctionSignalConnectAfter (sgFocus, proc, data);
  4649. end;
  4650. function TFPgtkContainer.ConnectSetFocusChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  4651. begin
  4652. result := WidgetSignalConnect (sgSetFocusChild, proc, data);
  4653. end;
  4654. function TFPgtkContainer.ConnectAfterSetFocusChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  4655. begin
  4656. result := WidgetSignalConnectAfter (sgSetFocusChild, proc, data);
  4657. end;
  4658. { TFPgtkBin }
  4659. function TFPgtkBin.TheGtkObject : PGtkBin;
  4660. begin
  4661. result := PgtkBin(FGtkObject);
  4662. end;
  4663. function TFPgtkBin.GetChild : TFPgtkWidget;
  4664. begin
  4665. result := GetPascalInstance(PGtkObject(TheGtkObject^.Child),tfpgtkwidget) as tfpgtkwidget;
  4666. end;
  4667. procedure TFPgtkBin.SetChild (TheValue:TFPgtkWidget);
  4668. begin
  4669. Add (TheValue);
  4670. end;
  4671. { TFPgtkAlignment }
  4672. function TFPgtkAlignment.TheGtkObject : PGtkAlignment;
  4673. begin
  4674. result := PgtkAlignment(FGtkObject);
  4675. end;
  4676. procedure TFPgtkAlignment.Configure (anXAlign:gfloat; anYAlign:gfloat; anXScale:gfloat; anYScale:gfloat);
  4677. begin
  4678. gtk_alignment_set (TheGtkObject, anXAlign, anYAlign, anXScale, anYScale);
  4679. end;
  4680. { TFPgtkFrame }
  4681. function TFPgtkFrame.TheGtkObject : PGtkFrame;
  4682. begin
  4683. result := PgtkFrame(FGtkObject);
  4684. end;
  4685. procedure TFPgtkFrame.CreateGtkObject;
  4686. begin
  4687. FGtkObject := PGtkObject(gtk_frame_new (nil));
  4688. end;
  4689. function TFPgtkFrame.GetText : string;
  4690. begin
  4691. result := TheGtkObject^.thelabel;
  4692. end;
  4693. procedure TFPgtkFrame.SetText (TheValue:string);
  4694. begin
  4695. gtk_frame_set_label(TheGtkObject,ConvertToPgchar(TheValue));
  4696. end;
  4697. function TFPgtkFrame.GetAlignment : gfloat;
  4698. begin
  4699. result := TheGtkObject^.label_xalign;
  4700. end;
  4701. procedure TFPgtkFrame.SetAlignment (TheValue:gfloat);
  4702. begin
  4703. gtk_frame_set_label_align (ThegtkObject, TheValue, 0.0);
  4704. end;
  4705. function TFPgtkFrame.GetShadowType : TgtkShadowType;
  4706. begin
  4707. result := TheGtkObject^.shadow_type;
  4708. end;
  4709. procedure TFPgtkFrame.SetShadowType (TheValue:TgtkShadowType);
  4710. begin
  4711. gtk_frame_set_shadow_type(TheGtkObject,TheValue);
  4712. end;
  4713. { TFPgtkAspectFrame }
  4714. function TFPgtkAspectFrame.TheGtkObject : PGtkAspectFrame;
  4715. begin
  4716. result := PgtkAspectFrame(FGtkObject);
  4717. end;
  4718. procedure TFPgtkAspectFrame.CreateGtkObject;
  4719. begin
  4720. FGtkObject := PGtkObject(gtk_aspect_frame_new (nil,0,0,1,1));
  4721. end;
  4722. procedure TFPgtkAspectFrame.Configure (anXAlign:gfloat; anYAlign:gfloat; Ratio:gfloat; ObeyChild:longbool);
  4723. begin
  4724. gtk_aspect_frame_set (TheGtkObject, anXAlign, anYAlign, Ratio, gint(ObeyChild));
  4725. end;
  4726. { TFPgtkButton }
  4727. function TFPgtkButton.TheGtkObject : PGtkButton;
  4728. begin
  4729. result := PgtkButton(FGtkObject);
  4730. end;
  4731. procedure TFPgtkButton.CreateGtkObject;
  4732. begin
  4733. FGtkObject := PGtkObject(gtk_button_new);
  4734. end;
  4735. function TFPgtkButton.LabelClass : TFPgtkLabelClass;
  4736. begin
  4737. result := TFPgtkLabel;
  4738. end;
  4739. procedure TFPgtkButton.CreateLabel (aText:string);
  4740. begin
  4741. if not assigned (FLabel) then
  4742. begin
  4743. FLabel := LabelClass.Create ('');
  4744. with FLabel do
  4745. begin
  4746. AskNotification (Self);
  4747. FAccelKey := ParseULine (aText);
  4748. end;
  4749. if assigned(AddContainer) then
  4750. AddContainer.Add (FLabel)
  4751. else
  4752. Add (FLabel);
  4753. LabelCreated;
  4754. end;
  4755. end;
  4756. procedure TFPgtkButton.NotifyDestroy (AnObject:TFPgtkObject);
  4757. begin
  4758. inherited;
  4759. if AnObject = FLabel then
  4760. FLabel := nil;
  4761. end;
  4762. function TFPgtkButton.ConnectClicked (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4763. begin
  4764. result := SignalConnect (sgClicked, proc, data);
  4765. end;
  4766. function TFPgtkButton.ConnectAfterClicked (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4767. begin
  4768. result := SignalConnectAfter (sgClicked, proc, data);
  4769. end;
  4770. function TFPgtkButton.ConnectPressed (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4771. begin
  4772. result := SignalConnect (sgPressed, proc, data);
  4773. end;
  4774. function TFPgtkButton.ConnectAfterPressed (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4775. begin
  4776. result := SignalConnectAfter (sgPressed, proc, data);
  4777. end;
  4778. function TFPgtkButton.ConnectReleased (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4779. begin
  4780. result := SignalConnect (sgReleased, proc, data);
  4781. end;
  4782. function TFPgtkButton.ConnectAfterReleased (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4783. begin
  4784. result := SignalConnectAfter (sgReleased, proc, data);
  4785. end;
  4786. function TFPgtkButton.ConnectEnter (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4787. begin
  4788. result := SignalConnect (sgEnter, proc, data);
  4789. end;
  4790. function TFPgtkButton.ConnectAfterEnter (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4791. begin
  4792. result := SignalConnectAfter (sgEnter, proc, data);
  4793. end;
  4794. function TFPgtkButton.ConnectLeave (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4795. begin
  4796. result := SignalConnect (sgLeave, proc, data);
  4797. end;
  4798. function TFPgtkButton.ConnectAfterLeave (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4799. begin
  4800. result := SignalConnectAfter (sgLeave, proc, data);
  4801. end;
  4802. procedure TFPgtkButton.Clicked;
  4803. begin
  4804. gtk_button_Clicked (TheGtkObject);
  4805. end;
  4806. procedure TFPgtkButton.Pressed;
  4807. begin
  4808. gtk_button_Pressed (TheGtkObject);
  4809. end;
  4810. procedure TFPgtkButton.Released;
  4811. begin
  4812. gtk_button_Released (TheGtkObject);
  4813. end;
  4814. procedure TFPgtkButton.Enter;
  4815. begin
  4816. gtk_button_Enter (TheGtkObject);
  4817. end;
  4818. procedure TFPgtkButton.Leave;
  4819. begin
  4820. gtk_button_Leave (TheGtkObject);
  4821. end;
  4822. constructor TFPgtkButton.Create;
  4823. begin
  4824. inherited create;
  4825. FAddContainer := nil;
  4826. end;
  4827. constructor TFPgtkButton.CreateWithLabel (aText:string);
  4828. begin
  4829. create;
  4830. Text := aText;
  4831. end;
  4832. constructor TFPgtkButton.CreateWithLabel (aText:string; AccelGroup:PGtkAccelGroup);
  4833. begin
  4834. create;
  4835. Text := aText;
  4836. if (FAccelKey <> 0) and assigned(AccelGroup) then
  4837. AcceleratorAdd (AccelGroup, sgClicked, FAccelKey, DefaultButtonModifiers, GTK_ACCEL_Visible);
  4838. end;
  4839. function TFPgtkButton.GetText : string;
  4840. begin
  4841. if assigned (FLabel) then
  4842. result := FLabel.Text
  4843. else
  4844. result := '';
  4845. end;
  4846. procedure TFPgtkButton.SetText (TheValue:string);
  4847. begin
  4848. if assigned (FLabel) then
  4849. FLabel.Text := TheValue
  4850. else
  4851. if TheValue <> '' then
  4852. CreateLabel (TheValue);
  4853. end;
  4854. function TFPgtkButton.GetReliefStyle : TGtkReliefStyle;
  4855. begin
  4856. result := gtk_button_get_relief(TheGtkObject);
  4857. end;
  4858. procedure TFPgtkButton.SetReliefStyle (TheValue:TGtkReliefStyle);
  4859. begin
  4860. gtk_button_set_relief(TheGtkObject,TheValue);
  4861. end;
  4862. procedure TFPgtkButton.LabelCreated;
  4863. begin
  4864. FLabel.setalignment (0.5,0.5);
  4865. end;
  4866. { TFPgtkToggleButton }
  4867. function TFPgtkToggleButton.TheGtkObject : PGtkToggleButton;
  4868. begin
  4869. result := PgtkToggleButton(FGtkObject);
  4870. end;
  4871. procedure TFPgtkToggleButton.CreateGtkObject;
  4872. begin
  4873. FGtkObject := PGtkObject(gtk_toggle_button_new);
  4874. end;
  4875. function TFPgtkToggleButton.ConnectToggled (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4876. begin
  4877. result := SignalConnect (sgToggled, proc, data);
  4878. end;
  4879. function TFPgtkToggleButton.ConnectAfterToggled (proc:TFPgtkSignalFunction; data:pointer) : guint;
  4880. begin
  4881. result := SignalConnectAfter (sgToggled, proc, data);
  4882. end;
  4883. procedure TFPgtkToggleButton.Toggled;
  4884. begin
  4885. gtk_toggle_button_toggled (TheGtkObject);
  4886. end;
  4887. function TFPgtkToggleButton.GetActive : boolean;
  4888. begin
  4889. result := gtk_toggle_button_get_active(TheGtkObject);
  4890. end;
  4891. procedure TFPgtkToggleButton.SetActive (TheValue:boolean);
  4892. begin
  4893. gtk_toggle_button_set_active(TheGtkObject,TheValue);
  4894. end;
  4895. function TFPgtkToggleButton.GetDrawIndicator : boolean;
  4896. begin
  4897. result := boolean(gtk.draw_indicator(TheGtkObject^));
  4898. end;
  4899. procedure TFPgtkToggleButton.SetDrawIndicator (TheValue:boolean);
  4900. begin
  4901. gtk.Set_draw_indicator(TheGtkObject^,guint(TheValue))
  4902. end;
  4903. { TFPgtkCheckButton }
  4904. function TFPgtkCheckButton.TheGtkObject : PGtkCheckButton;
  4905. begin
  4906. result := PgtkCheckButton(FGtkObject);
  4907. end;
  4908. procedure TFPgtkCheckButton.CreateGtkObject;
  4909. begin
  4910. FGtkObject := PGtkObject(gtk_check_button_new);
  4911. end;
  4912. { TFPgtkRadioButton }
  4913. function TFPgtkRadioButton.TheGtkObject : PGtkRadioButton;
  4914. begin
  4915. result := PgtkRadioButton(FGtkObject);
  4916. end;
  4917. constructor TFPgtkRadioButton.Create (AGroup:TFPgtkRadioButtonGroup);
  4918. begin
  4919. FGroup := AGroup;
  4920. inherited create;
  4921. end;
  4922. constructor TFPgtkRadioButton.CreateWithLabel (AGroup:TFPgtkRadioButtonGroup; aText:string);
  4923. begin
  4924. FGroup := AGroup;
  4925. inherited CreateWithLabel (aText);
  4926. end;
  4927. procedure TFPgtkRadioButton.CreateGtkObject;
  4928. begin
  4929. if not assigned (FGroup) then
  4930. FGroup := TFPgtkRadioButtonGroup.Create;
  4931. TheGtkWidget := gtk_radio_button_new (FGroup.GtkSList);
  4932. FGroup.GtkSList := gtk_radio_button_group (TheGtkObject);
  4933. end;
  4934. { TFPgtkRadioButtonGroup }
  4935. function TFPgtkRadioButtonGroup.GetItem (index:integer) : TFPgtkRadioButton;
  4936. begin
  4937. result := TFPgtkRadioButton(Inherited items[index]);
  4938. end;
  4939. procedure TFPgtkRadioButtonGroup.SetItem (index:integer; TheValue:TFPgtkRadioButton);
  4940. begin
  4941. inherited items[index] := TheValue;
  4942. end;
  4943. function TFPgtkRadioButtonGroup.ActiveButtonText : string;
  4944. begin
  4945. result := ActiveButton.Text;
  4946. end;
  4947. function TFPgtkRadioButtonGroup.ActiveButtonIndex : integer;
  4948. begin
  4949. Result := pred(count);
  4950. while (Result >= 0) and (not items[Result].Active) do
  4951. dec (Result);
  4952. end;
  4953. function TFPgtkRadioButtonGroup.ActiveButton : TFPgtkRadioButton;
  4954. var r : integer;
  4955. begin
  4956. r := ActiveButtonIndex;
  4957. if r >= 0 then
  4958. result := items[r]
  4959. else
  4960. result := nil;
  4961. end;
  4962. function RadioButtonGroupCreateFromStrings (TheItems:TStrings; ToggledFunction:TFPgtkSignalFunction) : TFPgtkRadioButtonGroup;
  4963. var r : integer;
  4964. b : TFPgtkRadioButton;
  4965. begin
  4966. result := TFPgtkRadioButtonGroup.Create;
  4967. result.BeginUpdate;
  4968. for r := TheItems.count-1 downto 0 do
  4969. begin
  4970. b := TFPgtkRadioButton.CreateWithLabel (result, TheItems[r]);
  4971. if assigned(toggledfunction) then
  4972. b.connecttoggled (ToggledFunction, IntToPointer(r));
  4973. end;
  4974. b.active := true;
  4975. result.EndUpdate;
  4976. end;
  4977. { TFPgtkOptionMenu }
  4978. function TFPgtkOptionMenu.TheGtkObject : PGtkOptionMenu;
  4979. begin
  4980. result := PgtkOptionMenu(FGtkObject);
  4981. end;
  4982. procedure TFPgtkOptionMenu.CreateGtkObject;
  4983. begin
  4984. FGtkObject := PGtkObject(gtk_option_menu_new);
  4985. end;
  4986. function TFPgtkOptionMenu.GetMenu : TFPgtkMenu;
  4987. begin
  4988. result := GetPascalInstance(PGtkObject(gtk_option_menu_get_menu(TheGtkObject)),tfpgtkmenu) as tfpgtkmenu;
  4989. end;
  4990. procedure TFPgtkOptionMenu.setmenu (TheValue:TFPgtkMenu);
  4991. begin
  4992. gtk_option_menu_set_menu(TheGtkObject, ConvertToGtkWidget(TheValue));
  4993. end;
  4994. procedure TFPgtkOptionMenu.RemoveMenu;
  4995. begin
  4996. gtk_option_menu_remove_menu (TheGtkObject);
  4997. end;
  4998. procedure TFPgtkOptionMenu.SetHistory (index:integer);
  4999. begin
  5000. gtk_option_menu_set_history (TheGtkObject, index);
  5001. end;
  5002. procedure TFPgtkOptionMenu.Clear;
  5003. var w : TFPgtkWidget;
  5004. begin
  5005. w := Menu;
  5006. if assigned(w) then
  5007. begin
  5008. w := TFPgtkMenu(w).Active;
  5009. if assigned (w) then
  5010. TFPgtkItem(w).Deselect;
  5011. end;
  5012. end;
  5013. { TFPgtkItem }
  5014. function TFPgtkItem.TheGtkObject : PGtkItem;
  5015. begin
  5016. result := PgtkItem(FGtkObject);
  5017. end;
  5018. function TFPgtkItem.LabelClass : TFPgtkLabelClass;
  5019. begin
  5020. result := TFPgtkLabel;
  5021. end;
  5022. procedure TFPgtkItem.CreateLabel (aText:string);
  5023. begin
  5024. if not assigned (FLabel) then
  5025. begin
  5026. FLabel := LabelClass.Create ('');
  5027. with FLabel do
  5028. begin
  5029. AskNotification (Self);
  5030. FAccelKey := ParseULine (aText);
  5031. end;
  5032. if assigned(AddContainer) then
  5033. AddContainer.Add (FLabel)
  5034. else
  5035. Add (FLabel);
  5036. LabelCreated;
  5037. end;
  5038. end;
  5039. procedure TFPgtkItem.NotifyDestroy (AnObject:TFPgtkObject);
  5040. begin
  5041. inherited;
  5042. if AnObject = FLabel then
  5043. FLabel := nil;
  5044. end;
  5045. function TFPgtkItem.ConnectSelect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5046. begin
  5047. result := SignalConnect (sgSelect, proc, data);
  5048. end;
  5049. function TFPgtkItem.ConnectAfterSelect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5050. begin
  5051. result := SignalConnectAfter (sgSelect, proc, data);
  5052. end;
  5053. function TFPgtkItem.ConnectDeselect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5054. begin
  5055. result := SignalConnect (sgDeselect, proc, data);
  5056. end;
  5057. function TFPgtkItem.ConnectAfterDeselect (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5058. begin
  5059. result := SignalConnectAfter (sgDeselect, proc, data);
  5060. end;
  5061. function TFPgtkItem.ConnectToggle (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5062. begin
  5063. result := SignalConnect (sgToggle, proc, data);
  5064. end;
  5065. function TFPgtkItem.ConnectAfterToggle (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5066. begin
  5067. result := SignalConnectAfter (sgToggle, proc, data);
  5068. end;
  5069. procedure TFPgtkItem.Select;
  5070. begin
  5071. gtk_item_Select (TheGtkObject);
  5072. end;
  5073. procedure TFPgtkItem.Deselect;
  5074. begin
  5075. gtk_item_Deselect (TheGtkObject);
  5076. end;
  5077. procedure TFPgtkItem.Toggle;
  5078. begin
  5079. gtk_item_Toggle (TheGtkObject);
  5080. end;
  5081. constructor TFPgtkItem.Create;
  5082. begin
  5083. inherited;
  5084. FAddContainer := nil;
  5085. end;
  5086. constructor TFPgtkItem.CreateWithLabel (aText:string);
  5087. begin
  5088. inherited create;
  5089. Text := aText;
  5090. end;
  5091. function TFPgtkItem.GetText : string;
  5092. begin
  5093. if assigned (FLabel) then
  5094. result := FLabel.Text
  5095. else
  5096. result := '';
  5097. end;
  5098. procedure TFPgtkItem.SetText (TheValue:string);
  5099. begin
  5100. if assigned (FLabel) then
  5101. FLabel.Text := TheValue
  5102. else
  5103. if TheValue <> '' then
  5104. CreateLabel (TheValue);
  5105. end;
  5106. procedure TFPgtkItem.LabelCreated;
  5107. begin
  5108. end;
  5109. { TFPgtkItemGroup }
  5110. function TFPgtkItemGroup.GetItem (index:integer) : TFPgtkItem;
  5111. begin
  5112. result := TFPgtkItem (inherited items[index]);
  5113. end;
  5114. procedure TFPgtkItemGroup.SetItem (index:integer; TheValue:TFPgtkItem);
  5115. begin
  5116. inherited items[index] := TheValue;
  5117. end;
  5118. procedure TFPgtkItemGroup.FillFromList (aList:TStrings);
  5119. var r : integer;
  5120. i : TFPgtkItem;
  5121. begin
  5122. BeginUpdate;
  5123. for r := 0 to aList.count-1 do
  5124. begin
  5125. i := FItemClass.CreateWithLabel (aList[r]);
  5126. add (i);
  5127. i.Show;
  5128. end;
  5129. EndUpdate;
  5130. end;
  5131. procedure TFPgtkItemGroup.FillFromCommaText (aList:string);
  5132. var l : TStrings;
  5133. begin
  5134. l := TStringList.Create;
  5135. try
  5136. l.commatext := aList;
  5137. FillFromList (l);
  5138. finally
  5139. l.Free;
  5140. end;
  5141. end;
  5142. procedure TFPgtkItemGroup.FillFromArray (aList:array of string);
  5143. var r : integer;
  5144. l : TStrings;
  5145. begin
  5146. l := TStringlist.Create;
  5147. try
  5148. for r := low (aList) to high(aList) do
  5149. l.Add (aList[r]);
  5150. FillFromList (l);
  5151. finally
  5152. l.Free;
  5153. end;
  5154. end;
  5155. procedure TFPgtkItemGroup.SignalConnect (Signal:string; proc:TFPgtkSignalFunction; data:pointer);
  5156. var r : integer;
  5157. begin
  5158. if assigned (Proc) then
  5159. for r := 0 to count-1 do
  5160. Items[r].SignalConnect (Signal, proc, data);
  5161. end;
  5162. constructor TFPgtkItemGroup.create (AnItemClass:TFPgtkItemClass);
  5163. begin
  5164. inherited create;
  5165. FItemClass := AnItemClass;
  5166. end;
  5167. function TFPgtkItemGroup.AddTextItem (aText:string) : TFPgtkItem;
  5168. begin
  5169. result := FItemClass.CreateWithLabel (aText);
  5170. Add (result);
  5171. result.Show;
  5172. end;
  5173. { TFPgtkMenuItem }
  5174. function TFPgtkMenuItem.TheGtkObject : PGtkMenuItem;
  5175. begin
  5176. result := PgtkMenuItem(FGtkObject);
  5177. end;
  5178. procedure TFPgtkMenuItem.CreateGtkObject;
  5179. begin
  5180. FGtkObject := PGtkObject(gtk_menu_item_new);
  5181. end;
  5182. function TFPgtkMenuItem.ConnectActivate (proc:TFPgtksignalFunction; data:pointer) : guint;
  5183. begin
  5184. result := signalConnect (sgActivate, proc, data);
  5185. end;
  5186. function TFPgtkMenuItem.ConnectAfterActivate (proc:TFPgtksignalFunction; data:pointer) : guint;
  5187. begin
  5188. result := signalConnectAfter (sgActivate, proc, data);
  5189. end;
  5190. function TFPgtkMenuItem.ConnectActivateItem (proc:TFPgtksignalFunction; data:pointer) : guint;
  5191. begin
  5192. result := signalConnect (sgActivateItem, proc, data);
  5193. end;
  5194. function TFPgtkMenuItem.ConnectAfterActivateItem (proc:TFPgtksignalFunction; data:pointer) : guint;
  5195. begin
  5196. result := signalConnectAfter (sgActivateItem, proc, data);
  5197. end;
  5198. procedure TFPgtkMenuItem.Activate;
  5199. begin
  5200. gtk_menu_item_activate (TheGtkObject);
  5201. end;
  5202. procedure TFPgtkMenuItem.SetSubMenu (aSubMenu:TFPgtkWidget);
  5203. begin
  5204. gtk_menu_item_Set_submenu (TheGtkObject, PGtkwidget(ConvertToGtkObject(aSubMenu)));
  5205. end;
  5206. procedure TFPgtkMenuItem.RemoveSubMenu;
  5207. begin
  5208. gtk_menu_item_remove_submenu (TheGtkObject);
  5209. end;
  5210. procedure TFPgtkMenuItem.Configure (ShowToggleIndicator:boolean; ShowSubmenuIndicator:boolean);
  5211. begin
  5212. gtk_menu_item_configure (TheGtkObject, ord(ShowToggleIndicator), ord(ShowSubmenuIndicator));
  5213. end;
  5214. procedure TFPgtkMenuItem.RightJustify;
  5215. begin
  5216. gtk_menu_item_right_justify (TheGtkObject);
  5217. end;
  5218. function TFPgtkMenuItem.GetPlacement : TGtkSubmenuPlacement;
  5219. begin
  5220. result := TGtkSubmenuPlacement(submenu_placement(TheGtkObject^));
  5221. end;
  5222. procedure TFPgtkMenuItem.SetPlacement (TheValue:TGtkSubmenuPlacement);
  5223. begin
  5224. gtk_menu_item_set_placement(TheGtkObject,TheValue);
  5225. end;
  5226. function TFPgtkMenuItem.GetToggleIndicator : boolean;
  5227. begin
  5228. result := boolean(gtk.show_toggle_indicator(TheGtkObject^));
  5229. end;
  5230. procedure TFPgtkMenuItem.SetToggleIndicator (TheValue:boolean);
  5231. begin
  5232. Configure (TheValue, SubMenuIndicator);
  5233. end;
  5234. function TFPgtkMenuItem.GetSubMenuIndicator : boolean;
  5235. begin
  5236. result := boolean(gtk.show_submenu_indicator(TheGtkObject^));
  5237. end;
  5238. procedure TFPgtkMenuItem.SetSubMenuIndicator (TheValue:boolean);
  5239. begin
  5240. configure (ToggleIndicator, TheValue);
  5241. end;
  5242. function TFPgtkMenuItem.GetJustifyRight : boolean;
  5243. begin
  5244. result := boolean(gtk.right_justify(TheGtkObject^));
  5245. end;
  5246. procedure TFPgtkMenuItem.SetJustifyRight (TheValue:boolean);
  5247. begin
  5248. gtk.Set_right_justify(TheGtkObject^,guint(TheValue))
  5249. end;
  5250. function TFPgtkMenuItem.GetSubMenu : TFPgtkMenuShell;
  5251. begin
  5252. result := GetPascalInstance(PGtkObject(TheGtkObject^.submenu),tfpgtkmenushell) as tfpgtkmenushell;
  5253. end;
  5254. procedure TFPgtkMenuItem.SetPropSubMenu (TheValue:TFPgtkMenuShell);
  5255. begin
  5256. SetSubMenu (TheValue);
  5257. end;
  5258. function TFPgtkMenuItem.LabelClass : TFPgtkLabelClass;
  5259. begin
  5260. result := TFPgtkAccelLabel;
  5261. end;
  5262. procedure TFPgtkMenuItem.LabelCreated;
  5263. begin
  5264. with (TheLabel as TFPgtkAccelLabel) do
  5265. AccelWidget := Self;
  5266. end;
  5267. { TFPgtkCheckMenuItem }
  5268. function TFPgtkCheckMenuItem.TheGtkObject : PGtkCheckMenuItem;
  5269. begin
  5270. result := PgtkCheckMenuItem(FGtkObject);
  5271. end;
  5272. procedure TFPgtkCheckMenuItem.CreateGtkObject;
  5273. begin
  5274. FGtkObject := PGtkObject(gtk_check_menu_item_new);
  5275. end;
  5276. function TFPgtkCheckMenuItem.ConnectToggled (proc:TFPgtksignalFunction; data:pointer) : guint;
  5277. begin
  5278. result := signalConnect (sgToggled, proc, data);
  5279. end;
  5280. function TFPgtkCheckMenuItem.ConnectAfterToggled (proc:TFPgtksignalFunction; data:pointer) : guint;
  5281. begin
  5282. result := signalConnectAfter (sgToggled, proc, data);
  5283. end;
  5284. procedure TFPgtkCheckMenuItem.Toggled;
  5285. begin
  5286. gtk_check_menu_item_toggled (TheGtkObject);
  5287. end;
  5288. function TFPgtkCheckMenuItem.GetActive : boolean;
  5289. begin
  5290. result := boolean(gtk.active(TheGtkObject^));
  5291. end;
  5292. procedure TFPgtkCheckMenuItem.SetActive (TheValue:boolean);
  5293. begin
  5294. gtk_check_menu_item_set_active(TheGtkObject,TheValue);
  5295. end;
  5296. function TFPgtkCheckMenuItem.GetShowToggle : boolean;
  5297. begin
  5298. result := boolean(gtk.always_show_toggle(TheGtkObject^));
  5299. end;
  5300. procedure TFPgtkCheckMenuItem.SetShowToggle (TheValue:boolean);
  5301. begin
  5302. gtk_check_menu_item_set_show_toggle(TheGtkObject,TheValue);
  5303. end;
  5304. { TFPgtkRadioMenuItem }
  5305. function TFPgtkRadioMenuItem.TheGtkObject : PGtkRadioMenuItem;
  5306. begin
  5307. result := PgtkRadioMenuItem(FGtkObject);
  5308. end;
  5309. procedure TFPgtkRadioMenuItem.CreateGtkObject;
  5310. begin
  5311. if not assigned(FGroup) then
  5312. FGroup := TFPgtkRadioMenuGroup.Create;
  5313. TheGtkWidget := gtk_radio_menu_item_new (FGroup.GtkSList);
  5314. FGroup.GtkSList := gtk_radio_menu_item_group (TheGtkObject);
  5315. end;
  5316. constructor TFPgtkRadioMenuItem.Create (AGroup:TFPgtkRadioMenuGroup);
  5317. begin
  5318. FGroup := AGroup;
  5319. inherited create;
  5320. end;
  5321. constructor TFPgtkRadioMenuItem.CreateWithLabel (Agroup:TFPgtkRadioMenuGroup; aText:string);
  5322. begin
  5323. FGroup := Agroup;
  5324. inherited CreateWithLabel (aText);
  5325. end;
  5326. { TFPgtkRadioMenuGroup }
  5327. function TFPgtkRadioMenuGroup.GetItem (index:integer) : TFPgtkRadioMenuItem;
  5328. begin
  5329. result := TFPgtkRadioMenuItem(Inherited items[index]);
  5330. end;
  5331. procedure TFPgtkRadioMenuGroup.SetItem (index:integer; TheValue:TFPgtkRadioMenuItem);
  5332. begin
  5333. inherited items[index] := TheValue;
  5334. end;
  5335. function TFPgtkRadioMenuGroup.ActiveMenuText : string;
  5336. begin
  5337. result := ActiveMenu.Text;
  5338. end;
  5339. function TFPgtkRadioMenuGroup.ActiveMenuIndex : integer;
  5340. begin
  5341. Result := pred(count);
  5342. while (Result >= 0) and (not items[Result].Active) do
  5343. dec (Result);
  5344. end;
  5345. function TFPgtkRadioMenuGroup.ActiveMenu : TFPgtkRadioMenuItem;
  5346. var r : integer;
  5347. begin
  5348. r := ActiveMenuIndex;
  5349. if r >= 0 then
  5350. result := items[r]
  5351. else
  5352. result := nil;
  5353. end;
  5354. constructor TFPgtkRadioMenuGroup.create;
  5355. begin
  5356. inherited create (TFPgtkRadioMenuItem);
  5357. end;
  5358. { TFPgtkTearOffMenuItem }
  5359. function TFPgtkTearOffMenuItem.TheGtkObject : PGtkTearOffMenuItem;
  5360. begin
  5361. result := PgtkTearOffMenuItem(FGtkObject);
  5362. end;
  5363. procedure TFPgtkTearOffMenuItem.CreateGtkObject;
  5364. begin
  5365. FGtkObject := PGtkObject(gtk_tearoff_menu_item_new);
  5366. end;
  5367. { TFPgtkListItem }
  5368. function TFPgtkListItem.TheGtkObject : PGtkListItem;
  5369. begin
  5370. result := PgtkListItem(FGtkObject);
  5371. end;
  5372. procedure TFPgtkListItem.CreateGtkObject;
  5373. begin
  5374. FGtkObject := PGtkObject(gtk_list_item_new);
  5375. end;
  5376. procedure ScrollSignalproc (Sender:PGtkobject; ScrollType:TgtkScrollType; position:gfloat; data:pointer); cdecl;
  5377. var p : TFPgtkScrollSignalFunction;
  5378. begin
  5379. with PSignalData(data)^ do
  5380. begin
  5381. p := TFPgtkScrollSignalFunction (TheSignalProc);
  5382. p (TheWidget as TFPgtkObject, ScrollType, position, TheData)
  5383. end;
  5384. end;
  5385. function TFPgtkListItem.ScrollSignalConnect (signal:string; proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  5386. begin
  5387. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@ScrollSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  5388. end;
  5389. function TFPgtkListItem.ScrollSignalConnectAfter (signal:string; proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  5390. begin
  5391. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@ScrollSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  5392. end;
  5393. procedure ScrollBooleanSignalproc (Sender:PGtkobject; ScrolType:TgtkScrollType; Position:gfloat; AutoStartSelection:boolean; data:pointer); cdecl;
  5394. var p : TFPgtkScrollBooleanSignalFunction;
  5395. begin
  5396. with PSignalData(data)^ do
  5397. begin
  5398. p := TFPgtkScrollBooleanSignalFunction (TheSignalProc);
  5399. p (TheWidget as TFPgtkObject, ScrolType, Position, AutoStartSelection, TheData)
  5400. end;
  5401. end;
  5402. function TFPgtkListItem.ScrollBooleanSignalConnect (signal:string; proc:TFPgtkScrollBooleanSignalFunction; data:pointer) : guint;
  5403. begin
  5404. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@ScrollBooleanSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  5405. end;
  5406. function TFPgtkListItem.ScrollBooleanSignalConnectAfter (signal:string; proc:TFPgtkScrollBooleanSignalFunction; data:pointer) : guint;
  5407. begin
  5408. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@ScrollBooleanSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  5409. end;
  5410. function TFPgtkListItem.ConnectToggleFocusRow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5411. begin
  5412. result := SignalConnect (sgToggleFocusRow, proc, data);
  5413. end;
  5414. function TFPgtkListItem.ConnectAfterToggleFocusRow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5415. begin
  5416. result := SignalConnectAfter (sgToggleFocusRow, proc, data);
  5417. end;
  5418. function TFPgtkListItem.ConnectSelectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5419. begin
  5420. result := SignalConnect (sgSelectAll, proc, data);
  5421. end;
  5422. function TFPgtkListItem.ConnectAfterSelectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5423. begin
  5424. result := SignalConnectAfter (sgSelectAll, proc, data);
  5425. end;
  5426. function TFPgtkListItem.ConnectUnselectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5427. begin
  5428. result := SignalConnect (sgUnselectAll, proc, data);
  5429. end;
  5430. function TFPgtkListItem.ConnectAfterUnselectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5431. begin
  5432. result := SignalConnectAfter (sgUnselectAll, proc, data);
  5433. end;
  5434. function TFPgtkListItem.ConnectUndoSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5435. begin
  5436. result := SignalConnect (sgUndoSelection, proc, data);
  5437. end;
  5438. function TFPgtkListItem.ConnectAfterUndoSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5439. begin
  5440. result := SignalConnectAfter (sgUndoSelection, proc, data);
  5441. end;
  5442. function TFPgtkListItem.ConnectStartSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5443. begin
  5444. result := SignalConnect (sgStartSelection, proc, data);
  5445. end;
  5446. function TFPgtkListItem.ConnectAfterStartSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5447. begin
  5448. result := SignalConnectAfter (sgStartSelection, proc, data);
  5449. end;
  5450. function TFPgtkListItem.ConnectEndSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5451. begin
  5452. result := SignalConnect (sgEndSelection, proc, data);
  5453. end;
  5454. function TFPgtkListItem.ConnectAfterEndSelection (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5455. begin
  5456. result := SignalConnectAfter (sgEndSelection, proc, data);
  5457. end;
  5458. function TFPgtkListItem.ConnectToggleAddMode (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5459. begin
  5460. result := SignalConnect (sgToggleAddMode, proc, data);
  5461. end;
  5462. function TFPgtkListItem.ConnectAfterToggleAddMode (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5463. begin
  5464. result := SignalConnectAfter (sgToggleAddMode, proc, data);
  5465. end;
  5466. function TFPgtkListItem.ConnectExtendSelection (proc:TFPgtkScrollBooleanSignalFunction; data:pointer) : guint;
  5467. begin
  5468. result := ScrollBooleanSignalConnect (sgExtendSelection, proc, data);
  5469. end;
  5470. function TFPgtkListItem.ConnectAfterExtendSelection (proc:TFPgtkScrollBooleanSignalFunction; data:pointer) : guint;
  5471. begin
  5472. result := ScrollBooleanSignalConnectAfter (sgExtendSelection, proc, data);
  5473. end;
  5474. function TFPgtkListItem.ConnectScrollVertical (proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  5475. begin
  5476. result := ScrollSignalConnect (sgScrollVertical, proc, data);
  5477. end;
  5478. function TFPgtkListItem.ConnectAfterScrollVertical (proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  5479. begin
  5480. result := ScrollSignalConnectAfter (sgScrollVertical, proc, data);
  5481. end;
  5482. function TFPgtkListItem.ConnectScrollHorizontal (proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  5483. begin
  5484. result := ScrollSignalConnect (sgScrollHorizontal, proc, data);
  5485. end;
  5486. function TFPgtkListItem.ConnectAfterScrollHorizontal (proc:TFPgtkScrollSignalFunction; data:pointer) : guint;
  5487. begin
  5488. result := ScrollSignalConnectAfter (sgScrollHorizontal, proc, data);
  5489. end;
  5490. procedure TFPgtkListItem.Select;
  5491. begin
  5492. gtk_list_item_select (TheGtkObject);
  5493. end;
  5494. procedure TFPgtkListItem.Deselect;
  5495. begin
  5496. gtk_list_item_deselect (TheGtkObject);
  5497. end;
  5498. { TFPgtkListItemGroup }
  5499. constructor TFPgtkListItemGroup.create;
  5500. begin
  5501. inherited create (TFPgtkListItem);
  5502. ManageLists := false;
  5503. end;
  5504. { TFPgtkTreeItem }
  5505. function TFPgtkTreeItem.TheGtkObject : PGtkTreeItem;
  5506. begin
  5507. result := PgtkTreeItem(FGtkObject);
  5508. end;
  5509. procedure TFPgtkTreeItem.CreateGtkObject;
  5510. begin
  5511. FGtkObject := PGtkObject(gtk_tree_item_new);
  5512. end;
  5513. function TFPgtkTreeItem.GetSubTree : TFPgtkWidget;
  5514. begin
  5515. result := GetPascalInstance(PGtkObject(gtk_tree_item_subtree(TheGtkObject)),tfpgtkwidget) as tfpgtkwidget;
  5516. end;
  5517. procedure TFPgtkTreeItem.SetSubTree (TheValue:TFPgtkWidget);
  5518. begin
  5519. if assigned(TheValue) then
  5520. gtk_tree_item_set_subtree (TheGtkObject, ConvertToGtkWidget(TheValue))
  5521. else
  5522. gtk_tree_item_remove_subtree (TheGtkObject);
  5523. end;
  5524. function TFPgtkTreeItem.GetPixPlus : TFPgtkWidget;
  5525. begin
  5526. result := GetPascalInstance(PGtkObject(TheGtkObject^.plus_pix_widget),tfpgtkwidget) as tfpgtkwidget;
  5527. end;
  5528. function TFPgtkTreeItem.GetPixMinus : TFPgtkWidget;
  5529. begin
  5530. result := GetPascalInstance(PGtkObject(TheGtkObject^.minus_pix_widget),tfpgtkwidget) as tfpgtkwidget;
  5531. end;
  5532. function TFPgtkTreeItem.GetExpanded : boolean;
  5533. begin
  5534. result := boolean(gtk.expanded(TheGtkObject^));
  5535. end;
  5536. procedure TFPgtkTreeItem.SetExpanded (TheValue:boolean);
  5537. begin
  5538. if TheValue then
  5539. Expand
  5540. else
  5541. collapse;
  5542. end;
  5543. procedure TFPgtkTreeItem.Select;
  5544. begin
  5545. gtk_tree_item_select (TheGtkObject);
  5546. end;
  5547. procedure TFPgtkTreeItem.Deselect;
  5548. begin
  5549. gtk_tree_item_deselect (TheGtkObject);
  5550. end;
  5551. procedure TFPgtkTreeItem.Expand;
  5552. begin
  5553. gtk_tree_item_expand (TheGtkObject);
  5554. end;
  5555. procedure TFPgtkTreeItem.Collapse;
  5556. begin
  5557. gtk_tree_item_collapse (TheGtkObject);
  5558. end;
  5559. function TFPgtkTreeItem.ConnectCollapse (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5560. begin
  5561. result := SignalConnect (sgCollapse, proc, data);
  5562. end;
  5563. function TFPgtkTreeItem.ConnectAfterCollapse (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5564. begin
  5565. result := SignalConnectAfter (sgCollapse, proc, data);
  5566. end;
  5567. function TFPgtkTreeItem.ConnectExpand (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5568. begin
  5569. result := SignalConnect (sgExpand, proc, data);
  5570. end;
  5571. function TFPgtkTreeItem.ConnectAfterExpand (proc:TFPgtkSignalFunction; data:pointer) : guint;
  5572. begin
  5573. result := SignalConnectAfter (sgExpand, proc, data);
  5574. end;
  5575. { TFPgtkWindow }
  5576. function TFPgtkWindow.TheGtkObject : PGtkWindow;
  5577. begin
  5578. result := PgtkWindow(FGtkObject);
  5579. end;
  5580. procedure TFPgtkWindow.CreateGtkObject;
  5581. begin
  5582. FGtkObject := PGtkObject(gtk_window_new (TheWindowType));
  5583. end;
  5584. constructor TFPgtkWindow.Create (AType:TGtkWindowType);
  5585. begin
  5586. TheWindowType := AType;
  5587. inherited Create;
  5588. FAccelGroups := TList.Create;
  5589. FMainLevel := NoMainLevel;
  5590. end;
  5591. destructor TFPgtkWindow.Destroy;
  5592. begin
  5593. FAccelGroups.Free;
  5594. inherited;
  5595. end;
  5596. function TFPgtkWindow.GetWindowType : TGtkWindowType;
  5597. begin
  5598. result := TheGtkObject^.thetype;
  5599. end;
  5600. procedure TFPgtkWindow.SetWindowType (TheValue:TGtkWindowType);
  5601. begin
  5602. TheGtkObject^.thetype := TheValue;
  5603. end;
  5604. function TFPgtkWindow.GetTitle : string;
  5605. begin
  5606. result := TheGtkObject^.title;
  5607. end;
  5608. procedure TFPgtkWindow.SetTitle (TheValue:string);
  5609. begin
  5610. gtk_window_set_title(TheGtkObject,ConvertToPgchar(TheValue));
  5611. end;
  5612. function TFPgtkWindow.GetModal : boolean;
  5613. begin
  5614. result := boolean(gtk.modal(TheGtkObject^));
  5615. end;
  5616. procedure TFPgtkWindow.SetModal (TheValue:boolean);
  5617. begin
  5618. gtk_window_set_modal(TheGtkObject,TheValue);
  5619. end;
  5620. procedure TFPgtkWindow.DoDialogResult (Action:integer; Sender:TFPgtkObject);
  5621. begin
  5622. if assigned (OnDialogResult) then
  5623. OnDialogResult (self, FDialogResult, Action, Sender);
  5624. end;
  5625. procedure TFPgtkWindow.DoDialogInit (InitData:pointer);
  5626. begin
  5627. if assigned (OnDialogInit) then
  5628. OnDialogInit (self, InitData);
  5629. FDialogResult := InitData;
  5630. end;
  5631. procedure TFPgtkWindow.Close;
  5632. begin
  5633. if (FDestroying = dsAlive) then
  5634. gtk_widget_destroy (TheGtkWidget);
  5635. end;
  5636. procedure TFPgtkWindow.CloseWindow (Sender:TFPgtkObject; data:pointer);
  5637. begin
  5638. Close;
  5639. end;
  5640. procedure TFPgtkWindow.CloseWithResult (Sender:TFPgtkObject; data:pointer);
  5641. begin
  5642. ModalAction := pointertoint(data);
  5643. end;
  5644. procedure TFPgtkWindow.SetModalAction (TheValue:integer);
  5645. begin
  5646. FModalAction := TheValue;
  5647. if TheValue <> 0 then
  5648. begin
  5649. DoDialogResult (FModalAction, self);
  5650. close;
  5651. end;
  5652. end;
  5653. procedure TFPgtkWindow.ExecuteEnds (Sender:TFPgtkObject; data:pointer);
  5654. begin
  5655. if gtk_main_level = FMainLevel then
  5656. gtk_main_quit;
  5657. end;
  5658. function TFPgtkWindow.Execute (anOnDialogInit:DialogInitCallBack; anInitData:pointer; anOnDialogResult:DialogResultCallBack) : integer;
  5659. begin
  5660. FModalAction := drNone;
  5661. if assigned (anOnDialogInit) then
  5662. OnDialogInit := anOnDialogInit;
  5663. DoDialogInit (anInitData);
  5664. if assigned (anOnDialogResult) then
  5665. OnDialogResult := anOnDialogResult;
  5666. ConnectDestroy (@ExecuteEnds, nil);
  5667. Modal := True;
  5668. Show;
  5669. FMainLevel := gtk_main_level + 1;
  5670. try
  5671. gtk_main;
  5672. result := FModalAction;
  5673. finally
  5674. FMainLevel := NoMainLevel;
  5675. end;
  5676. end;
  5677. function TFPgtkWindow.ConnectSetFocus (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  5678. begin
  5679. result := WidgetSignalConnect (sgSetFocus, proc, data);
  5680. end;
  5681. function TFPgtkWindow.ConnectAfterSetFocus (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  5682. begin
  5683. result := WidgetSignalConnectAfter (sgSetFocus, proc, data);
  5684. end;
  5685. procedure TFPgtkWindow.SetTransientFor (aParent:TFPgtkWindow);
  5686. begin
  5687. gtk_window_set_transient_for (TheGtkObject, PGtkwindow(ConvertToGtkObject(aParent)));
  5688. end;
  5689. procedure TFPgtkWindow.DefaultWidget (Widget:TFPgtkWidget);
  5690. begin
  5691. gtk_window_set_default (TheGtkObject, PGtkwidget(ConvertToGtkObject(Widget)));
  5692. end;
  5693. procedure TFPgtkWindow.FocusedWidget (NewFocus:TFPgtkWidget);
  5694. begin
  5695. gtk_window_set_focus (TheGtkObject, PGtkwidget(ConvertToGtkObject(NewFocus)));
  5696. end;
  5697. function TFPgtkWindow.GetUserSizable : boolean;
  5698. begin
  5699. result := (allow_grow(TheGtkObject^)=1) and (auto_shrink(TheGtkObject^)=0);
  5700. end;
  5701. procedure TFPgtkWindow.SetUserSizable (TheValue:boolean);
  5702. begin
  5703. if TheValue then
  5704. gtk_window_set_policy (TheGtkObject, gint(FALSE), gint(TRUE), gint(FALSE))
  5705. else
  5706. gtk_window_set_policy (TheGtkObject, gint(FALSE), gint(FALSE), gint(TRUE));
  5707. end;
  5708. procedure TFPgtkWindow.ActivateFocus;
  5709. begin
  5710. gtk_window_activate_focus (TheGtkObject);
  5711. end;
  5712. procedure TFPgtkWindow.ActivateDefault;
  5713. begin
  5714. gtk_window_activate_default (TheGtkObject);
  5715. end;
  5716. procedure TFPgtkWindow.SetDefaultSize (Width:gint; Height:gint);
  5717. begin
  5718. gtk_window_set_default_size (TheGtkObject, Width, Height);
  5719. end;
  5720. function TFPgtkWindow.GetPosition : TGtkWindowPosition;
  5721. begin
  5722. result := TGtkWindowPosition (gtk.position (TheGtkObject^));
  5723. end;
  5724. procedure TFPgtkWindow.SetPosition (TheValue:TGtkWindowPosition);
  5725. begin
  5726. gtk_window_set_position(TheGtkObject,TheValue);
  5727. end;
  5728. function TFPgtkWindow.GetAccelGroups (ID:integer) : PGtkAccelGroup;
  5729. begin
  5730. result := FAccelGroups[ID];
  5731. if result = nil then
  5732. result := FAccelGroups[-1];
  5733. end;
  5734. function TFPgtkWindow.AccelGroupNew : integer;
  5735. var ag : Pgtkaccelgroup;
  5736. begin
  5737. result := FAccelGroups.Count;
  5738. ag := gtk_accel_group_new;
  5739. FAccelGroups.Add (ag);
  5740. gtk_window_add_accel_group (TheGtkObject, ag);
  5741. end;
  5742. procedure TFPgtkWindow.AccelGroupDelete (ID:integer);
  5743. begin
  5744. gtk_accel_group_detach (FAccelGroups[ID], FGtkObject);
  5745. FAccelGroups[ID] := nil;
  5746. end;
  5747. procedure TFPgtkWindow.AcceleratorAdd (AG:integer; aWidget:TFPgtkWidget; aSignal:string; Key:guint; Mods:TGdkModifierType; acFlags:TGtkAccelFlags); Overload;
  5748. begin
  5749. gtk_widget_add_accelerator (ConvertToGtkWidget(aWidget), pgchar(aSignal),
  5750. AccelGroups[AG], Key, Mods, acFlags);
  5751. end;
  5752. procedure AcceleratorAdd (AG:PGtkAccelGroup; aWidget:TFPgtkWidget; aSignal:string; Key:guint; Mods:TGdkModifierType; Flags:TGtkAccelFlags);
  5753. begin
  5754. gtk_widget_add_accelerator (ConvertToGtkWidget(aWidget), pgchar(aSignal),
  5755. AG, Key, Mods, Flags);
  5756. end;
  5757. procedure TFPgtkWindow.AcceleratorRemove (AG:integer; aWidget:TFPgtkWidget; Key:guint; Mods:TGdkModifierType); Overload;
  5758. begin
  5759. gtk_widget_remove_accelerator (ConvertToGtkWidget(aWidget), AccelGroups[AG], Key, Mods);
  5760. end;
  5761. procedure AcceleratorRemove (AG:PGtkAccelGroup; aWidget:TFPgtkWidget; Key:guint; Mods:TGdkModifierType); Overload;
  5762. begin
  5763. gtk_widget_remove_accelerator (ConvertToGtkWidget(aWidget), AG, Key, Mods);
  5764. end;
  5765. procedure TFPgtkWindow.AccelGroupLock (AG:integer);
  5766. begin
  5767. gtk_accel_group_lock (AccelGroups[AG]);
  5768. end;
  5769. procedure AccelGroupLock (AG:PGtkAccelGroup);
  5770. begin
  5771. gtk_accel_group_lock (AG);
  5772. end;
  5773. procedure TFPgtkWindow.AccelGroupUnlock (AG:integer);
  5774. begin
  5775. gtk_accel_group_unlock (AccelGroups[AG]);
  5776. end;
  5777. procedure AccelGroupUnlock (AG:PGtkAccelGroup);
  5778. begin
  5779. gtk_accel_group_unlock (AG);
  5780. end;
  5781. function AccelKeyName (Key:guint; Mods:TGdkModifierType) : string;
  5782. begin
  5783. result := string (gtk_accelerator_name(Key, Mods));
  5784. end;
  5785. procedure AccelKeyParse (AccelName:string; var Key:guint; var Mods:TGdkModifierType);
  5786. var k : guint;
  5787. m : TGdkModifierType;
  5788. begin
  5789. gtk_accelerator_parse (pgchar(AccelName), @k, @m);
  5790. Key := k;
  5791. Mods := m;
  5792. end;
  5793. procedure TFPgtkWindow.AccelGroupActivate (AG:integer; Key:guint; Mods:TGdkModifierType);
  5794. begin
  5795. gtk_accel_group_activate (AccelGroups[AG], Key, Mods);
  5796. end;
  5797. procedure AccelGroupActivate (AG:PGtkAccelGroup; Key:guint; Mods:TGdkModifierType);
  5798. begin
  5799. gtk_accel_group_activate (AG, Key, Mods);
  5800. end;
  5801. { TFPgtkColorSelectionDialog }
  5802. function TFPgtkColorSelectionDialog.TheGtkObject : PGtkColorSelectionDialog;
  5803. begin
  5804. result := PgtkColorSelectionDialog(FGtkObject);
  5805. end;
  5806. procedure TFPgtkColorSelectionDialog.CreateGtkObject;
  5807. begin
  5808. FGtkObject := PGtkObject(gtk_color_selection_dialog_new (''));
  5809. end;
  5810. function TFPgtkColorSelectionDialog.GetColorSel : TFPgtkColorSelection;
  5811. begin
  5812. result := GetPascalInstance(PGtkObject(TheGtkObject^.Colorsel),tfpgtkcolorselection) as tfpgtkcolorselection;
  5813. end;
  5814. function TFPgtkColorSelectionDialog.GetButtonOK : TFPgtkButton;
  5815. begin
  5816. result := GetPascalInstance(PGtkObject(TheGtkObject^.ok_button),tfpgtkbutton) as tfpgtkbutton;
  5817. end;
  5818. function TFPgtkColorSelectionDialog.GetButtonCancel : TFPgtkButton;
  5819. begin
  5820. result := GetPascalInstance(PGtkObject(TheGtkObject^.cancel_button),tfpgtkbutton) as tfpgtkbutton;
  5821. end;
  5822. function TFPgtkColorSelectionDialog.GetButtonHelp : TFPgtkButton;
  5823. begin
  5824. result := GetPascalInstance(PGtkObject(TheGtkObject^.help_button),tfpgtkbutton) as tfpgtkbutton;
  5825. end;
  5826. { TFPgtkDialog }
  5827. function TFPgtkDialog.TheGtkObject : PGtkDialog;
  5828. begin
  5829. result := PgtkDialog(FGtkObject);
  5830. end;
  5831. procedure TFPgtkDialog.CreateGtkObject;
  5832. begin
  5833. FGtkObject := PGtkObject(gtk_dialog_new);
  5834. end;
  5835. function TFPgtkDialog.GetActionArea : TFPgtkHBox;
  5836. begin
  5837. result := GetPascalInstance(PGtkObject(TheGtkObject^.action_area),tfpgtkhbox) as tfpgtkhbox;
  5838. end;
  5839. function TFPgtkDialog.GetVBox : TFPgtkVBox;
  5840. begin
  5841. result := GetPascalInstance(PGtkObject(TheGtkObject^.vbox),tfpgtkvbox) as tfpgtkvbox;
  5842. end;
  5843. constructor TFPgtkDialog.create;
  5844. begin
  5845. inherited create (gtk_window_dialog);
  5846. end;
  5847. { TFPgtkInputDialog }
  5848. function TFPgtkInputDialog.TheGtkObject : PGtkInputDialog;
  5849. begin
  5850. result := PgtkInputDialog(FGtkObject);
  5851. end;
  5852. procedure TFPgtkInputDialog.CreateGtkObject;
  5853. begin
  5854. FGtkObject := PGtkObject(gtk_input_dialog_new);
  5855. end;
  5856. function TFPgtkInputDialog.GetButtonClose : TFPgtkButton;
  5857. begin
  5858. result := GetPascalInstance(PGtkObject(TheGtkObject^.close_button),tfpgtkbutton) as tfpgtkbutton;
  5859. end;
  5860. function TFPgtkInputDialog.GetButtonSave : TFPgtkButton;
  5861. begin
  5862. result := GetPascalInstance(PGtkObject(TheGtkObject^.save_button),tfpgtkbutton) as tfpgtkbutton;
  5863. end;
  5864. procedure DeviceSignalproc (Sender:PGtkinputdialog; DeviceID:integer; Data:pointer); cdecl;
  5865. var p : TFPgtkDeviceSignalFunction;
  5866. begin
  5867. with PSignalData(data)^ do
  5868. begin
  5869. p := TFPgtkDeviceSignalFunction (TheSignalProc);
  5870. p (TheWidget as TFPgtkInputDialog, DeviceID, TheData)
  5871. end;
  5872. end;
  5873. function TFPgtkInputDialog.DeviceSignalConnect (signal:string; proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  5874. begin
  5875. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@DeviceSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  5876. end;
  5877. function TFPgtkInputDialog.DeviceSignalConnectAfter (signal:string; proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  5878. begin
  5879. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@DeviceSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  5880. end;
  5881. function TFPgtkInputDialog.ConnectEnableDevice (proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  5882. begin
  5883. result := DeviceSignalConnect (sgEnableDevice, proc, data);
  5884. end;
  5885. function TFPgtkInputDialog.ConnectAfterEnableDevice (proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  5886. begin
  5887. result := DeviceSignalConnectAfter (sgEnableDevice, proc, data);
  5888. end;
  5889. function TFPgtkInputDialog.ConnectDisableDevice (proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  5890. begin
  5891. result := DeviceSignalConnect (sgDisableDevice, proc, data);
  5892. end;
  5893. function TFPgtkInputDialog.ConnectAfterDisableDevice (proc:TFPgtkDeviceSignalFunction; data:pointer) : guint;
  5894. begin
  5895. result := DeviceSignalConnectAfter (sgDisableDevice, proc, data);
  5896. end;
  5897. { TFPgtkFileSelection }
  5898. function TFPgtkFileSelection.TheGtkObject : PGtkFileSelection;
  5899. begin
  5900. result := PgtkFileSelection(FGtkObject);
  5901. end;
  5902. procedure TFPgtkFileSelection.CreateGtkObject;
  5903. begin
  5904. FGtkObject := PGtkObject(gtk_file_selection_new ('Select a file'));
  5905. end;
  5906. function TFPgtkFileSelection.GetFilename : string;
  5907. begin
  5908. result := gtk_file_selection_get_filename(TheGtkObject);
  5909. end;
  5910. procedure TFPgtkFileSelection.SetFilename (TheValue:string);
  5911. begin
  5912. gtk_file_selection_set_filename(TheGtkObject,Pgchar(TheValue));
  5913. end;
  5914. procedure TFPgtkFileSelection.Complete (Pattern:string);
  5915. begin
  5916. gtk_file_selection_complete (TheGtkObject, ConvertToPgchar(Pattern));
  5917. end;
  5918. procedure TFPgtkFileSelection.ShowFileOpButtons;
  5919. begin
  5920. gtk_file_selection_show_fileop_buttons (TheGtkObject);
  5921. end;
  5922. procedure TFPgtkFileSelection.HideFileOpButtons;
  5923. begin
  5924. gtk_file_selection_hide_fileop_buttons (TheGtkObject);
  5925. end;
  5926. function TFPgtkFileSelection.GetDirList : TFPgtkCList;
  5927. begin
  5928. result := GetPascalInstance(PGtkObject(TheGtkObject^.dir_list),tfpgtkclist) as tfpgtkclist;
  5929. end;
  5930. function TFPgtkFileSelection.GetFileList : TFPgtkCList;
  5931. begin
  5932. result := GetPascalInstance(PGtkObject(TheGtkObject^.file_list),tfpgtkclist) as tfpgtkclist;
  5933. end;
  5934. function TFPgtkFileSelection.GetOkButton : TFPgtkButton;
  5935. begin
  5936. result := GetPascalInstance(PGtkObject(TheGtkObject^.ok_button),tfpgtkbutton) as tfpgtkbutton;
  5937. end;
  5938. function TFPgtkFileSelection.GetCancelButton : TFPgtkButton;
  5939. begin
  5940. result := GetPascalInstance(PGtkObject(TheGtkObject^.cancel_button),tfpgtkbutton) as tfpgtkbutton;
  5941. end;
  5942. function TFPgtkFileSelection.GetHistoryPulldown : TFPgtkOptionMenu;
  5943. begin
  5944. result := GetPascalInstance(PGtkObject(TheGtkObject^.history_pulldown),tfpgtkoptionmenu) as tfpgtkoptionmenu;
  5945. end;
  5946. function TFPgtkFileSelection.GetFileOpDialog : TFPgtkDialog;
  5947. begin
  5948. result := GetPascalInstance(PGtkObject(TheGtkObject^.fileop_dialog),tfpgtkdialog) as tfpgtkdialog;
  5949. end;
  5950. function TFPgtkFileSelection.GetFileOpCreateDir : TFPgtkButton;
  5951. begin
  5952. result := GetPascalInstance(PGtkObject(TheGtkObject^.fileop_c_dir),tfpgtkbutton) as tfpgtkbutton;
  5953. end;
  5954. function TFPgtkFileSelection.GetFileOpDelFile : TFPgtkButton;
  5955. begin
  5956. result := GetPascalInstance(PGtkObject(TheGtkObject^.fileop_del_file),tfpgtkbutton) as tfpgtkbutton;
  5957. end;
  5958. function TFPgtkFileSelection.GetFileOpRenFile : TFPgtkButton;
  5959. begin
  5960. result := GetPascalInstance(PGtkObject(TheGtkObject^.fileop_ren_file),tfpgtkbutton) as tfpgtkbutton;
  5961. end;
  5962. { TFPgtkFontSelectionDialog }
  5963. function TFPgtkFontSelectionDialog.TheGtkObject : PGtkFontSelectionDialog;
  5964. begin
  5965. result := PgtkFontSelectionDialog(FGtkObject);
  5966. end;
  5967. procedure TFPgtkFontSelectionDialog.CreateGtkObject;
  5968. begin
  5969. FGtkObject := PGtkObject(gtk_font_selection_dialog_new (''));
  5970. end;
  5971. function TFPgtkFontSelectionDialog.GetFontSel : TFPgtkFontSelection;
  5972. begin
  5973. result := GetPascalInstance(PGtkObject(TheGtkObject^.fontsel),tfpgtkfontselection) as tfpgtkfontselection;
  5974. end;
  5975. function TFPgtkFontSelectionDialog.GetButtonOk : TFPgtkButton;
  5976. begin
  5977. result := GetPascalInstance(PGtkObject(TheGtkObject^.ok_button),tfpgtkbutton) as tfpgtkbutton;
  5978. end;
  5979. function TFPgtkFontSelectionDialog.GetButtonApply : TFPgtkButton;
  5980. begin
  5981. result := GetPascalInstance(PGtkObject(TheGtkObject^.apply_button),tfpgtkbutton) as tfpgtkbutton;
  5982. end;
  5983. function TFPgtkFontSelectionDialog.GetButtonCancel : TFPgtkButton;
  5984. begin
  5985. result := GetPascalInstance(PGtkObject(TheGtkObject^.cancel_button),tfpgtkbutton) as tfpgtkbutton;
  5986. end;
  5987. { TFPgtkEventBox }
  5988. function TFPgtkEventBox.TheGtkObject : PGtkEventBox;
  5989. begin
  5990. result := PgtkEventBox(FGtkObject);
  5991. end;
  5992. procedure TFPgtkEventBox.CreateGtkObject;
  5993. begin
  5994. FGtkObject := PGtkObject(gtk_event_box_new);
  5995. end;
  5996. { TFPgtkHandleBox }
  5997. function TFPgtkHandleBox.TheGtkObject : PGtkHandleBox;
  5998. begin
  5999. result := PgtkHandleBox(FGtkObject);
  6000. end;
  6001. procedure TFPgtkHandleBox.CreateGtkObject;
  6002. begin
  6003. FGtkObject := PGtkObject(gtk_handle_box_new);
  6004. end;
  6005. function TFPgtkHandleBox.GetShadowType : TGtkShadowtype;
  6006. begin
  6007. result := TheGtkObject^.shadow_type;
  6008. end;
  6009. procedure TFPgtkHandleBox.SetShadowType (TheValue:TGtkShadowtype);
  6010. begin
  6011. gtk_handle_box_set_shadow_type(TheGtkObject,TheValue);
  6012. end;
  6013. function TFPgtkHandleBox.GetHandlePosition : TGtkPositionType;
  6014. begin
  6015. result := TGtkPositionType (gtk.handle_position(TheGtkObject^));
  6016. end;
  6017. procedure TFPgtkHandleBox.SetHandlePosition (TheValue:TGtkPositionType);
  6018. begin
  6019. gtk_handle_box_set_handle_position(TheGtkObject,TheValue);
  6020. end;
  6021. function TFPgtkHandleBox.GetSnapEdge : TGtkPositionType;
  6022. begin
  6023. result := TGtkPositionType (gtk.snap_edge(TheGtkObject^));
  6024. end;
  6025. procedure TFPgtkHandleBox.SetSnapEdge (TheValue:TGtkPositionType);
  6026. begin
  6027. gtk_handle_box_set_snap_edge(TheGtkObject,TheValue);
  6028. end;
  6029. function TFPgtkHandleBox.GetChildDetached : boolean;
  6030. begin
  6031. result := boolean(gtk.child_detached(TheGtkObject^));
  6032. end;
  6033. function TFPgtkHandleBox.ConnectChildAttached (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  6034. begin
  6035. result := WidgetSignalConnect (sgChildAttached, proc, data);
  6036. end;
  6037. function TFPgtkHandleBox.ConnectAfterChildAttached (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  6038. begin
  6039. result := WidgetSignalConnectAfter (sgChildAttached, proc, data);
  6040. end;
  6041. function TFPgtkHandleBox.ConnectChildDetached (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  6042. begin
  6043. result := WidgetSignalConnect (sgChildDetached, proc, data);
  6044. end;
  6045. function TFPgtkHandleBox.ConnectAfterChildDetached (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  6046. begin
  6047. result := WidgetSignalConnectAfter (sgChildDetached, proc, data);
  6048. end;
  6049. { TFPgtkScrolledWindow }
  6050. function TFPgtkScrolledWindow.TheGtkObject : PGtkScrolledWindow;
  6051. begin
  6052. result := PgtkScrolledWindow(FGtkObject);
  6053. end;
  6054. procedure TFPgtkScrolledWindow.CreateGtkObject;
  6055. var h, v : PgtkAdjustment;
  6056. begin
  6057. if assigned (FHScroll) then
  6058. h := PGtkAdjustment(ConvertToGtkObject(FHScroll))
  6059. else
  6060. h := null;
  6061. if assigned (FVScroll) then
  6062. v := PGtkAdjustment(ConvertToGtkObject(FVScroll))
  6063. else
  6064. v := null;
  6065. FGtkObject := PGtkObject (gtk_scrolled_window_new (h, v));
  6066. end;
  6067. constructor TFPgtkScrolledWindow.Create (hadj:TFPgtkAdjustment; vadj:TFPgtkAdjustment);
  6068. begin
  6069. FVScroll := vadj;
  6070. FHScroll := hadj;
  6071. inherited create;
  6072. setusize (200,170);
  6073. end;
  6074. function TFPgtkScrolledWindow.GetHPolicy : TGtkPolicyType;
  6075. begin
  6076. result := gtk.hscrollbar_policy(TheGtkObject^);
  6077. end;
  6078. procedure TFPgtkScrolledWindow.SetHPolicy (TheValue:TGtkPolicyType);
  6079. begin
  6080. gtk_scrolled_window_set_policy (TheGtkObject, TheValue, VPolicy);
  6081. end;
  6082. function TFPgtkScrolledWindow.GetVPolicy : TGtkPolicyType;
  6083. begin
  6084. result := gtk.vscrollbar_policy(TheGtkObject^);
  6085. end;
  6086. procedure TFPgtkScrolledWindow.SetVPolicy (TheValue:TGtkPolicyType);
  6087. begin
  6088. gtk_scrolled_window_set_policy (TheGtkObject, HPolicy, TheValue);
  6089. end;
  6090. procedure TFPgtkScrolledWindow.SetPolicy (aHScrollBar:TGtkPolicyType; aVScrollbar:TGtkPolicyType); Overload;
  6091. begin
  6092. gtk_scrolled_window_set_policy (TheGtkObject, aHScrollBar, aVScrollbar);
  6093. end;
  6094. procedure TFPgtkScrolledWindow.SetPolicy (aPolicy:TGtkPolicyType); Overload;
  6095. begin
  6096. SetPolicy (aPolicy, aPolicy);
  6097. end;
  6098. function TFPgtkScrolledWindow.GetHAdjustment : TFPgtkAdjustment;
  6099. begin
  6100. result := GetPascalInstance(PGtkObject(gtk_scrolled_window_get_hadjustment(TheGtkObject)),tfpgtkadjustment) as tfpgtkadjustment;
  6101. end;
  6102. procedure TFPgtkScrolledWindow.SetHAdjustment (TheValue:TFPgtkAdjustment);
  6103. begin
  6104. gtk_scrolled_window_set_hadjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  6105. end;
  6106. function TFPgtkScrolledWindow.GetVAdjustment : TFPgtkAdjustment;
  6107. begin
  6108. result := GetPascalInstance(PGtkObject(gtk_scrolled_window_get_vadjustment(TheGtkObject)),tfpgtkadjustment) as tfpgtkadjustment;
  6109. end;
  6110. procedure TFPgtkScrolledWindow.SetVAdjustment (TheValue:TFPgtkAdjustment);
  6111. begin
  6112. gtk_scrolled_window_set_vadjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  6113. end;
  6114. procedure TFPgtkScrolledWindow.AddWithViewport (aChild:TFPgtkWidget);
  6115. begin
  6116. gtk_scrolled_window_add_with_viewport (TheGtkObject, ConvertToGtkWidget(aChild));
  6117. TFPgtkViewport.createFromObject (PGtkObject(PGtkBin(TheGtkObject)^.child));
  6118. aChild.Show;
  6119. end;
  6120. function TFPgtkScrolledWindow.GetPlacement : TGtkCornerType;
  6121. begin
  6122. result := gtk.window_placement(TheGtkObject^);
  6123. end;
  6124. procedure TFPgtkScrolledWindow.SetPlacement (TheValue:TGtkCornerType);
  6125. begin
  6126. gtk_scrolled_window_set_placement(TheGtkObject,TheValue);
  6127. end;
  6128. function TFPgtkScrolledWindow.GetHScrollbar : TFPgtkScrollbar;
  6129. var w : TFPgtkObject;
  6130. gtkwidg : PGtkObject;
  6131. begin
  6132. gtkwidg := PGtkObject(TheGtkObject^.hscrollbar);
  6133. w := GetPascalInstance (gtkwidg);
  6134. if assigned (w) then
  6135. result := (w as TFPgtkScrollbar)
  6136. else
  6137. result := TFPgtkHScrollbar.CreateFromObject (gtkwidg);
  6138. end;
  6139. function TFPgtkScrolledWindow.GetVScrollbar : TFPgtkScrollbar;
  6140. var w : TFPgtkObject;
  6141. gtkwidg : PGtkObject;
  6142. begin
  6143. gtkwidg := PGtkObject(TheGtkObject^.vscrollbar);
  6144. w := GetPascalInstance (gtkwidg);
  6145. if assigned (w) then
  6146. result := (w as TFPgtkScrollbar)
  6147. else
  6148. result := TFPgtkVScrollbar.CreateFromObject (gtkwidg);
  6149. end;
  6150. procedure TFPgtkScrolledWindow.UpdatePolicy (UpdPolicy:TGtkUpdateType);
  6151. var sb : TFpgtkScrollbar;
  6152. begin
  6153. sb := HScrollbar;
  6154. if assigned(sb) then
  6155. sb.UpdatePolicy := UpdPolicy;
  6156. sb := VScrollbar;
  6157. if assigned(sb) then
  6158. sb.UpdatePolicy := UpdPolicy;
  6159. end;
  6160. { TFPgtkViewport }
  6161. function TFPgtkViewport.TheGtkObject : PGtkViewport;
  6162. begin
  6163. result := PgtkViewport(FGtkObject);
  6164. end;
  6165. procedure TFPgtkViewport.CreateGtkObject;
  6166. var h, v : PgtkAdjustment;
  6167. begin
  6168. if assigned (FHScroll) then
  6169. h := PGtkAdjustment(ConvertToGtkObject(FHScroll))
  6170. else
  6171. h := null;
  6172. if assigned (FVScroll) then
  6173. v := PGtkAdjustment(ConvertToGtkObject(FVScroll))
  6174. else
  6175. v := null;
  6176. FGtkObject := PGtkObject (gtk_scrolled_window_new (h, v));
  6177. end;
  6178. constructor TFPgtkViewport.Create (hadj:TFPgtkAdjustment; vadj:TFPgtkAdjustment);
  6179. begin
  6180. FVScroll := vadj;
  6181. FHScroll := hadj;
  6182. inherited create;
  6183. end;
  6184. function TFPgtkViewport.GetHAdjustment : TFPgtkAdjustment;
  6185. begin
  6186. result := GetPascalInstance(PGtkObject(gtk_viewport_get_hadjustment(TheGtkObject)),tfpgtkadjustment) as tfpgtkadjustment;
  6187. end;
  6188. procedure TFPgtkViewport.SetHAdjustment (TheValue:TFPgtkAdjustment);
  6189. begin
  6190. gtk_viewport_set_hadjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  6191. end;
  6192. function TFPgtkViewport.GetVAdjustment : TFPgtkAdjustment;
  6193. begin
  6194. result := GetPascalInstance(PGtkObject(gtk_viewport_get_vadjustment(TheGtkObject)),tfpgtkadjustment) as tfpgtkadjustment;
  6195. end;
  6196. procedure TFPgtkViewport.SetVAdjustment (TheValue:TFPgtkAdjustment);
  6197. begin
  6198. gtk_viewport_set_vadjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  6199. end;
  6200. function TFPgtkViewport.GetShadowType : TgtkShadowType;
  6201. begin
  6202. result := TheGtkObject^.shadow_type;
  6203. end;
  6204. procedure TFPgtkViewport.SetShadowType (TheValue:TgtkShadowType);
  6205. begin
  6206. gtk_viewport_set_shadow_type(TheGtkObject,TheValue);
  6207. end;
  6208. { TFPgtkBox }
  6209. function TFPgtkBox.TheGtkObject : PGtkBox;
  6210. begin
  6211. result := PgtkBox(FGtkObject);
  6212. end;
  6213. function TFPgtkBox.GetHomogeneous : boolean;
  6214. begin
  6215. result := boolean(gtk.homogeneous(TheGtkObject^));
  6216. end;
  6217. procedure TFPgtkBox.SetHomogeneous (TheValue:boolean);
  6218. begin
  6219. gtk_Box_set_homogeneous(TheGtkObject,TheValue);
  6220. end;
  6221. function TFPgtkBox.GetSpacing : integer;
  6222. begin
  6223. result := TheGtkObject^.spacing;
  6224. end;
  6225. procedure TFPgtkBox.SetSpacing (TheValue:integer);
  6226. begin
  6227. gtk_Box_set_spacing(TheGtkObject,TheValue);
  6228. end;
  6229. procedure TFPgtkBox.ReorderChild (Widget:TFPgtkWidget; Position:integer);
  6230. begin
  6231. gtk_Box_reorder_child (TheGtkObject, PGtkwidget(ConvertToGtkObject(Widget)), Position);
  6232. end;
  6233. procedure TFPgtkBox.GetChildPacking (Widget:TFPgtkWidget; var Expand:boolean; var Fill:boolean; var Padding:integer; var PackType:TGtkPackType);
  6234. var PT : PGtkPackType;
  6235. begin
  6236. pt := @PackType;
  6237. gtk_box_query_child_packing (TheGtkObject, ConvertToGtkWidget(Widget),
  6238. pgboolean(@expand), pgboolean(@fill), pguint(@padding), pt);
  6239. end;
  6240. procedure TFPgtkBox.SetChildPacking (Widget:TFPgtkWidget; Expand:boolean; Fill:boolean; Padding:integer; PackType:TGtkPackType);
  6241. begin
  6242. gtk_Box_set_child_packing (TheGtkObject, PGtkwidget(ConvertToGtkObject(Widget)), Expand, Fill, Padding, PackType);
  6243. end;
  6244. procedure TFPgtkBox.PackStart (Widget:TFPgtkWidget); Overload;
  6245. begin
  6246. gtk_box_pack_start_defaults (TheGtkObject, ConvertToGtkWidget(Widget));
  6247. widget.Show;
  6248. end;
  6249. procedure TFPgtkBox.PackStart (Widget:TFPgtkWidget; IsVisible:boolean); Overload;
  6250. begin
  6251. gtk_box_pack_start_defaults (TheGtkObject, ConvertToGtkWidget(Widget));
  6252. if isvisible then
  6253. widget.Show;
  6254. end;
  6255. procedure TFPgtkBox.PackStart (Widget:TFPgtkWidget; expand:boolean; fill:boolean; padding:integer); Overload;
  6256. begin
  6257. gtk_box_pack_start (TheGtkObject, ConvertToGtkWidget(Widget), expand, fill, padding);
  6258. widget.Show;
  6259. end;
  6260. procedure TFPgtkBox.PackStart (Widget:TFPgtkWidget; expand:boolean; fill:boolean; padding:integer; IsVisible:boolean); Overload;
  6261. begin
  6262. gtk_box_pack_start (TheGtkObject, ConvertToGtkWidget(Widget), expand, fill, padding);
  6263. if isvisible then
  6264. widget.Show;
  6265. end;
  6266. procedure TFPgtkBox.PackEnd (Widget:TFPgtkWidget); Overload;
  6267. begin
  6268. gtk_box_pack_end_defaults (TheGtkObject, ConvertToGtkWidget(Widget));
  6269. widget.Show;
  6270. end;
  6271. procedure TFPgtkBox.PackEnd (Widget:TFPgtkWidget; IsVisible:boolean); Overload;
  6272. begin
  6273. gtk_box_pack_end_defaults (TheGtkObject, ConvertToGtkWidget(Widget));
  6274. if isvisible then
  6275. widget.Show;
  6276. end;
  6277. procedure TFPgtkBox.PackEnd (Widget:TFPgtkWidget; expand:boolean; fill:boolean; padding:integer); Overload;
  6278. begin
  6279. gtk_box_pack_end (TheGtkObject, ConvertToGtkWidget(Widget), expand, fill, padding);
  6280. widget.Show;
  6281. end;
  6282. procedure TFPgtkBox.PackEnd (Widget:TFPgtkWidget; expand:boolean; fill:boolean; padding:integer; IsVisible:boolean); Overload;
  6283. begin
  6284. gtk_box_pack_end (TheGtkObject, ConvertToGtkWidget(Widget), expand, fill, padding);
  6285. if isvisible then
  6286. widget.Show;
  6287. end;
  6288. { TFPgtkButtonBox }
  6289. function TFPgtkButtonBox.TheGtkObject : PGtkButtonBox;
  6290. begin
  6291. result := PgtkButtonBox(FGtkObject);
  6292. end;
  6293. procedure SetButtonBoxDefaultSize (aMinWidth:integer; aMinHeight:integer);
  6294. begin
  6295. gtk_button_box_set_child_size_default (aMinWidth, aMinheight);
  6296. end;
  6297. procedure GetButtonBoxDefaultSize (var aMinWidth:integer; var aMinHeight:integer);
  6298. begin
  6299. gtk_button_box_get_child_size_default (@aMinWidth, @aMinheight);
  6300. end;
  6301. procedure SetButtonBoxDefaultPadding (aIPadX:integer; aIPadY:integer);
  6302. begin
  6303. gtk_button_box_set_child_size_default (aIPadX, aIPadY);
  6304. end;
  6305. procedure GetButtonBoxDefaultPadding (var aIPadX:integer; var aIPadY:integer);
  6306. begin
  6307. gtk_button_box_get_child_size_default (@aIPadX, @aIPadY);
  6308. end;
  6309. function TFPgtkButtonBox.GetSpacing : integer;
  6310. begin
  6311. result := gtk_button_box_get_spacing(TheGtkObject);
  6312. end;
  6313. procedure TFPgtkButtonBox.SetSpacing (TheValue:integer);
  6314. begin
  6315. gtk_button_box_set_spacing(TheGtkObject,TheValue);
  6316. end;
  6317. function TFPgtkButtonBox.GetLayout : TGtkButtonBoxStyle;
  6318. begin
  6319. result := gtk_button_box_get_layout(TheGtkObject);
  6320. end;
  6321. procedure TFPgtkButtonBox.SetLayout (TheValue:TGtkButtonBoxStyle);
  6322. begin
  6323. gtk_button_box_set_layout(TheGtkObject,TheValue);
  6324. end;
  6325. function TFPgtkButtonBox.GetMinWidth : integer;
  6326. var x, y : integer;
  6327. begin
  6328. gtk_button_box_get_child_size (TheGtkObject, @x, @y);
  6329. result := x;
  6330. end;
  6331. procedure TFPgtkButtonBox.SetMinWidth (TheValue:integer);
  6332. begin
  6333. gtk_button_box_set_child_size (TheGtkObject, TheValue, ChildMinHeight);
  6334. end;
  6335. function TFPgtkButtonBox.GetMinHeight : integer;
  6336. var x, y : integer;
  6337. begin
  6338. gtk_button_box_get_child_size (TheGtkObject, @x, @y);
  6339. result := y;
  6340. end;
  6341. procedure TFPgtkButtonBox.SetMinHeight (TheValue:integer);
  6342. begin
  6343. gtk_button_box_set_child_size (TheGtkObject, ChildMinWidth, TheValue);
  6344. end;
  6345. function TFPgtkButtonBox.GetChildPadX : integer;
  6346. var x, y : integer;
  6347. begin
  6348. gtk_button_box_get_child_ipadding (TheGtkObject, @x, @y);
  6349. result := x;
  6350. end;
  6351. procedure TFPgtkButtonBox.SetChildPadX (TheValue:integer);
  6352. begin
  6353. gtk_button_box_set_child_ipadding (TheGtkObject, TheValue, ChildPadY);
  6354. end;
  6355. function TFPgtkButtonBox.GetChildPadY : integer;
  6356. var x, y : integer;
  6357. begin
  6358. gtk_button_box_get_child_ipadding (TheGtkObject, @x, @y);
  6359. result := y;
  6360. end;
  6361. procedure TFPgtkButtonBox.SetChildPadY (TheValue:integer);
  6362. begin
  6363. gtk_button_box_set_child_ipadding (TheGtkObject, ChildPadX, TheValue);
  6364. end;
  6365. { TFPgtkHButtonBox }
  6366. function TFPgtkHButtonBox.TheGtkObject : PGtkHButtonBox;
  6367. begin
  6368. result := PgtkHButtonBox(FGtkObject);
  6369. end;
  6370. procedure TFPgtkHButtonBox.CreateGtkObject;
  6371. begin
  6372. FGtkObject := PGtkObject(gtk_hbutton_box_new);
  6373. end;
  6374. { TFPgtkVButtonBox }
  6375. function TFPgtkVButtonBox.TheGtkObject : PGtkVButtonBox;
  6376. begin
  6377. result := PgtkVButtonBox(FGtkObject);
  6378. end;
  6379. procedure TFPgtkVButtonBox.CreateGtkObject;
  6380. begin
  6381. FGtkObject := PGtkObject(gtk_vbutton_box_new);
  6382. end;
  6383. { TFPgtkVBox }
  6384. function TFPgtkVBox.TheGtkObject : PGtkVBox;
  6385. begin
  6386. result := PgtkVBox(FGtkObject);
  6387. end;
  6388. procedure TFPgtkVBox.CreateGtkObject;
  6389. begin
  6390. FGtkObject := PGtkObject(gtk_VBox_new (False, 1));
  6391. end;
  6392. { TFPgtkColorSelection }
  6393. function TFPgtkColorSelection.TheGtkObject : PGtkColorSelection;
  6394. begin
  6395. result := PgtkColorSelection(FGtkObject);
  6396. end;
  6397. procedure TFPgtkColorSelection.CreateGtkObject;
  6398. begin
  6399. FGtkObject := PGtkObject(gtk_color_selection_new);
  6400. end;
  6401. function TFPgtkColorSelection.GetUpdatePolicy : TGtkUpdateType;
  6402. begin
  6403. result := TheGtkObject^.policy;
  6404. end;
  6405. procedure TFPgtkColorSelection.SetUpdatePolicy (TheValue:TGtkUpdateType);
  6406. begin
  6407. gtk_color_selection_set_update_policy(TheGtkObject,TheValue);
  6408. end;
  6409. function TFPgtkColorSelection.GetColor : double;
  6410. var c : double;
  6411. begin
  6412. gtk_color_selection_get_color (TheGtkObject, @c);
  6413. result := c;
  6414. end;
  6415. procedure TFPgtkColorSelection.SetColor (TheValue:double);
  6416. begin
  6417. gtk_color_selection_set_color (TheGtkObject, @TheValue);
  6418. end;
  6419. function TFPgtkColorSelection.GetUseOpacity : longbool;
  6420. begin
  6421. result := longbool(TheGtkObject^.use_opacity);
  6422. end;
  6423. procedure TFPgtkColorSelection.SetUseOpacity (TheValue:longbool);
  6424. begin
  6425. gtk_color_selection_set_opacity(TheGtkObject,gint(TheValue));
  6426. end;
  6427. { TFPgtkGammaCurve }
  6428. function TFPgtkGammaCurve.TheGtkObject : PGtkGammaCurve;
  6429. begin
  6430. result := PgtkGammaCurve(FGtkObject);
  6431. end;
  6432. procedure TFPgtkGammaCurve.CreateGtkObject;
  6433. begin
  6434. FGtkObject := PGtkObject(gtk_gamma_curve_new);
  6435. end;
  6436. { TFPgtkHBox }
  6437. function TFPgtkHBox.TheGtkObject : PGtkHBox;
  6438. begin
  6439. result := PgtkHBox(FGtkObject);
  6440. end;
  6441. procedure TFPgtkHBox.CreateGtkObject;
  6442. begin
  6443. FGtkObject := PGtkObject(gtk_HBox_new (False, 1));
  6444. end;
  6445. { TFPgtkCombo }
  6446. function TFPgtkCombo.TheGtkObject : PGtkCombo;
  6447. begin
  6448. result := PgtkCombo(FGtkObject);
  6449. end;
  6450. procedure TFPgtkCombo.CreateGtkObject;
  6451. begin
  6452. FGtkObject := PGtkObject(gtk_combo_new);
  6453. end;
  6454. function TFPgtkCombo.GetEntry : TFPgtkEntry;
  6455. begin
  6456. result := GetPascalInstance(PGtkObject(TheGtkObject^.entry), TFPgtkEntry) as tfpgtkentry;
  6457. end;
  6458. function TFPgtkCombo.GetList : TFPgtkList;
  6459. begin
  6460. result := GetPascalInstance(PGtkObject(TheGtkObject^.list), TFPgtkList) as TFPgtkList;
  6461. end;
  6462. function TFPgtkCombo.GetButton : TFpGtkButton;
  6463. begin
  6464. result := GetPascalInstance(PGtkObject(TheGtkObject^.button), TFPgtkButton) as TFPgtkButton;
  6465. end;
  6466. function TFPgtkCombo.GetValueInList : longbool;
  6467. begin
  6468. result := longbool(gtk.value_in_list(TheGtkObject^));
  6469. end;
  6470. procedure TFPgtkCombo.SetValueInListProp (TheValue:longbool);
  6471. begin
  6472. gtk_combo_set_value_in_list (TheGtkObject, gint(TheValue), gint(OkIfEmpty));
  6473. end;
  6474. function TFPgtkCombo.GetOkIfEmpty : longbool;
  6475. begin
  6476. result := longbool(gtk.ok_if_empty(TheGtkObject^));
  6477. end;
  6478. procedure TFPgtkCombo.SetOkIfEmpty (TheValue:longbool);
  6479. begin
  6480. gtk_combo_set_value_in_list (TheGtkObject, gint(ValueInList), gint(TheValue));
  6481. end;
  6482. function TFPgtkCombo.GetUseArrows : longbool;
  6483. begin
  6484. result := longbool(gtk.use_arrows(TheGtkObject^));
  6485. end;
  6486. procedure TFPgtkCombo.SetUseArrows (TheValue:longbool);
  6487. begin
  6488. gtk_combo_set_use_arrows(TheGtkObject,gint(TheValue));
  6489. end;
  6490. function TFPgtkCombo.GetUseArrowsAlways : longbool;
  6491. begin
  6492. result := longbool(gtk.use_arrows_always(TheGtkObject^));
  6493. end;
  6494. procedure TFPgtkCombo.SetUseArrowsAlways (TheValue:longbool);
  6495. begin
  6496. gtk_combo_set_use_arrows_always(TheGtkObject,gint(TheValue));
  6497. end;
  6498. function TFPgtkCombo.GetCaseSensitive : longbool;
  6499. begin
  6500. result := longbool(gtk.case_sensitive(TheGtkObject^));
  6501. end;
  6502. procedure TFPgtkCombo.SetCaseSensitive (TheValue:longbool);
  6503. begin
  6504. gtk_combo_set_case_sensitive(TheGtkObject,gint(TheValue));
  6505. end;
  6506. procedure TFPgtkCombo.SetItemString (Item:TFPgtkItem; ItemValue:string);
  6507. begin
  6508. gtk_combo_set_item_string (TheGtkObject, PGtkitem(ConvertToGtkObject(Item)), ConvertToPgchar(ItemValue));
  6509. end;
  6510. procedure TFPgtkCombo.DisableActivate;
  6511. begin
  6512. gtk_combo_disable_activate (TheGtkObject);
  6513. end;
  6514. procedure TFPgtkCombo.SetValueInList (Val:longbool; IsOkIfEmpty:longbool);
  6515. begin
  6516. gtk_combo_set_value_in_list (TheGtkObject, gint(Val), gint(IsOkIfEmpty));
  6517. end;
  6518. { TFPgtkStatusbar }
  6519. function TFPgtkStatusbar.TheGtkObject : PGtkStatusbar;
  6520. begin
  6521. result := PgtkStatusbar(FGtkObject);
  6522. end;
  6523. procedure TFPgtkStatusbar.CreateGtkObject;
  6524. begin
  6525. FGtkObject := PGtkObject(gtk_statusbar_new);
  6526. end;
  6527. function TFPgtkStatusbar.GetContextID (ContextDescr:string) : integer;
  6528. begin
  6529. result := gtk_statusbar_get_context_id (TheGtkObject, ConvertToPgchar(ContextDescr));
  6530. end;
  6531. function TFPgtkStatusbar.Push (contextID:integer; text:string) : integer;
  6532. begin
  6533. result := gtk_statusbar_push (TheGtkObject, contextID, ConvertToPgchar(text));
  6534. end;
  6535. procedure TFPgtkStatusbar.Pop (contextID:integer);
  6536. begin
  6537. gtk_statusbar_pop (TheGtkObject, contextID);
  6538. end;
  6539. procedure TFPgtkStatusbar.Remove (contextID:integer; MessageID:integer);
  6540. begin
  6541. gtk_statusbar_remove (TheGtkObject, contextID, MessageID);
  6542. end;
  6543. procedure StatusbarSignalproc (Sender:PGtkobject; contextID:integer; text:pgChar; data:pointer); cdecl;
  6544. var p : TFPgtkStatusbarSignalFunction;
  6545. begin
  6546. with PSignalData(data)^ do
  6547. begin
  6548. p := TFPgtkStatusbarSignalFunction (TheSignalProc);
  6549. p (TheWidget as TFPgtkObject, contextID, text, TheData)
  6550. end;
  6551. end;
  6552. function TFPgtkStatusbar.StatusbarSignalConnect (signal:string; proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  6553. begin
  6554. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@StatusbarSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  6555. end;
  6556. function TFPgtkStatusbar.StatusbarSignalConnectAfter (signal:string; proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  6557. begin
  6558. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@StatusbarSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  6559. end;
  6560. function TFPgtkStatusbar.ConnectTextPopped (proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  6561. begin
  6562. result := StatusbarSignalConnect (sgTextPopped, proc, data);
  6563. end;
  6564. function TFPgtkStatusbar.ConnectAfterTextPopped (proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  6565. begin
  6566. result := StatusbarSignalConnectAfter (sgTextPopped, proc, data);
  6567. end;
  6568. function TFPgtkStatusbar.ConnectTextPushed (proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  6569. begin
  6570. result := StatusbarSignalConnect (sgTextPushed, proc, data);
  6571. end;
  6572. function TFPgtkStatusbar.ConnectAfterTextPushed (proc:TFPgtkStatusbarSignalFunction; data:pointer) : guint;
  6573. begin
  6574. result := StatusbarSignalConnectAfter (sgTextPushed, proc, data);
  6575. end;
  6576. { TFPgtkCList }
  6577. function TFPgtkCList.TheGtkObject : PGtkCList;
  6578. begin
  6579. result := PgtkCList(FGtkObject);
  6580. end;
  6581. procedure TFPgtkCList.CreateGtkObject;
  6582. begin
  6583. FGtkObject := PGtkObject(gtk_clist_new (FColumnCount));
  6584. end;
  6585. constructor TFPgtkCList.Create (aColumnCount:integer);
  6586. begin
  6587. FColumnCount := aColumnCount;
  6588. inherited create;
  6589. end;
  6590. function TFPgtkCList.GetShadowType : TGtkShadowType;
  6591. begin
  6592. result := TheGtkObject^.shadow_type;
  6593. end;
  6594. procedure TFPgtkCList.SetShadowType (TheValue:TGtkShadowType);
  6595. begin
  6596. gtk_clist_set_shadow_type(TheGtkObject,TheValue);
  6597. end;
  6598. function TFPgtkCList.GetSelectionMode : TGtkSelectionMode;
  6599. begin
  6600. result := TheGtkObject^.selection_mode;
  6601. end;
  6602. procedure TFPgtkCList.SetSelectionMode (TheValue:TGtkSelectionMode);
  6603. begin
  6604. gtk_clist_set_selection_mode(TheGtkObject,TheValue);
  6605. end;
  6606. procedure TFPgtkCList.Freeze;
  6607. begin
  6608. gtk_clist_freeze (TheGtkObject);
  6609. end;
  6610. procedure TFPgtkCList.Thaw;
  6611. begin
  6612. gtk_clist_thaw (TheGtkObject);
  6613. end;
  6614. procedure TFPgtkCList.ShowTitles;
  6615. begin
  6616. gtk_clist_Column_titles_show (TheGtkObject);
  6617. end;
  6618. procedure TFPgtkCList.HideTitles;
  6619. begin
  6620. gtk_clist_column_titles_hide (TheGtkObject);
  6621. end;
  6622. procedure TFPgtkCList.ActiveTitles;
  6623. begin
  6624. gtk_clist_column_titles_active (TheGtkObject);
  6625. end;
  6626. procedure TFPgtkCList.PassiveTitles;
  6627. begin
  6628. gtk_clist_column_titles_passive (TheGtkObject);
  6629. end;
  6630. procedure TFPgtkCList.ActiveTitle (column:integer);
  6631. begin
  6632. gtk_clist_column_title_active (TheGtkObject, column);
  6633. end;
  6634. procedure TFPgtkCList.PassiveTitle (column:integer);
  6635. begin
  6636. gtk_clist_column_title_passive (TheGtkObject, column);
  6637. end;
  6638. function TFPgtkCList.GetColumnTitle (column:integer) : string;
  6639. begin
  6640. result := gtk_clist_get_column_title(TheGtkObject,column);
  6641. end;
  6642. procedure TFPgtkCList.SetColumnTitle (column:integer; TheValue:string);
  6643. begin
  6644. gtk_clist_set_column_title(TheGtkObject,column,ConvertToPgchar(TheValue));
  6645. end;
  6646. function TFPgtkCList.GetColumnWidget (column:integer) : TFPgtkWidget;
  6647. begin
  6648. result := GetPascalInstance(PGtkObject(gtk_clist_get_column_widget(TheGtkObject,column)),tfpgtkwidget) as tfpgtkwidget;
  6649. end;
  6650. procedure TFPgtkCList.SetColumnWidget (column:integer; TheValue:TFPgtkWidget);
  6651. begin
  6652. gtk_clist_set_column_widget(TheGtkObject,column,PGtkwidget(ConvertToGtkObject(TheValue)));
  6653. end;
  6654. procedure TFPgtkCList.SetColumnJustification (column:integer; justification:TGtkJustification);
  6655. begin
  6656. gtk_clist_set_column_justification (TheGtkObject, column, justification);
  6657. end;
  6658. procedure TFPgtkCList.SetColumnVisibility (column:integer; aVisible:boolean);
  6659. begin
  6660. gtk_clist_set_column_visibility (TheGtkObject, column, aVisible);
  6661. end;
  6662. procedure TFPgtkCList.SetColumnResizeable (column:integer; Resizeable:boolean);
  6663. begin
  6664. gtk_clist_set_column_resizeable (TheGtkObject, column, Resizeable);
  6665. end;
  6666. procedure TFPgtkCList.SetColumnAutoResize (column:integer; autoResize:boolean);
  6667. begin
  6668. gtk_clist_set_column_auto_resize (TheGtkObject, column, autoResize);
  6669. end;
  6670. function TFPgtkCList.OptimalColumnWidth (column:integer) : integer;
  6671. begin
  6672. result := gtk_clist_optimal_column_width (TheGtkObject, column);
  6673. end;
  6674. procedure TFPgtkCList.SetColumnWidth (column:integer; width:integer);
  6675. begin
  6676. gtk_clist_set_column_width (TheGtkObject, column, width);
  6677. end;
  6678. procedure TFPgtkCList.SetColumnMinWidth (column:integer; MinWidth:integer);
  6679. begin
  6680. gtk_clist_set_column_min_width (TheGtkObject, column, MinWidth);
  6681. end;
  6682. procedure TFPgtkCList.SetColumnMaxWidth (column:integer; MaxWidth:integer);
  6683. begin
  6684. gtk_clist_set_column_max_width (TheGtkObject, column, MaxWidth);
  6685. end;
  6686. function TFPgtkCList.AutoSizeColumns : integer;
  6687. begin
  6688. result := gtk_clist_columns_autosize (TheGtkObject);
  6689. end;
  6690. procedure TFPgtkCList.ConfigureColumnWidth (column:integer; Width:integer; MinWidth:integer; MaxWidth:integer);
  6691. begin
  6692. SetColumnWidth (column, Width);
  6693. SetColumnMaxWidth (column, MaxWidth);
  6694. SetColumnMinWidth (column, MinWidth);
  6695. end;
  6696. procedure TFPgtkCList.ConfigureColumn (column:integer; Justification:TGtkJustification; Visibility:boolean; Resizeable:boolean; AutoSize:boolean);
  6697. begin
  6698. SetColumnJustification (column, Justification);
  6699. SetColumnVisibility (column, Visibility);
  6700. SetColumnResizeable (column, Resizeable);
  6701. SetColumnAutoResize (column, AutoSize);
  6702. end;
  6703. procedure TFPgtkCList.SetRowHeight (height:integer);
  6704. begin
  6705. gtk_clist_set_row_height (TheGtkObject, height);
  6706. end;
  6707. procedure TFPgtkCList.MoveTo (row:integer; column:integer; RowAlign:gfloat; ColAlign:gfloat);
  6708. begin
  6709. gtk_clist_moveto (TheGtkObject, row, column, RowAlign, ColAlign);
  6710. end;
  6711. function TFPgtkCList.RowIsVisible (Row:integer) : TGtkVisibility;
  6712. begin
  6713. result := gtk_clist_row_is_visible (TheGtkObject, Row);
  6714. end;
  6715. function TFPgtkCList.GetCellType (Row:integer; column:integer) : TGtkCellType;
  6716. begin
  6717. result := gtk_clist_get_cell_type (TheGtkObject, Row, column);
  6718. end;
  6719. function TFPgtkCList.GetCellText (Row:integer; Column:integer) : string;
  6720. var s : pgchar;
  6721. r : integer;
  6722. begin
  6723. r := gtk_clist_get_text (TheGtkObject, row, column, @s);
  6724. if (r = 0) then
  6725. result := ''
  6726. else
  6727. result := strpas(s);
  6728. end;
  6729. procedure TFPgtkCList.SetCellText (Row:integer; Column:integer; TheValue:string);
  6730. begin
  6731. gtk_clist_set_text(TheGtkObject,Row, Column,ConvertToPgchar(TheValue));
  6732. end;
  6733. procedure TFPgtkCList.SetPixmap (row:integer; column:integer; pixmap:PGdkPixmap; mask:PGdkBitmap);
  6734. begin
  6735. gtk_clist_set_pixmap (TheGtkObject, row, column, pixmap, mask);
  6736. end;
  6737. procedure TFPgtkCList.GetPixmap (row:integer; column:integer; var pixmap:PGdkPixmap; var mask:PGdkBitmap);
  6738. begin
  6739. gtk_clist_get_pixmap (TheGtkObject, row, column, @pixmap, @mask);
  6740. end;
  6741. procedure TFPgtkCList.SetPixText (row:integer; column:integer; text:string; spacing:guint8; pixmap:PGdkPixmap; mask:PGdkBitmap);
  6742. begin
  6743. gtk_clist_set_pixtext (TheGtkObject, row, column, ConvertToPgchar(text), spacing, pixmap, mask);
  6744. end;
  6745. procedure TFPgtkCList.GetPixText (row:integer; column:integer; var text:string; var aspacing:guint8; var pixmap:PGdkPixmap; var mask:PGdkBitmap);
  6746. var r : integer;
  6747. s : PPgchar;
  6748. begin
  6749. s := nil;
  6750. r := gtk_clist_get_pixtext (TheGtkObject, row, column, s, @aspacing, @pixmap, @mask);
  6751. if r = 0 then
  6752. begin
  6753. text := '';
  6754. pixmap := nil;
  6755. mask := nil;
  6756. end
  6757. else
  6758. text := string (s^);
  6759. end;
  6760. procedure TFPgtkCList.SetForeground (row:integer; color:PGdkColor);
  6761. begin
  6762. gtk_clist_set_foreground (TheGtkObject, row, color);
  6763. end;
  6764. procedure TFPgtkCList.SetBackground (row:integer; color:PGdkColor);
  6765. begin
  6766. gtk_clist_set_background (TheGtkObject, row, color);
  6767. end;
  6768. function TFPgtkCList.GetCellStyle (row:integer; column:integer) : PGtkStyle;
  6769. begin
  6770. result := gtk_clist_get_cell_style(TheGtkObject,row, column);
  6771. end;
  6772. procedure TFPgtkCList.SetCellStyle (row:integer; column:integer; TheValue:PGtkStyle);
  6773. begin
  6774. gtk_clist_set_cell_style(TheGtkObject,row, column,TheValue);
  6775. end;
  6776. function TFPgtkCList.GetRowStyle (row:integer) : PGtkStyle;
  6777. begin
  6778. result := gtk_clist_get_row_style(TheGtkObject,row);
  6779. end;
  6780. procedure TFPgtkCList.SetRowStyle (row:integer; TheValue:PGtkStyle);
  6781. begin
  6782. gtk_clist_set_row_style(TheGtkObject,row,TheValue);
  6783. end;
  6784. procedure TFPgtkCList.SetShift (row:integer; column:integer; vertical:integer; horizontal:integer);
  6785. begin
  6786. gtk_clist_set_shift (TheGtkObject, row, column, vertical, horizontal);
  6787. end;
  6788. procedure TFPgtkCList.Remove (row:integer);
  6789. begin
  6790. gtk_clist_remove (TheGtkObject, row);
  6791. end;
  6792. procedure TFPgtkCList.Prepend (Data:TStrings); Overload;
  6793. var ppdata : ppgchar;
  6794. begin
  6795. ppdata := StringsToPPgchar (Data);
  6796. gtk_clist_prepend (TheGtkObject, ppdata);
  6797. freemem (ppdata, sizeof (pgchar) * data.count);
  6798. end;
  6799. procedure TFPgtkCList.Prepend (Text:string; separator:string); Overload;
  6800. var l : TStrings;
  6801. s : string;
  6802. begin
  6803. l := TStringList.Create;
  6804. try
  6805. if pos('"',separator) = 0 then
  6806. s := stringreplace (Text, '"', '""', [rfReplaceAll]);
  6807. if separator <> '' then
  6808. s := stringreplace(Text, separator, '","', [rfReplaceAll]);
  6809. l.CommaText := '"'+s+'"';
  6810. Prepend (l);
  6811. finally
  6812. l.Free;
  6813. end;
  6814. end;
  6815. procedure TFPgtkCList.Prepend (data:array of string); Overload;
  6816. var ppdata : ppgchar;
  6817. begin
  6818. ppdata := ArrayToPPgchar (Data);
  6819. gtk_clist_prepend (TheGtkObject, ppdata);
  6820. freemem (ppdata, sizeof (pgchar) * (high(data)-low(data)+1));
  6821. end;
  6822. Function TFPgtkCList.Append (data:TStrings) : Integer; Overload;
  6823. var ppdata : ppgchar;
  6824. begin
  6825. ppdata := StringsToPPgchar (Data);
  6826. Result:=gtk_clist_append (TheGtkObject, ppdata);
  6827. freemem (ppdata, sizeof (pgchar) * data.count);
  6828. end;
  6829. Function TFPgtkCList.Append (Text:string; Separator:string) : Integer; Overload;
  6830. var l : TStrings;
  6831. s : string;
  6832. begin
  6833. l := TStringList.Create;
  6834. try
  6835. if pos('"',separator) = 0 then
  6836. s := stringreplace (Text, '"', '""', [rfReplaceAll]);
  6837. if separator <> '' then
  6838. s := stringreplace(Text, separator, '","', [rfReplaceAll]);
  6839. l.CommaText := '"' + s + '"';
  6840. Result:=Append (l);
  6841. finally
  6842. l.Free;
  6843. end;
  6844. end;
  6845. Function TFPgtkCList.Append (data:array of string) : Integer; Overload;
  6846. var ppdata : ppgchar;
  6847. begin
  6848. ppdata := ArrayToPPgchar (Data);
  6849. Result:=gtk_clist_append (TheGtkObject, ppdata);
  6850. freemem (ppdata, sizeof (pgchar) * (high(data)-low(data)+1));
  6851. end;
  6852. procedure TFPgtkCList.Insert (row:integer; data:TStrings); Overload;
  6853. var ppdata : ppgchar;
  6854. begin
  6855. ppdata := StringsToPPgchar (Data);
  6856. gtk_clist_insert (TheGtkObject, row, ppdata);
  6857. freemem (ppdata, sizeof (pgchar) * data.count);
  6858. end;
  6859. procedure TFPgtkCList.Insert (row:integer; Text:string; Separator:string); Overload;
  6860. var l : TStrings;
  6861. s : string;
  6862. begin
  6863. l := TStringList.Create;
  6864. try
  6865. if pos('"',separator) = 0 then
  6866. s := stringreplace (Text, '"', '""', [rfReplaceAll]);
  6867. if separator <> '' then
  6868. s := stringreplace(Text, separator, '","', [rfReplaceAll]);
  6869. l.CommaText := '"' + s + '"';
  6870. Insert (row, l);
  6871. finally
  6872. l.Free;
  6873. end;
  6874. end;
  6875. procedure TFPgtkCList.Insert (row:integer; data:array of string); Overload;
  6876. var ppdata : ppgchar;
  6877. begin
  6878. ppdata := ArrayToPPgchar (Data);
  6879. gtk_clist_insert (TheGtkObject, row, ppdata);
  6880. freemem (ppdata, sizeof (pgchar) * (high(data)-low(data)+1));
  6881. end;
  6882. function TFPgtkCList.GetRowData (row:integer) : pointer;
  6883. begin
  6884. result := gtk_clist_get_row_data(TheGtkObject,row);
  6885. end;
  6886. procedure TFPgtkCList.SetRowData (row:integer; TheValue:pointer);
  6887. begin
  6888. gtk_clist_set_row_data(TheGtkObject,row,TheValue);
  6889. end;
  6890. function TFPgtkCList.FindRowFromData (data:pointer) : integer;
  6891. begin
  6892. result := gtk_clist_find_row_from_data (TheGtkObject, data);
  6893. end;
  6894. procedure TFPgtkCList.SelectRow (row:integer; column:integer);
  6895. begin
  6896. gtk_clist_select_row (TheGtkObject, row, column);
  6897. end;
  6898. procedure TFPgtkCList.UnselectRow (row:integer; column:integer);
  6899. begin
  6900. gtk_clist_unselect_row (TheGtkObject, row, column);
  6901. end;
  6902. procedure TFPgtkCList.Clear;
  6903. begin
  6904. gtk_clist_clear (TheGtkObject);
  6905. end;
  6906. procedure TFPgtkCList.SelectAll;
  6907. begin
  6908. gtk_clist_select_all (TheGtkObject);
  6909. end;
  6910. procedure TFPgtkCList.UnselectAll;
  6911. begin
  6912. gtk_clist_unselect_all (TheGtkObject);
  6913. end;
  6914. procedure TFPgtkCList.SwapRows (row1:integer; row2:integer);
  6915. begin
  6916. gtk_clist_swap_rows (TheGtkObject, row1, row2);
  6917. end;
  6918. procedure TFPgtkCList.RowMove (sourceRow:integer; destRow:integer);
  6919. begin
  6920. if sourceRow = DestRow then
  6921. Exit;
  6922. gtk_clist_row_move (TheGtkObject, sourceRow, destRow);
  6923. end;
  6924. procedure TFPgtkCList.Sort;
  6925. begin
  6926. gtk_clist_sort (TheGtkObject);
  6927. end;
  6928. procedure TFPgtkCList.SetCompareFunc (TheValue:TGtkCListCompareFunc);
  6929. begin
  6930. gtk_clist_set_Compare_func(TheGtkObject,TheValue);
  6931. end;
  6932. function TFPgtkCList.GetSortColumn : integer;
  6933. begin
  6934. result := TheGtkObject^.sort_column;
  6935. end;
  6936. procedure TFPgtkCList.SetSortColumn (TheValue:integer);
  6937. begin
  6938. gtk_clist_set_sort_column(TheGtkObject,TheValue);
  6939. end;
  6940. function TFPgtkCList.GetSetSortType : TGtkSortType;
  6941. begin
  6942. result := TheGtkObject^.sort_type;
  6943. end;
  6944. procedure TFPgtkCList.SetSetSortType (TheValue:TGtkSortType);
  6945. begin
  6946. gtk_clist_set_sort_type(TheGtkObject,TheValue);
  6947. end;
  6948. procedure TFPgtkCList.SetAutoSort (autoSort:boolean);
  6949. begin
  6950. gtk_clist_set_auto_sort (TheGtkObject, autoSort);
  6951. end;
  6952. function TFPgtkCList.GetHAdjustment : TFPgtkAdjustment;
  6953. begin
  6954. result := GetPascalInstance(PGtkObject(gtk_clist_get_hadjustment(TheGtkObject)),tfpgtkadjustment) as tfpgtkadjustment;
  6955. end;
  6956. procedure TFPgtkCList.SetHAdjustment (TheValue:TFPgtkAdjustment);
  6957. begin
  6958. gtk_clist_set_hadjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  6959. end;
  6960. function TFPgtkCList.GetVAdjustment : TFPgtkAdjustment;
  6961. begin
  6962. result := GetPascalInstance(PGtkObject(gtk_clist_get_vadjustment(TheGtkObject)),tfpgtkadjustment) as tfpgtkadjustment;
  6963. end;
  6964. procedure TFPgtkCList.SetVAdjustment (TheValue:TFPgtkAdjustment);
  6965. begin
  6966. gtk_clist_set_vadjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  6967. end;
  6968. procedure TFPgtkCList.SetReorderable (reorderable:boolean);
  6969. begin
  6970. gtk_clist_set_reorderable (TheGtkObject, reorderable);
  6971. end;
  6972. function TFPgtkCList.Count : integer;
  6973. begin
  6974. result := TheGtkObject^.rows;
  6975. end;
  6976. procedure CListScrollSignalproc (Sender:PGtkobject; ScrollType:TgtkScrollType; position:gfloat; data:pointer); cdecl;
  6977. var p : TFPgtkCListScrollSignalFunction;
  6978. begin
  6979. with PSignalData(data)^ do
  6980. begin
  6981. p := TFPgtkCListScrollSignalFunction (TheSignalProc);
  6982. p (TheWidget as TFPgtkObject, ScrollType, position, TheData)
  6983. end;
  6984. end;
  6985. function TFPgtkCList.CListScrollSignalConnect (signal:string; proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  6986. begin
  6987. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@CListScrollSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  6988. end;
  6989. function TFPgtkCList.CListScrollSignalConnectAfter (signal:string; proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  6990. begin
  6991. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@CListScrollSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  6992. end;
  6993. procedure CListScrollBooleanSignalproc (Sender:PGtkobject; ScrollType:TgtkScrollType; Position:gfloat; AutoStartSelection:boolean; data:pointer); cdecl;
  6994. var p : TFPgtkCListScrollBooleanSignalFunction;
  6995. begin
  6996. with PSignalData(data)^ do
  6997. begin
  6998. p := TFPgtkCListScrollBooleanSignalFunction (TheSignalProc);
  6999. p (TheWidget as TFPgtkObject, ScrollType, Position, AutoStartSelection, TheData)
  7000. end;
  7001. end;
  7002. function TFPgtkCList.CListScrollBooleanSignalConnect (signal:string; proc:TFPgtkCListScrollBooleanSignalFunction; data:pointer) : guint;
  7003. begin
  7004. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@CListScrollBooleanSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7005. end;
  7006. function TFPgtkCList.CListScrollBooleanSignalConnectAfter (signal:string; proc:TFPgtkCListScrollBooleanSignalFunction; data:pointer) : guint;
  7007. begin
  7008. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@CListScrollBooleanSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7009. end;
  7010. procedure SelectRowSignalproc (Sender:PGtkobject; row:integer; column:integer; event:PGdkEventButton; data:pointer); cdecl;
  7011. var p : TFPgtkSelectRowSignalFunction;
  7012. begin
  7013. with PSignalData(data)^ do
  7014. begin
  7015. p := TFPgtkSelectRowSignalFunction (TheSignalProc);
  7016. p (TheWidget as TFPgtkObject, row, column, event, TheData)
  7017. end;
  7018. end;
  7019. function TFPgtkCList.SelectRowSignalConnect (signal:string; proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  7020. begin
  7021. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@SelectRowSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7022. end;
  7023. function TFPgtkCList.SelectRowSignalConnectAfter (signal:string; proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  7024. begin
  7025. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@SelectRowSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7026. end;
  7027. function TFPgtkCList.ConnectSelectRow (proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  7028. begin
  7029. result := SelectRowSignalConnect (sgSelectRow, proc, data);
  7030. end;
  7031. function TFPgtkCList.ConnectAfterSelectRow (proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  7032. begin
  7033. result := SelectRowSignalConnectAfter (sgSelectRow, proc, data);
  7034. end;
  7035. function TFPgtkCList.ConnectUnselectRow (proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  7036. begin
  7037. result := SelectRowSignalConnect (sgUnselectRow, proc, data);
  7038. end;
  7039. function TFPgtkCList.ConnectAfterUnselectRow (proc:TFPgtkSelectRowSignalFunction; data:pointer) : guint;
  7040. begin
  7041. result := SelectRowSignalConnectAfter (sgUnselectRow, proc, data);
  7042. end;
  7043. procedure MoveSignalproc (Sender:PGtkobject; arg1:integer; arg2:integer; data:pointer); cdecl;
  7044. var p : TFPgtkMoveSignalFunction;
  7045. begin
  7046. with PSignalData(data)^ do
  7047. begin
  7048. p := TFPgtkMoveSignalFunction (TheSignalProc);
  7049. p (TheWidget as TFPgtkObject, arg1, arg2, TheData)
  7050. end;
  7051. end;
  7052. function TFPgtkCList.MoveSignalConnect (signal:string; proc:TFPgtkMoveSignalFunction; data:pointer) : guint;
  7053. begin
  7054. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@MoveSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7055. end;
  7056. function TFPgtkCList.MoveSignalConnectAfter (signal:string; proc:TFPgtkMoveSignalFunction; data:pointer) : guint;
  7057. begin
  7058. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@MoveSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7059. end;
  7060. function TFPgtkCList.ConnectRowMove (proc:TFPgtkMoveSignalFunction; data:pointer) : guint;
  7061. begin
  7062. result := MoveSignalConnect (sgRowMove, proc, data);
  7063. end;
  7064. function TFPgtkCList.ConnectAfterRowMove (proc:TFPgtkMoveSignalFunction; data:pointer) : guint;
  7065. begin
  7066. result := MoveSignalConnectAfter (sgRowMove, proc, data);
  7067. end;
  7068. function TFPgtkCList.ConnectScrollVertical (proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  7069. begin
  7070. result := CListScrollSignalConnect (sgScrollVertical, proc, data);
  7071. end;
  7072. function TFPgtkCList.ConnectAfterScrollVertical (proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  7073. begin
  7074. result := CListScrollSignalConnectAfter (sgScrollVertical, proc, data);
  7075. end;
  7076. function TFPgtkCList.ConnectScrolHorizontal (proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  7077. begin
  7078. result := CListScrollSignalConnect (sgScrolHorizontal, proc, data);
  7079. end;
  7080. function TFPgtkCList.ConnectAfterScrolHorizontal (proc:TFPgtkCListScrollSignalFunction; data:pointer) : guint;
  7081. begin
  7082. result := CListScrollSignalConnectAfter (sgScrolHorizontal, proc, data);
  7083. end;
  7084. function TFPgtkCList.ConnectToggleFocusRow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  7085. begin
  7086. result := SignalConnect (sgToggleFocusRow, proc, data);
  7087. end;
  7088. function TFPgtkCList.ConnectAfterToggleFocusRow (proc:TFPgtkSignalFunction; data:pointer) : guint;
  7089. begin
  7090. result := SignalConnectAfter (sgToggleFocusRow, proc, data);
  7091. end;
  7092. function TFPgtkCList.ConnectSelectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  7093. begin
  7094. result := SignalConnect (sgSelectAll, proc, data);
  7095. end;
  7096. function TFPgtkCList.ConnectAfterSelectAll (proc:TFPgtkSignalFunction; data:pointer) : guint;
  7097. begin
  7098. result := SignalConnectAfter (sgSelectAll, proc, data);
  7099. end;
  7100. function TFPgtkCList.ConnectUnselectAll (proc:TFPgtksignalFunction; data:pointer) : guint;
  7101. begin
  7102. result := signalConnect (sgUnselectAll, proc, data);
  7103. end;
  7104. function TFPgtkCList.ConnectAfterUnselectAll (proc:TFPgtksignalFunction; data:pointer) : guint;
  7105. begin
  7106. result := signalConnectAfter (sgUnselectAll, proc, data);
  7107. end;
  7108. function TFPgtkCList.ConnectUndoSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  7109. begin
  7110. result := signalConnect (sgUndoSelection, proc, data);
  7111. end;
  7112. function TFPgtkCList.ConnectAfterUndoSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  7113. begin
  7114. result := signalConnectAfter (sgUndoSelection, proc, data);
  7115. end;
  7116. function TFPgtkCList.ConnectStartSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  7117. begin
  7118. result := signalConnect (sgStartSelection, proc, data);
  7119. end;
  7120. function TFPgtkCList.ConnectAfterStartSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  7121. begin
  7122. result := signalConnectAfter (sgStartSelection, proc, data);
  7123. end;
  7124. function TFPgtkCList.ConnectEndSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  7125. begin
  7126. result := signalConnect (sgEndSelection, proc, data);
  7127. end;
  7128. function TFPgtkCList.ConnectAfterEndSelection (proc:TFPgtksignalFunction; data:pointer) : guint;
  7129. begin
  7130. result := signalConnectAfter (sgEndSelection, proc, data);
  7131. end;
  7132. function TFPgtkCList.ConnectToggleAddMode (proc:TFPgtksignalFunction; data:pointer) : guint;
  7133. begin
  7134. result := signalConnect (sgToggleAddMode, proc, data);
  7135. end;
  7136. function TFPgtkCList.ConnectAfterToggleAddMode (proc:TFPgtksignalFunction; data:pointer) : guint;
  7137. begin
  7138. result := signalConnectAfter (sgToggleAddMode, proc, data);
  7139. end;
  7140. function TFPgtkCList.ConnectAbortColumnResize (proc:TFPgtksignalFunction; data:pointer) : guint;
  7141. begin
  7142. result := signalConnect (sgAbortColumnResize, proc, data);
  7143. end;
  7144. function TFPgtkCList.ConnectAfterAbortColumnResize (proc:TFPgtksignalFunction; data:pointer) : guint;
  7145. begin
  7146. result := signalConnectAfter (sgAbortColumnResize, proc, data);
  7147. end;
  7148. function TFPgtkCList.ConnectExtendSelection (proc:TFPgtkCListScrollBooleanSignalFunction; data:pointer) : guint;
  7149. begin
  7150. result := CListScrollBooleanSignalConnect (sgExtendSelection, proc, data);
  7151. end;
  7152. function TFPgtkCList.ConnectAfterExtendSelection (proc:TFPgtkCListScrollBooleanSignalFunction; data:pointer) : guint;
  7153. begin
  7154. result := CListScrollBooleanSignalConnectAfter (sgExtendSelection, proc, data);
  7155. end;
  7156. procedure ColumnClickedSignalproc (Sender:PGtkobject; column:integer; data:pointer); cdecl;
  7157. var p : TFPgtkColumnClickedSignalFunction;
  7158. begin
  7159. with PSignalData(data)^ do
  7160. begin
  7161. p := TFPgtkColumnClickedSignalFunction (TheSignalProc);
  7162. p (TheWidget as TFPgtkObject, column, TheData)
  7163. end;
  7164. end;
  7165. function TFPgtkCList.ColumnClickedSignalConnect (signal:string; proc:TFPgtkColumnClickedSignalFunction; data:pointer) : guint;
  7166. begin
  7167. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@ColumnClickedSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7168. end;
  7169. function TFPgtkCList.ColumnClickedSignalConnectAfter (signal:string; proc:TFPgtkColumnClickedSignalFunction; data:pointer) : guint;
  7170. begin
  7171. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@ColumnClickedSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7172. end;
  7173. function TFPgtkCList.ConnectClickColumn (proc:TFPgtkColumnClickedSignalFunction; data:pointer) : guint;
  7174. begin
  7175. result := ColumnClickedSignalConnect (sgClickColumn, proc, data);
  7176. end;
  7177. function TFPgtkCList.ConnectAfterClickColumn (proc:TFPgtkColumnClickedSignalFunction; data:pointer) : guint;
  7178. begin
  7179. result := ColumnClickedSignalConnectAfter (sgClickColumn, proc, data);
  7180. end;
  7181. procedure ResizeColumnSignalproc (Sender:PGtkobject; column:integer; width:integer; data:pointer); cdecl;
  7182. var p : TFPgtkResizeColumnSignalFunction;
  7183. begin
  7184. with PSignalData(data)^ do
  7185. begin
  7186. p := TFPgtkResizeColumnSignalFunction (TheSignalProc);
  7187. p (TheWidget as TFPgtkObject, column, width, TheData)
  7188. end;
  7189. end;
  7190. function TFPgtkCList.ResizeColumnSignalConnect (signal:string; proc:TFPgtkResizeColumnSignalFunction; data:pointer) : guint;
  7191. begin
  7192. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@ResizeColumnSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7193. end;
  7194. function TFPgtkCList.ResizeColumnSignalConnectAfter (signal:string; proc:TFPgtkResizeColumnSignalFunction; data:pointer) : guint;
  7195. begin
  7196. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@ResizeColumnSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7197. end;
  7198. function TFPgtkCList.ConnectResizeColumn (proc:TFPgtkResizeColumnSignalFunction; data:pointer) : guint;
  7199. begin
  7200. result := ResizeColumnSignalConnect (sgResizeColumn, proc, data);
  7201. end;
  7202. function TFPgtkCList.ConnectAfterResizeColumn (proc:TFPgtkResizeColumnSignalFunction; data:pointer) : guint;
  7203. begin
  7204. result := ResizeColumnSignalConnectAfter (sgResizeColumn, proc, data);
  7205. end;
  7206. { TFPgtkCTree }
  7207. function TFPgtkCTree.TheGtkObject : PGtkCTree;
  7208. begin
  7209. result := PgtkCTree(FGtkObject);
  7210. end;
  7211. function TFPgtkCTree.GetLineStyle : TGtkCTreeLineStyle;
  7212. begin
  7213. result := TGtkCTreeLineStyle(gtk.line_style(TheGtkObject^));
  7214. end;
  7215. procedure TFPgtkCTree.SetLineStyle (TheValue:TGtkCTreeLineStyle);
  7216. begin
  7217. gtk_ctree_set_line_style(TheGtkObject,TheValue);
  7218. end;
  7219. function TFPgtkCTree.GetShowStub : boolean;
  7220. begin
  7221. result := boolean(gtk.show_stub(TheGtkObject^));
  7222. end;
  7223. procedure TFPgtkCTree.SetShowStub (TheValue:boolean);
  7224. begin
  7225. gtk_ctree_set_show_stub(TheGtkObject,TheValue);
  7226. end;
  7227. function TFPgtkCTree.GetExpanderStyle : TGtkCTreeExpanderStyle;
  7228. begin
  7229. result := TGtkCTreeExpanderStyle(gtk.expander_style(TheGtkObject^));
  7230. end;
  7231. procedure TFPgtkCTree.SetExpanderStyle (TheValue:TGtkCTreeExpanderStyle);
  7232. begin
  7233. gtk_ctree_set_expander_style(TheGtkObject,TheValue);
  7234. end;
  7235. function TFPgtkCTree.GetSpacing : guint;
  7236. begin
  7237. result := TheGtkObject^.tree_spacing;
  7238. end;
  7239. procedure TFPgtkCTree.SetSpacing (TheValue:guint);
  7240. begin
  7241. gtk_ctree_set_spacing(TheGtkObject,TheValue);
  7242. end;
  7243. function TFPgtkCTree.GetIndent : guint;
  7244. begin
  7245. result := TheGtkObject^.tree_indent;
  7246. end;
  7247. procedure TFPgtkCTree.SetIndent (TheValue:guint);
  7248. begin
  7249. gtk_ctree_set_indent(TheGtkObject,TheValue);
  7250. end;
  7251. function TFPgtkCTree.GetTreeColumn : integer;
  7252. begin
  7253. result := TheGtkObject^.tree_column;
  7254. end;
  7255. constructor TFPgtkCTree.Create (aColumnCount:integer; aTreeColumn:integer);
  7256. begin
  7257. FTreeColumn := aTreeColumn;
  7258. inherited Create (aColumnCount);
  7259. end;
  7260. procedure TFPgtkCTree.RemoveNode (node:PGtkCTreeNode);
  7261. begin
  7262. gtk_ctree_remove_node (TheGtkObject, node);
  7263. end;
  7264. function TFPgtkCTree.InsertNode (aParent:PGtkCTreeNode; Sibling:PGtkCTreeNode; data:string; aSpacing:guint8; PixmapClosed:PGdkPixmap; MaskClosed:PGdkBitmap; PixmapOpened:PGdkPixmap; MaskOpened:PGdkBitmap; IsLeaf:boolean; Expanded:boolean) : PGtkCTreeNode; Overload;
  7265. var
  7266. temppgc : pgchar;
  7267. begin
  7268. temppgc:=ConvertToPgchar(data);
  7269. result := gtk_ctree_insert_node (TheGtkObject, aParent, Sibling, @temppgc, aSpacing, PixmapClosed, MaskClosed, PixmapOpened, MaskOpened, IsLeaf, Expanded);
  7270. end;
  7271. function TFPgtkCTree.InsertNode (aParent:PGtkCTreeNode; Sibling:PGtkCTreeNode; data:string; aSpacing:guint8; IsLeaf:boolean; Expanded:boolean) : PGtkCTreeNode; Overload;
  7272. begin
  7273. result := InsertNode (aParent, Sibling, data, aSpacing, nil, nil, nil, nil, IsLeaf, Expanded);
  7274. end;
  7275. procedure FPgtkCTreeFunc (Tree:PGtkCTree; Node:PGtkCTreeNode; data:pointer); Cdecl;
  7276. var p : TFPgtkCTreeFunction;
  7277. begin
  7278. with PSignalData(data)^ do
  7279. begin
  7280. p := TFPgtkCTreeFunction (TheSignalProc);
  7281. p (TFPgtkCTree(GetPascalInstance(PgtkObject(Tree))), Node, data);
  7282. end;
  7283. end;
  7284. procedure TFPgtkCTree.PostRecursive (aNode:PGtkCTreeNode; func:TFPgtkCTreeFunction; data:pointer);
  7285. begin
  7286. gtk_CTree_post_recursive (TheGtkObject, aNode, @FPgtkCTreeFunc,
  7287. ConvertSignalData(TFPgtkSignalFunction(func), data, true));
  7288. end;
  7289. procedure TFPgtkCTree.PostRecursiveToDepth (aNode:PGtkCTreeNode; aDepth:integer; func:TFPgtkCTreeFunction; data:pointer);
  7290. begin
  7291. gtk_CTree_post_recursive_to_depth (TheGtkObject, aNode, aDepth, @FPgtkCTreeFunc,
  7292. ConvertSignalData(TFPgtkSignalFunction(func), data, true));
  7293. end;
  7294. procedure TFPgtkCTree.PreRecursive (aNode:PGtkCTreeNode; func:TFPgtkCTreeFunction; data:pointer);
  7295. begin
  7296. gtk_CTree_pre_recursive (TheGtkObject, aNode, @FPgtkCTreeFunc,
  7297. ConvertSignalData(TFPgtkSignalFunction(func), data, true));
  7298. end;
  7299. procedure TFPgtkCTree.PreRecursiveToDepth (aNode:PGtkCTreeNode; aDepth:integer; func:TFPgtkCTreeFunction; data:pointer);
  7300. begin
  7301. gtk_CTree_pre_recursive_to_depth (TheGtkObject, aNode, aDepth, @FPgtkCTreeFunc,
  7302. ConvertSignalData(TFPgtkSignalFunction(func), data, true));
  7303. end;
  7304. procedure TFPgtkCTree.IsViewable (aNode:PGtkCTreeNode);
  7305. begin
  7306. gtk_ctree_is_viewable (TheGtkObject, aNode);
  7307. end;
  7308. procedure TFPgtkCTree.LastChild (aNode:PGtkCTreeNode);
  7309. begin
  7310. gtk_ctree_last (TheGtkObject, aNode);
  7311. end;
  7312. function TFPgtkCTree.IsChild (anAncestor:PGtkCTreeNode; aChild:PGtkCTreeNode) : boolean;
  7313. begin
  7314. result := gtk_ctree_find (TheGtkObject, anAncestor, aChild);
  7315. end;
  7316. function TFPgtkCTree.IsAncestor (anAncestor:PGtkCTreeNode; aChild:PGtkCTreeNode) : boolean;
  7317. begin
  7318. result := gtk_ctree_is_ancestor (TheGtkObject, anAncestor, aChild);
  7319. end;
  7320. function TFPgtkCTree.IsHotSpot (X:integer; Y:integer) : boolean;
  7321. begin
  7322. result := gtk_ctree_is_hot_spot (TheGtkObject, X, Y);
  7323. end;
  7324. procedure TFPgtkCTree.MoveNode (aNode:PGtkCTreeNode; NewParent:PGtkCTreeNode; NewSibling:PGtkCTreeNode);
  7325. begin
  7326. gtk_ctree_move (TheGtkObject, aNode, NewParent, NewSibling);
  7327. end;
  7328. procedure TFPgtkCTree.Expand (aNode:PGtkCTreeNode);
  7329. begin
  7330. gtk_ctree_expand (TheGtkObject, aNode);
  7331. end;
  7332. procedure TFPgtkCTree.ExpandRecursive (aNode:PGtkCTreeNode);
  7333. begin
  7334. gtk_ctree_expand_recursive (TheGtkObject, aNode);
  7335. end;
  7336. procedure TFPgtkCTree.ExpandToDepth (aNode:PGtkCTreeNode; aDepth:integer);
  7337. begin
  7338. gtk_ctree_expand_to_depth (TheGtkObject, aNode, aDepth);
  7339. end;
  7340. procedure TFPgtkCTree.Collapse (aNode:PGtkCTreeNode);
  7341. begin
  7342. gtk_ctree_collapse (TheGtkObject, aNode);
  7343. end;
  7344. procedure TFPgtkCTree.CollapseRecursive (aNode:PGtkCTreeNode);
  7345. begin
  7346. gtk_ctree_collapse_recursive (TheGtkObject, aNode);
  7347. end;
  7348. procedure TFPgtkCTree.CollapseToDepth (aNode:PGtkCTreeNode; aDepth:integer);
  7349. begin
  7350. gtk_ctree_collapse_to_depth (TheGtkObject, aNode, aDepth);
  7351. end;
  7352. procedure TFPgtkCTree.SelectNode (aNode:PGtkCTreeNode);
  7353. begin
  7354. gtk_ctree_select (TheGtkObject, aNode);
  7355. end;
  7356. procedure TFPgtkCTree.SelectRecursive (aNode:PGtkCTreeNode);
  7357. begin
  7358. gtk_ctree_select_recursive (TheGtkObject, aNode);
  7359. end;
  7360. procedure TFPgtkCTree.UnselectNode (aNode:PGtkCTreeNode);
  7361. begin
  7362. gtk_ctree_unselect (TheGtkObject, aNode);
  7363. end;
  7364. procedure TFPgtkCTree.UnselectRecursive (aNode:PGtkCTreeNode);
  7365. begin
  7366. gtk_ctree_unselect_recursive (TheGtkObject, aNode);
  7367. end;
  7368. procedure TFPgtkCTree.RealSelectRecursive (aNode:PGtkCTreeNode; aState:boolean);
  7369. begin
  7370. gtk_ctree_real_select_recursive (TheGtkObject, aNode, ord(aState));
  7371. end;
  7372. function TFPgtkCTree.NodeGetCellType (Node:PGtkCTreeNode; column:integer) : TGtkCellType;
  7373. begin
  7374. result := gtk_ctree_node_get_cell_type (TheGtkObject, Node, column);
  7375. end;
  7376. function TFPgtkCTree.GetNodeCellText (Node:PGtkCTreeNode; Column:integer) : string;
  7377. var s : pgchar;
  7378. r : integer;
  7379. begin
  7380. r := gtk_ctree_node_get_text (TheGtkObject, node, column, @s);
  7381. if (r = 0) then
  7382. result := ''
  7383. else
  7384. result := string(s^);
  7385. end;
  7386. procedure TFPgtkCTree.SetNodeCellText (Node:PGtkCTreeNode; Column:integer; TheValue:string);
  7387. begin
  7388. gtk_ctree_node_set_text(TheGtkObject,Node, Column,ConvertToPgchar(TheValue));
  7389. end;
  7390. procedure TFPgtkCTree.NodeSetPixmap (Node:PGtkCTreeNode; column:integer; pixmap:PGdkPixmap; mask:PGdkBitmap);
  7391. begin
  7392. gtk_ctree_node_set_pixmap (TheGtkObject, Node, column, pixmap, mask);
  7393. end;
  7394. procedure TFPgtkCTree.NodeGetPixmap (Node:PGtkCTreeNode; column:integer; var pixmap:PGdkPixmap; var mask:PGdkBitmap);
  7395. begin
  7396. gtk_ctree_node_get_pixmap (TheGtkObject, node, column, @pixmap, @mask);
  7397. end;
  7398. procedure TFPgtkCTree.NodeSetPixText (Node:PGtkCTreeNode; column:integer; text:string; aspacing:guint8; pixmap:PGdkPixmap; mask:PGdkBitmap);
  7399. begin
  7400. gtk_ctree_node_set_pixtext (TheGtkObject, Node, column, ConvertToPgchar(text), aspacing, pixmap, mask);
  7401. end;
  7402. procedure TFPgtkCTree.NodeGetPixText (Node:PGtkCTreeNode; column:integer; var text:string; var aspacing:guint8; var pixmap:PGdkPixmap; var mask:PGdkBitmap);
  7403. var r : integer;
  7404. s : PPgchar;
  7405. begin
  7406. s := nil;
  7407. r := gtk_ctree_node_get_pixtext (TheGtkObject, node, column, s, @aspacing, @pixmap, @mask);
  7408. if r = 0 then
  7409. begin
  7410. text := '';
  7411. pixmap := nil;
  7412. mask := nil;
  7413. end
  7414. else
  7415. text := string (s^);
  7416. end;
  7417. procedure TFPgtkCTree.SetNodeInfo (aNode:PGtkCTreeNode; aText:string; aSpacing:guint8; PixmapClosed:PGdkPixmap; MaskClosed:PGdkBitmap; PixmapOpened:PGdkPixmap; MaskOpened:PGdkBitmap; IsLeaf:boolean; Expanded:boolean); Overload;
  7418. begin
  7419. gtk_ctree_set_node_info (TheGtkObject, aNode, ConvertToPgchar(aText), aSpacing, PixmapClosed, MaskClosed, PixmapOpened, MaskOpened, IsLeaf, Expanded);
  7420. end;
  7421. procedure TFPgtkCTree.GetNodeInfo (aNode:PGtkCTreeNode; var aText:string; var aSpacing:guint8; var PixmapClosed:PGdkPixmap; var MaskClosed:PGdkBitmap; var PixmapOpened:PGdkPixmap; var MaskOpened:PGdkBitmap; var IsLeaf:boolean; var Expanded:boolean); Overload;
  7422. var r : integer;
  7423. s : PPgchar;
  7424. begin
  7425. s := nil;
  7426. r := gtk_ctree_get_node_info (TheGtkObject, aNode, s,
  7427. @aspacing, @pixmapClosed, @maskClosed, @pixmapOpened, @maskOpened,
  7428. pgboolean(@IsLeaf), pgboolean(@expanded));
  7429. if r = 0 then
  7430. begin
  7431. atext := '';
  7432. Spacing := 0;
  7433. pixmapClosed := nil;
  7434. maskClosed := nil;
  7435. pixmapOpened := nil;
  7436. maskOpened := nil;
  7437. IsLeaf := false;
  7438. Expanded := false;
  7439. end
  7440. else
  7441. atext := string (s^);
  7442. end;
  7443. procedure TFPgtkCTree.NodeSetShift (Node:PGtkCTreeNode; column:integer; vertical:integer; horizontal:integer);
  7444. begin
  7445. gtk_ctree_node_set_shift (TheGtkObject, Node, column, vertical, horizontal);
  7446. end;
  7447. function TFPgtkCTree.GetNodeSelectable (Node:PGtkCTreeNode) : boolean;
  7448. begin
  7449. result := gtk_ctree_node_get_selectable(TheGtkObject,Node);
  7450. end;
  7451. procedure TFPgtkCTree.SetNodeSelectable (Node:PGtkCTreeNode; TheValue:boolean);
  7452. begin
  7453. gtk_ctree_node_set_selectable(TheGtkObject,Node,TheValue);
  7454. end;
  7455. procedure TFPgtkCTree.NodeSetForeground (Node:PGtkCTreeNode; color:PGdkColor);
  7456. begin
  7457. gtk_ctree_node_set_foreground (TheGtkObject, Node, color);
  7458. end;
  7459. procedure TFPgtkCTree.NodeSetBackground (Node:PGtkCTreeNode; color:PGdkColor);
  7460. begin
  7461. gtk_ctree_node_set_background (TheGtkObject, Node, color);
  7462. end;
  7463. function TFPgtkCTree.GetNodeCellStyle (Node:PGtkCTreeNode; column:integer) : PGtkStyle;
  7464. begin
  7465. result := gtk_ctree_node_get_cell_style(TheGtkObject,Node, column);
  7466. end;
  7467. procedure TFPgtkCTree.SetNodeCellStyle (Node:PGtkCTreeNode; column:integer; TheValue:PGtkStyle);
  7468. begin
  7469. gtk_ctree_node_set_cell_style(TheGtkObject,Node, column,TheValue);
  7470. end;
  7471. function TFPgtkCTree.GetNodeRowStyle (Node:PGtkCTreeNode) : PGtkStyle;
  7472. begin
  7473. result := gtk_ctree_node_get_row_style(TheGtkObject,Node);
  7474. end;
  7475. procedure TFPgtkCTree.SetNodeRowStyle (Node:PGtkCTreeNode; TheValue:PGtkStyle);
  7476. begin
  7477. gtk_ctree_node_set_row_style(TheGtkObject,Node,TheValue);
  7478. end;
  7479. function TFPgtkCTree.GetNodeData (Node:PGtkCTreeNode) : pointer;
  7480. begin
  7481. result := gtk_ctree_node_get_row_data(TheGtkObject,Node);
  7482. end;
  7483. procedure TFPgtkCTree.SetNodeData (Node:PGtkCTreeNode; TheValue:pointer);
  7484. begin
  7485. gtk_ctree_node_set_row_data(TheGtkObject,Node,TheValue);
  7486. end;
  7487. procedure TFPgtkCTree.NodeMoveTo (aNode:PGtkCTreeNode; column:integer; RowAlign:gfloat; ColAlign:gfloat);
  7488. begin
  7489. gtk_ctree_node_moveto (TheGtkObject, aNode, column, RowAlign, ColAlign);
  7490. end;
  7491. function TFPgtkCTree.IsVisible (aNode:PGtkCTreeNode) : TGtkVisibility;
  7492. begin
  7493. result := gtk_ctree_node_is_visible (TheGtkObject, aNode);
  7494. end;
  7495. function TFPgtkCTree.GetCompareDragFunc : TGtkCTreeCompareDragFunc;
  7496. begin
  7497. result := TheGtkObject^.drag_compare;
  7498. end;
  7499. procedure TFPgtkCTree.SetCompareDragFunc (TheValue:TGtkCTreeCompareDragFunc);
  7500. begin
  7501. gtk_ctree_set_drag_compare_func(TheGtkObject,TheValue);
  7502. end;
  7503. procedure TFPgtkCTree.SortNode (aNode:PGtkCTreeNode);
  7504. begin
  7505. gtk_ctree_sort_node (TheGtkObject, aNode);
  7506. end;
  7507. procedure TFPgtkCTree.SortRecursive (aNode:PGtkCTreeNode);
  7508. begin
  7509. gtk_ctree_sort_recursive (TheGtkObject, aNode);
  7510. end;
  7511. function TFPgtkCTree.NthNode (Row:integer) : PGtkCTreeNode;
  7512. begin
  7513. result := gtk_ctree_node_Nth (TheGtkObject, Row);
  7514. end;
  7515. { TFPgtkFixed }
  7516. function TFPgtkFixed.TheGtkObject : PGtkFixed;
  7517. begin
  7518. result := PgtkFixed(FGtkObject);
  7519. end;
  7520. procedure TFPgtkFixed.CreateGtkObject;
  7521. begin
  7522. FGtkObject := PGtkObject(gtk_fixed_new);
  7523. end;
  7524. procedure TFPgtkFixed.Put (Widget:TFPgtkWidget; x:integer; y:integer);
  7525. begin
  7526. gtk_fixed_put (TheGtkObject, PGtkwidget(ConvertToGtkObject(Widget)), x, y);
  7527. end;
  7528. procedure TFPgtkFixed.Move (Widget:TFPgtkWidget; x:integer; y:integer);
  7529. begin
  7530. gtk_fixed_move (TheGtkObject, PGtkwidget(ConvertToGtkObject(Widget)), x, y);
  7531. end;
  7532. procedure TFPgtkFixed.GetPos (Widget:TFPgtkWidget; var PosX:integer; var PosY:integer);
  7533. var g : TFPgtkGroup;
  7534. r : integer;
  7535. begin
  7536. g := TFPgtkGroup.Create;
  7537. try
  7538. g.ManageLists := false;
  7539. g.gtkList := TheGtkObject^.children;
  7540. r := g.indexof (Widget);
  7541. if r < 0 then
  7542. begin
  7543. PosX := -1;
  7544. PosY := -1;
  7545. end
  7546. else
  7547. with PGtkFixedChild(g.Items[r])^ do
  7548. begin
  7549. PosX := x;
  7550. PosY := Y;
  7551. end;
  7552. finally
  7553. g.Free;
  7554. end;
  7555. end;
  7556. { TFPgtkNotebook }
  7557. function TFPgtkNotebook.TheGtkObject : PGtkNotebook;
  7558. begin
  7559. result := PgtkNotebook(FGtkObject);
  7560. end;
  7561. procedure TFPgtkNotebook.CreateGtkObject;
  7562. begin
  7563. FGtkObject := PGtkObject(gtk_notebook_new);
  7564. end;
  7565. procedure TFPgtkNotebook.AppendPage (Child:TFPgtkWidget; TabLabel:TFPgtkWidget);
  7566. begin
  7567. gtk_notebook_append_page (TheGtkObject, ConvertTogtkWidget(Child), ConvertTogtkWidget(TabLabel));
  7568. Child.Show;
  7569. end;
  7570. procedure TFPgtkNotebook.AppendPageFull (Child:TFPgtkWidget; TabLabel:TFPgtkWidget; MenuLabel:TFPgtkWidget; IsVisible:boolean);
  7571. begin
  7572. if assigned (MenuLabel) then
  7573. gtk_notebook_append_page_menu (TheGtkObject, ConvertTogtkWidget(Child), ConvertTogtkWidget(TabLabel), ConvertTogtkWidget(MenuLabel))
  7574. else
  7575. gtk_notebook_append_page (TheGtkObject, ConvertTogtkWidget(Child), ConvertTogtkWidget(TabLabel));
  7576. if isvisible then
  7577. Child.Show;
  7578. end;
  7579. procedure TFPgtkNotebook.PrependPage (Child:TFPgtkWidget; TabLabel:TFPgtkWidget);
  7580. begin
  7581. gtk_notebook_Prepend_page (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)), PGtkwidget(ConvertToGtkObject(TabLabel)));
  7582. end;
  7583. procedure TFPgtkNotebook.PrependPageFull (Child:TFPgtkWidget; TabLabel:TFPgtkWidget; MenuLabel:TFPgtkWidget; IsVisible:boolean);
  7584. begin
  7585. if assigned (MenuLabel) then
  7586. gtk_notebook_prepend_page_menu (TheGtkObject, ConvertTogtkWidget(Child), ConvertTogtkWidget(TabLabel), ConvertTogtkWidget(MenuLabel))
  7587. else
  7588. gtk_notebook_prepend_page (TheGtkObject, ConvertTogtkWidget(Child), ConvertTogtkWidget(TabLabel));
  7589. if isvisible then
  7590. Child.Show;
  7591. end;
  7592. procedure TFPgtkNotebook.InsertPage (Child:TFPgtkWidget; TabLabel:TFPgtkWidget; Position:integer);
  7593. begin
  7594. gtk_notebook_insert_page (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)), PGtkwidget(ConvertToGtkObject(TabLabel)), Position);
  7595. end;
  7596. procedure TFPgtkNotebook.InsertPageFull (Child:TFPgtkWidget; TabLabel:TFPgtkWidget; MenuLabel:TFPgtkWidget; IsVisible:boolean; Position:integer);
  7597. begin
  7598. if assigned (MenuLabel) then
  7599. gtk_notebook_insert_page_menu (TheGtkObject, ConvertTogtkWidget(Child), ConvertTogtkWidget(TabLabel), ConvertTogtkWidget(MenuLabel), position)
  7600. else
  7601. gtk_notebook_insert_page (TheGtkObject, ConvertTogtkWidget(Child), ConvertTogtkWidget(TabLabel), position);
  7602. if isvisible then
  7603. Child.Show;
  7604. end;
  7605. procedure TFPgtkNotebook.RemovePage (PageNumber:integer);
  7606. begin
  7607. gtk_notebook_remove_page (TheGtkObject, PageNumber);
  7608. end;
  7609. function TFPgtkNotebook.PageNumberOf (Child:TFPgtkWidget) : integer;
  7610. begin
  7611. result := gtk_notebook_page_num (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)));
  7612. end;
  7613. procedure TFPgtkNotebook.NextPage;
  7614. begin
  7615. gtk_notebook_next_page (TheGtkObject);
  7616. end;
  7617. procedure TFPgtkNotebook.PrevPage;
  7618. begin
  7619. gtk_notebook_prev_page (TheGtkObject);
  7620. end;
  7621. procedure TFPgtkNotebook.ReorderPage (Child:TFPgtkWidget; PageNum:integer);
  7622. begin
  7623. gtk_notebook_reorder_child (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)), PageNum);
  7624. end;
  7625. function TFPgtkNotebook.GetPageIndex : integer;
  7626. begin
  7627. result := gtk_notebook_get_current_page(TheGtkObject);
  7628. end;
  7629. procedure TFPgtkNotebook.SetPageIndex (TheValue:integer);
  7630. begin
  7631. gtk_notebook_set_page(TheGtkObject,TheValue);
  7632. end;
  7633. function TFPgtkNotebook.GetPage : TFPgtkWidget;
  7634. begin
  7635. result := GetChildOnPage (PageIndex);
  7636. end;
  7637. procedure TFPgtkNotebook.SetPage (TheValue:TFPgtkWidget);
  7638. var r : integer;
  7639. begin
  7640. r := PageNumberOf (TheValue);
  7641. if r > -1 then
  7642. PageIndex := r;
  7643. end;
  7644. function TFPgtkNotebook.GetTabPos : TGtkPositionType;
  7645. begin
  7646. result := gtk.tab_pos(TheGtkObject^);
  7647. end;
  7648. procedure TFPgtkNotebook.SetTabPos (TheValue:TGtkPositionType);
  7649. begin
  7650. gtk_notebook_set_tab_pos(TheGtkObject,TheValue);
  7651. end;
  7652. function TFPgtkNotebook.GetShowTabs : boolean;
  7653. begin
  7654. result := boolean(gtk.show_tabs(TheGtkObject^));
  7655. end;
  7656. procedure TFPgtkNotebook.SetShowTabs (TheValue:boolean);
  7657. begin
  7658. gtk_notebook_set_show_tabs(TheGtkObject,TheValue);
  7659. end;
  7660. function TFPgtkNotebook.GetShowBorder : boolean;
  7661. begin
  7662. result := boolean(gtk.show_border(TheGtkObject^));
  7663. end;
  7664. procedure TFPgtkNotebook.SetShowBorder (TheValue:boolean);
  7665. begin
  7666. gtk_notebook_set_show_border(TheGtkObject,TheValue);
  7667. end;
  7668. function TFPgtkNotebook.GetScrollable : boolean;
  7669. begin
  7670. result := boolean(gtk.scrollable(TheGtkObject^));
  7671. end;
  7672. procedure TFPgtkNotebook.SetScrollable (TheValue:boolean);
  7673. begin
  7674. gtk_notebook_set_scrollable(TheGtkObject,TheValue);
  7675. end;
  7676. function TFPgtkNotebook.GetHomogenous : boolean;
  7677. begin
  7678. result := boolean(gtk.homogeneous(TheGtkObject^));
  7679. end;
  7680. procedure TFPgtkNotebook.SetHomogenous (TheValue:boolean);
  7681. begin
  7682. gtk_notebook_set_homogeneous_tabs(TheGtkObject,TheValue);
  7683. end;
  7684. function TFPgtkNotebook.GetTabHBorder : word;
  7685. begin
  7686. result := TheGtkObject^.tab_hborder;
  7687. end;
  7688. procedure TFPgtkNotebook.SetTabHBorder (TheValue:word);
  7689. begin
  7690. gtk_notebook_set_tab_hborder(TheGtkObject,TheValue);
  7691. end;
  7692. function TFPgtkNotebook.GetTabVBorder : word;
  7693. begin
  7694. result := TheGtkObject^.tab_vborder;
  7695. end;
  7696. procedure TFPgtkNotebook.SetTabVBorder (TheValue:word);
  7697. begin
  7698. gtk_notebook_set_tab_vborder(TheGtkObject,TheValue);
  7699. end;
  7700. procedure TFPgtkNotebook.SetTabBorders (BorderWidth:word);
  7701. begin
  7702. gtk_notebook_set_tab_border (TheGtkObject, BorderWidth);
  7703. end;
  7704. function TFPgtkNotebook.GetMenuLabelOf (Child:TFPgtkWidget) : TFPgtkWidget;
  7705. begin
  7706. result := GetPascalInstance (PGtkObject(gtk_notebook_get_menu_label (TheGtkObject, ConvertTogtkWidget(Child)))) as TFPgtkWidget;
  7707. end;
  7708. procedure TFPgtkNotebook.SetMenuLabel (Child:TFPgtkWidget; MenuLabel:TFPgtkWidget);
  7709. begin
  7710. gtk_notebook_set_menu_label (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)), PGtkwidget(ConvertToGtkObject(MenuLabel)));
  7711. end;
  7712. function TFPgtkNotebook.GetTabLabelOf (Child:TFPgtkWidget) : TFPgtkWidget;
  7713. begin
  7714. result := GetPascalInstance (PGtkObject(gtk_notebook_get_tab_label (TheGtkObject, ConvertTogtkWidget(Child)))) as TFPgtkWidget;
  7715. end;
  7716. procedure TFPgtkNotebook.SetTabLabel (Child:TFPgtkWidget; TabLabel:TFPgtkWidget);
  7717. begin
  7718. gtk_notebook_set_tab_label (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)), PGtkwidget(ConvertToGtkObject(TabLabel)));
  7719. end;
  7720. function TFPgtkNotebook.GetChildOnPage (PageNum:integer) : TFPgtkWidget;
  7721. begin
  7722. result := GetPascalInstance (PGtkObject(gtk_notebook_get_nth_page (TheGtkObject, PageNum))) as TFPgtkWidget;
  7723. end;
  7724. procedure TFPgtkNotebook.GetTabLabelPacking (Widget:TFPgtkWidget; var Expand:boolean; var Fill:boolean; var PackType:TGtkPackType);
  7725. var PT : PGtkPackType;
  7726. begin
  7727. pt := @PackType;
  7728. gtk_notebook_query_tab_label_packing (TheGtkObject, ConvertTogtkWidget(widget),
  7729. pgboolean(@expand), pgboolean(@fill), pt);
  7730. end;
  7731. procedure TFPgtkNotebook.SetTabLabelPacking (Widget:TFPgtkWidget; Expand:boolean; Fill:boolean; PackType:TGtkPackType);
  7732. begin
  7733. gtk_notebook_set_tab_label_packing (TheGtkObject, PGtkwidget(ConvertToGtkObject(Widget)), Expand, Fill, PackType);
  7734. end;
  7735. procedure TFPgtkNotebook.EnablePopup;
  7736. begin
  7737. gtk_notebook_popup_enable (TheGtkObject);
  7738. end;
  7739. procedure TFPgtkNotebook.DisablePopup;
  7740. begin
  7741. gtk_notebook_popup_disable (TheGtkObject);
  7742. end;
  7743. procedure PageSwitchSignalproc (Sender:PGtkobject; PageRec:PGtkNotebookPage; aPageNum:integer; data:pointer); cdecl;
  7744. var p : TFPgtkPageSwitchSignalFunction;
  7745. begin
  7746. with PSignalData(data)^ do
  7747. begin
  7748. p := TFPgtkPageSwitchSignalFunction (TheSignalProc);
  7749. p (TheWidget as TFPgtkObject, PageRec, aPageNum, TheData)
  7750. end;
  7751. end;
  7752. function TFPgtkNotebook.PageSwitchSignalConnect (signal:string; proc:TFPgtkPageSwitchSignalFunction; data:pointer) : guint;
  7753. begin
  7754. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@PageSwitchSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7755. end;
  7756. function TFPgtkNotebook.PageSwitchSignalConnectAfter (signal:string; proc:TFPgtkPageSwitchSignalFunction; data:pointer) : guint;
  7757. begin
  7758. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@PageSwitchSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  7759. end;
  7760. function TFPgtkNotebook.ConnectSwitchPage (proc:TFPgtkPageSwitchSignalFunction; data:pointer) : guint;
  7761. begin
  7762. result := PageSwitchSignalConnect (sgSwitchPage, proc, data);
  7763. end;
  7764. function TFPgtkNotebook.ConnectAfterSwitchPage (proc:TFPgtkPageSwitchSignalFunction; data:pointer) : guint;
  7765. begin
  7766. result := PageSwitchSignalConnectAfter (sgSwitchPage, proc, data);
  7767. end;
  7768. { TFPgtkFontSelection }
  7769. function TFPgtkFontSelection.TheGtkObject : PGtkFontSelection;
  7770. begin
  7771. result := PgtkFontSelection(FGtkObject);
  7772. end;
  7773. procedure TFPgtkFontSelection.CreateGtkObject;
  7774. begin
  7775. FGtkObject := PGtkObject(gtk_font_selection_new);
  7776. end;
  7777. function TFPgtkFontSelection.GetFontName : string;
  7778. begin
  7779. result := gtk_font_selection_get_font_name(TheGtkObject);
  7780. end;
  7781. procedure TFPgtkFontSelection.SetFontName (TheValue:string);
  7782. begin
  7783. if not gtk_font_selection_set_font_name (TheGtkObject, pgchar(TheValue)) then
  7784. raise exception.CreateFmt (sFontNotFound, [TheValue]);
  7785. end;
  7786. function TFPgtkFontSelection.GetFont : PGdkFont;
  7787. begin
  7788. result := gtk_font_selection_get_font (TheGtkObject);
  7789. end;
  7790. function TFPgtkFontSelection.GetPreviewText : string;
  7791. begin
  7792. result := gtk_font_selection_get_preview_text(TheGtkObject);
  7793. end;
  7794. procedure TFPgtkFontSelection.SetPreviewText (TheValue:string);
  7795. begin
  7796. gtk_font_selection_set_preview_text(TheGtkObject,ConvertToPgchar(TheValue));
  7797. end;
  7798. procedure TFPgtkFontSelection.SetFilter (FilterType:TGtkFontFilterType; FontType:TGtkFontType; Foundries:array of string; Weights:array of string; Slants:array of string; SetWidths:array of string; Spacings:array of string; CharSets:array of string);
  7799. var ppF, ppW, ppSl, ppSW, ppSp, ppC : ppgchar;
  7800. function MakePP (data : array of string) : ppgchar;
  7801. begin
  7802. if high(data) > low(data) then
  7803. result := ArrayToPPgchar(data)
  7804. else
  7805. result := nil;
  7806. end;
  7807. procedure FreePP (ppdata : ppgchar; data : array of string);
  7808. begin
  7809. if assigned (ppdata) then
  7810. freemem (ppdata, sizeof (pgchar) * (high(data)-low(data)+1));
  7811. end;
  7812. begin
  7813. ppF := MakePP(Foundries);
  7814. ppW := MakePP(Weights);
  7815. ppSl := MakePP(Slants);
  7816. ppSW := MakePP(SetWidths);
  7817. ppSp := MakePP(Spacings);
  7818. ppC := MakePP(CharSets);
  7819. gtk_font_selection_set_filter (TheGtkObject, FilterType, FontType, ppF, ppW, ppSl, ppSW, ppSp, ppC);
  7820. FreePP (ppF, Foundries);
  7821. FreePP (ppW, Weights);
  7822. FreePP (ppSl, Slants);
  7823. FreePP (ppSW, SetWidths);
  7824. FreePP (ppSp, Spacings);
  7825. FreePP (ppC, CharSets);
  7826. end;
  7827. { TFPgtkPaned }
  7828. function TFPgtkPaned.TheGtkObject : PGtkPaned;
  7829. begin
  7830. result := PgtkPaned(FGtkObject);
  7831. end;
  7832. function TFPgtkPaned.GetGutterSize : word;
  7833. begin
  7834. result := TheGtkObject^.gutter_size;
  7835. end;
  7836. procedure TFPgtkPaned.SetGutterSize (TheValue:word);
  7837. begin
  7838. {$ifdef gtkwin}
  7839. TheGtkObject^.gutter_size := TheValue;
  7840. {$else}
  7841. gtk_paned_set_gutter_size(TheGtkObject,TheValue);
  7842. {$endif}
  7843. end;
  7844. function TFPgtkPaned.GetHandleSize : word;
  7845. begin
  7846. result := TheGtkObject^.handle_size;
  7847. end;
  7848. procedure TFPgtkPaned.SetHandleSize (TheValue:word);
  7849. begin
  7850. gtk_paned_set_handle_size(TheGtkObject,TheValue);
  7851. end;
  7852. function TFPgtkPaned.GetPosition : integer;
  7853. begin
  7854. result := TheGtkObject^.child1_size;
  7855. end;
  7856. procedure TFPgtkPaned.SetPosition (TheValue:integer);
  7857. begin
  7858. gtk_paned_set_position(TheGtkObject,TheValue);
  7859. end;
  7860. procedure TFPgtkPaned.ComputePosition (AnAllocation:integer; Child1Req:integer; Child2Req:integer);
  7861. begin
  7862. gtk_paned_compute_position (TheGtkObject, AnAllocation, Child1Req, Child2Req);
  7863. end;
  7864. procedure TFPgtkPaned.Add1 (Child:TFPgtkWidget); Overload;
  7865. begin
  7866. gtk_paned_add1 (TheGtkObject, ConvertToGtkWidget(Child));
  7867. Child.Show;
  7868. end;
  7869. procedure TFPgtkPaned.Pack1 (Child:TFPgtkWidget; Resize:boolean; Shrink:boolean); Overload;
  7870. begin
  7871. gtk_paned_pack1 (TheGtkObject, ConvertToGtkWidget(Child), Resize, Shrink);
  7872. Child.Show;
  7873. end;
  7874. procedure TFPgtkPaned.Add1 (Child:TFPgtkWidget; isVisible:boolean); Overload;
  7875. begin
  7876. gtk_paned_add1 (TheGtkObject, ConvertToGtkWidget(Child));
  7877. if isvisible then
  7878. Child.Show;
  7879. end;
  7880. procedure TFPgtkPaned.Pack1 (Child:TFPgtkWidget; Resize:boolean; Shrink:boolean; IsVisible:boolean); Overload;
  7881. begin
  7882. gtk_paned_pack1 (TheGtkObject, ConvertToGtkWidget(Child), Resize, Shrink);
  7883. if isvisible then
  7884. Child.Show;
  7885. end;
  7886. procedure TFPgtkPaned.Add2 (Child:TFPgtkWidget); Overload;
  7887. begin
  7888. gtk_paned_add2 (TheGtkObject, ConvertToGtkWidget(Child));
  7889. Child.Show;
  7890. end;
  7891. procedure TFPgtkPaned.Pack2 (Child:TFPgtkWidget; Resize:boolean; Shrink:boolean); Overload;
  7892. begin
  7893. gtk_paned_pack2 (TheGtkObject, ConvertToGtkWidget(Child), Resize, Shrink);
  7894. Child.Show;
  7895. end;
  7896. procedure TFPgtkPaned.Add2 (Child:TFPgtkWidget; IsVisible:boolean); Overload;
  7897. begin
  7898. gtk_paned_add2 (TheGtkObject, ConvertToGtkWidget(Child));
  7899. if isvisible then
  7900. Child.Show;
  7901. end;
  7902. procedure TFPgtkPaned.Pack2 (Child:TFPgtkWidget; Resize:boolean; Shrink:boolean; IsVisible:boolean); Overload;
  7903. begin
  7904. gtk_paned_pack2 (TheGtkObject, ConvertToGtkWidget(Child), Resize, Shrink);
  7905. if isvisible then
  7906. Child.Show;
  7907. end;
  7908. { TFPgtkHPaned }
  7909. function TFPgtkHPaned.TheGtkObject : PGtkHPaned;
  7910. begin
  7911. result := PgtkHPaned(FGtkObject);
  7912. end;
  7913. procedure TFPgtkHPaned.CreateGtkObject;
  7914. begin
  7915. FGtkObject := PGtkObject(gtk_hpaned_new);
  7916. end;
  7917. { TFPgtkVPaned }
  7918. function TFPgtkVPaned.TheGtkObject : PGtkVPaned;
  7919. begin
  7920. result := PgtkVPaned(FGtkObject);
  7921. end;
  7922. procedure TFPgtkVPaned.CreateGtkObject;
  7923. begin
  7924. FGtkObject := PGtkObject(gtk_vpaned_new);
  7925. end;
  7926. { TFPgtkLayout }
  7927. function TFPgtkLayout.TheGtkObject : PGtkLayout;
  7928. begin
  7929. result := PgtkLayout(FGtkObject);
  7930. end;
  7931. procedure TFPgtkLayout.CreateGtkObject;
  7932. begin
  7933. FGtkObject := PGtkObject(gtk_layout_new (nil,nil));
  7934. end;
  7935. function TFPgtkLayout.GetHAdj : TFPgtkAdjustment;
  7936. begin
  7937. result := GetPascalInstance(PGtkObject(gtk_layout_get_hadjustment(TheGtkObject)),tfpgtkadjustment) as tfpgtkadjustment;
  7938. end;
  7939. procedure TFPgtkLayout.SetHAdj (TheValue:TFPgtkAdjustment);
  7940. begin
  7941. gtk_layout_set_hadjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  7942. end;
  7943. function TFPgtkLayout.GetVAdj : TFPgtkAdjustment;
  7944. begin
  7945. result := GetPascalInstance(PGtkObject(gtk_layout_get_vadjustment(TheGtkObject)),tfpgtkadjustment) as tfpgtkadjustment;
  7946. end;
  7947. procedure TFPgtkLayout.SetVAdj (TheValue:TFPgtkAdjustment);
  7948. begin
  7949. gtk_layout_set_vadjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  7950. end;
  7951. procedure TFPgtkLayout.Freeze;
  7952. begin
  7953. gtk_layout_freeze (TheGtkObject);
  7954. end;
  7955. procedure TFPgtkLayout.Thaw;
  7956. begin
  7957. gtk_layout_thaw (TheGtkObject);
  7958. end;
  7959. procedure TFPgtkLayout.Put (aWidget:TFPgtkWidget; X:integer; Y:integer); Overload;
  7960. begin
  7961. gtk_layout_put (TheGtkObject, PGtkwidget(ConvertToGtkObject(aWidget)), X, Y);
  7962. aWidget.Show;
  7963. end;
  7964. procedure TFPgtkLayout.Put (aWidget:TFPgtkWidget; X:integer; Y:integer; aVisible:boolean); Overload;
  7965. begin
  7966. gtk_layout_put (TheGtkObject, PGtkwidget(ConvertToGtkObject(aWidget)), X, Y);
  7967. if aVisible then
  7968. aWidget.Show;
  7969. end;
  7970. procedure TFPgtkLayout.Move (aWidget:TFPgtkWidget; X:integer; Y:integer);
  7971. begin
  7972. gtk_layout_move (TheGtkObject, PGtkwidget(ConvertToGtkObject(aWidget)), X, Y);
  7973. end;
  7974. procedure TFPgtkLayout.SetSize (aWidth:integer; aHeight:integer);
  7975. begin
  7976. gtk_layout_set_size (TheGtkObject, aWidth, aHeight);
  7977. end;
  7978. { TFPgtkList }
  7979. function TFPgtkList.TheGtkObject : PGtkList;
  7980. begin
  7981. result := PgtkList(FGtkObject);
  7982. end;
  7983. procedure TFPgtkList.CreateGtkObject;
  7984. begin
  7985. FGtkObject := PGtkObject(gtk_list_new);
  7986. end;
  7987. function TFPgtkList.ConnectSelectionChanged (proc:TFPgtksignalFunction; data:pointer) : guint;
  7988. begin
  7989. result := signalConnect (sgSelectionChanged, proc, data);
  7990. end;
  7991. function TFPgtkList.ConnectAfterSelectionChanged (proc:TFPgtksignalFunction; data:pointer) : guint;
  7992. begin
  7993. result := signalConnectAfter (sgSelectionChanged, proc, data);
  7994. end;
  7995. function TFPgtkList.ConnectSelectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  7996. begin
  7997. result := WidgetSignalConnect (sgSelectChild, proc, data);
  7998. end;
  7999. function TFPgtkList.ConnectAfterSelectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  8000. begin
  8001. result := WidgetSignalConnectAfter (sgSelectChild, proc, data);
  8002. end;
  8003. function TFPgtkList.ConnectUnselectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  8004. begin
  8005. result := WidgetSignalConnect (sgUnselectChild, proc, data);
  8006. end;
  8007. function TFPgtkList.ConnectAfterUnselectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  8008. begin
  8009. result := WidgetSignalConnectAfter (sgUnselectChild, proc, data);
  8010. end;
  8011. function TFPgtkList.GetSelectionMode : TGtkSelectionMode;
  8012. begin
  8013. result := TGtkSelectionMode(Selection_mode(TheGtkObject^));
  8014. end;
  8015. procedure TFPgtkList.SetSelectionMode (TheValue:TGtkSelectionMode);
  8016. begin
  8017. gtk_list_set_selection_mode(TheGtkObject,TheValue);
  8018. end;
  8019. procedure TFPgtkList.InsertItems (TheItems:TFPgtkListItemGroup; position:integer);
  8020. begin
  8021. gtk_list_insert_items (TheGtkObject, TheItems.GtkList, position);
  8022. end;
  8023. procedure TFPgtkList.AppendItems (TheItems:TFPgtkListItemGroup);
  8024. begin
  8025. gtk_list_append_items (TheGtkObject, TheItems.GtkList);
  8026. end;
  8027. procedure TFPgtkList.PrependItems (TheItems:TFPgtkListItemGroup);
  8028. begin
  8029. gtk_list_prepend_items (TheGtkObject, TheItems.GtkList);
  8030. end;
  8031. procedure TFPgtkList.RemoveItems (TheItems:TFPgtkListItemGroup);
  8032. begin
  8033. gtk_list_remove_items (TheGtkObject, TheItems.GtkList);
  8034. end;
  8035. procedure TFPgtkList.RemoveItemsNoUnref (TheItems:TFPgtkListItemGroup);
  8036. begin
  8037. gtk_list_remove_items_no_unref (TheGtkObject, TheItems.GtkList);
  8038. end;
  8039. procedure TFPgtkList.ClearItems (FromItem:integer; ToItem:integer);
  8040. begin
  8041. if ToItem >= 0 then
  8042. inc (ToItem);
  8043. gtk_list_clear_items (TheGtkObject, FromItem, ToItem);
  8044. end;
  8045. procedure TFPgtkList.ClearAll;
  8046. begin
  8047. ClearItems (0,-1);
  8048. end;
  8049. procedure TFPgtkList.SelectItem (Item:integer);
  8050. begin
  8051. gtk_list_select_item (TheGtkObject, Item);
  8052. end;
  8053. procedure TFPgtkList.UnselectItem (Item:integer);
  8054. begin
  8055. gtk_list_unselect_item (TheGtkObject, Item);
  8056. end;
  8057. procedure TFPgtkList.SelectChild (Child:TFPgtkWidget);
  8058. begin
  8059. gtk_list_select_child (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)));
  8060. end;
  8061. procedure TFPgtkList.UnselectChild (Child:TFPgtkWidget);
  8062. begin
  8063. gtk_list_unselect_child (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)));
  8064. end;
  8065. function TFPgtkList.ChildPosition (Child:TFPgtkWidget) : integer;
  8066. begin
  8067. result := gtk_list_child_position (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)));
  8068. end;
  8069. procedure TFPgtkList.ExtendSelection (ScrollType:TGtkScrollType; Position:gfloat; AutoStartSelection:boolean);
  8070. begin
  8071. gtk_list_extend_selection (TheGtkObject, ScrollType, Position, AutoStartSelection);
  8072. end;
  8073. procedure TFPgtkList.StartSelection;
  8074. begin
  8075. gtk_list_start_selection (TheGtkObject);
  8076. end;
  8077. procedure TFPgtkList.EndSelection;
  8078. begin
  8079. gtk_list_end_selection (TheGtkObject);
  8080. end;
  8081. procedure TFPgtkList.SelectAll;
  8082. begin
  8083. gtk_list_select_all (TheGtkObject);
  8084. end;
  8085. procedure TFPgtkList.UnselectAll;
  8086. begin
  8087. gtk_list_unselect_all (TheGtkObject);
  8088. end;
  8089. procedure TFPgtkList.ScrollHorizontal (ScrollType:TGtkScrollType; Position:gfloat);
  8090. begin
  8091. gtk_list_scroll_horizontal (TheGtkObject, ScrollType, Position);
  8092. end;
  8093. procedure TFPgtkList.ScrollVertical (ScrollType:TGtkScrollType; Position:gfloat);
  8094. begin
  8095. gtk_list_scroll_vertical (TheGtkObject, ScrollType, Position);
  8096. end;
  8097. procedure TFPgtkList.ToggleAddMode;
  8098. begin
  8099. gtk_list_toggle_add_mode (TheGtkObject);
  8100. end;
  8101. procedure TFPgtkList.ToggleFocusRow;
  8102. begin
  8103. gtk_list_toggle_focus_row (TheGtkObject);
  8104. end;
  8105. procedure TFPgtkList.ToggleRow (Child:TFPgtkWidget);
  8106. begin
  8107. gtk_list_toggle_row (TheGtkObject, PGtkwidget(ConvertToGtkObject(Child)));
  8108. end;
  8109. procedure TFPgtkList.UndoSelection;
  8110. begin
  8111. gtk_list_undo_selection (TheGtkObject);
  8112. end;
  8113. procedure TFPgtkList.EndDragSelection;
  8114. begin
  8115. gtk_list_end_drag_selection (TheGtkObject);
  8116. end;
  8117. procedure TFPgtkList.GetSelection (aGroup:TFPgtkGroup);
  8118. begin
  8119. with aGroup do
  8120. begin
  8121. ManageLists := False;
  8122. GtkList := TheGtkObject^.Selection;
  8123. end;
  8124. end;
  8125. { TFPgtkMenuShell }
  8126. function TFPgtkMenuShell.TheGtkObject : PGtkMenuShell;
  8127. begin
  8128. result := PgtkMenuShell(FGtkObject);
  8129. end;
  8130. procedure MoveCurrentSignalproc (Sender:PGtkobject; dir:TGtkMenuDirectionType; data:pointer); cdecl;
  8131. var p : TFPgtkMoveCurrentSignalFunction;
  8132. begin
  8133. with PSignalData(data)^ do
  8134. begin
  8135. p := TFPgtkMoveCurrentSignalFunction (TheSignalProc);
  8136. p (TheWidget as TFPgtkObject, dir, TheData)
  8137. end;
  8138. end;
  8139. function TFPgtkMenuShell.MoveCurrentSignalConnect (signal:string; proc:TFPgtkMoveCurrentSignalFunction; data:pointer) : guint;
  8140. begin
  8141. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@MoveCurrentSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  8142. end;
  8143. function TFPgtkMenuShell.MoveCurrentSignalConnectAfter (signal:string; proc:TFPgtkMoveCurrentSignalFunction; data:pointer) : guint;
  8144. begin
  8145. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@MoveCurrentSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  8146. end;
  8147. procedure TFPgtkMenuShell.GtkPrepend (MenuItem:TFPgtkWidget);
  8148. begin
  8149. gtk_menu_shell_prepend (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)));
  8150. end;
  8151. procedure TFPgtkMenuShell.GtkInsert (MenuItem:TFPgtkWidget; position:integer);
  8152. begin
  8153. gtk_menu_shell_insert (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)), position);
  8154. end;
  8155. procedure TFPgtkMenuShell.GtkAppend (MenuItem:TFPgtkWidget);
  8156. begin
  8157. gtk_menu_shell_append (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)));
  8158. end;
  8159. procedure TFPgtkMenuShell.ActivateItem (MenuItem:TFPgtkWidget; ForceDeactivate:boolean);
  8160. begin
  8161. gtk_menu_shell_activate_item (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)), ForceDeactivate);
  8162. end;
  8163. procedure TFPgtkMenuShell.SelectItem (MenuItem:TFPgtkWidget);
  8164. begin
  8165. gtk_menu_shell_select_item (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)));
  8166. end;
  8167. procedure TFPgtkMenuShell.DeActivate;
  8168. begin
  8169. gtk_menu_shell_deactivate (TheGtkObject);
  8170. end;
  8171. procedure TFPgtkMenuShell.Prepend (MenuItem:TFPgtkWidget); Overload;
  8172. begin
  8173. GtkPrepend (MenuItem);
  8174. MenuItem.Show;
  8175. end;
  8176. procedure TFPgtkMenuShell.Prepend (MenuItem:TFPgtkWidget; CreateVisible:boolean); Overload;
  8177. begin
  8178. GtkPrepend (MenuItem);
  8179. if createvisible then
  8180. MenuItem.Show;
  8181. end;
  8182. procedure TFPgtkMenuShell.Insert (MenuItem:TFPgtkWidget; position:integer); Overload;
  8183. begin
  8184. GtkInsert (MenuItem, position);
  8185. MenuItem.Show;
  8186. end;
  8187. procedure TFPgtkMenuShell.Insert (MenuItem:TFPgtkWidget; position:integer; CreateVisible:boolean); Overload;
  8188. begin
  8189. GtkInsert (MenuItem, position);
  8190. if createvisible then
  8191. MenuItem.Show;
  8192. end;
  8193. procedure TFPgtkMenuShell.Append (MenuItem:TFPgtkWidget); Overload;
  8194. begin
  8195. GtkAppend (MenuItem);
  8196. MenuItem.Show;
  8197. end;
  8198. procedure TFPgtkMenuShell.Append (MenuItem:TFPgtkWidget; CreateVisible:boolean); Overload;
  8199. begin
  8200. GtkAppend (MenuItem);
  8201. if createvisible then
  8202. MenuItem.Show;
  8203. end;
  8204. function TFPgtkMenuShell.ConnectDeActivate (proc:TFPgtkSignalFunction; data:pointer) : guint;
  8205. begin
  8206. result := SignalConnect (sgDeActivate, proc, data);
  8207. end;
  8208. function TFPgtkMenuShell.ConnectAfterDeActivate (proc:TFPgtkSignalFunction; data:pointer) : guint;
  8209. begin
  8210. result := SignalConnectAfter (sgDeActivate, proc, data);
  8211. end;
  8212. function TFPgtkMenuShell.ConnectSelectionDone (proc:TFPgtkSignalFunction; data:pointer) : guint;
  8213. begin
  8214. result := SignalConnect (sgSelectionDone, proc, data);
  8215. end;
  8216. function TFPgtkMenuShell.ConnectAfterSelectionDone (proc:TFPgtkSignalFunction; data:pointer) : guint;
  8217. begin
  8218. result := SignalConnectAfter (sgSelectionDone, proc, data);
  8219. end;
  8220. function TFPgtkMenuShell.ConnectCancel (proc:TFPgtkSignalFunction; data:pointer) : guint;
  8221. begin
  8222. result := SignalConnect (sgCancel, proc, data);
  8223. end;
  8224. function TFPgtkMenuShell.ConnectAfterCancel (proc:TFPgtkSignalFunction; data:pointer) : guint;
  8225. begin
  8226. result := SignalConnectAfter (sgCancel, proc, data);
  8227. end;
  8228. function TFPgtkMenuShell.ConnectMoveCurrent (proc:TFPgtkMoveCurrentSignalFunction; data:pointer) : guint;
  8229. begin
  8230. result := MoveCurrentSignalConnect (sgMoveCurrent, proc, data);
  8231. end;
  8232. function TFPgtkMenuShell.ConnectAfterMoveCurrent (proc:TFPgtkMoveCurrentSignalFunction; data:pointer) : guint;
  8233. begin
  8234. result := MoveCurrentSignalConnectAfter (sgMoveCurrent, proc, data);
  8235. end;
  8236. function TFPgtkMenuShell.ConnectActivateCurrent (proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  8237. begin
  8238. result := BooleanSignalConnect (sgActivateCurrent, proc, data);
  8239. end;
  8240. function TFPgtkMenuShell.ConnectAfterActivateCurrent (proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  8241. begin
  8242. result := BooleanSignalConnectAfter (sgActivateCurrent, proc, data);
  8243. end;
  8244. { TFPgtkMenuBar }
  8245. function TFPgtkMenuBar.TheGtkObject : PGtkMenuBar;
  8246. begin
  8247. result := PgtkMenuBar(FGtkObject);
  8248. end;
  8249. procedure TFPgtkMenuBar.CreateGtkObject;
  8250. begin
  8251. FGtkObject := PGtkObject(gtk_menu_bar_new);
  8252. end;
  8253. procedure TFPgtkMenuBar.GtkPrepend (MenuItem:TFPgtkWidget);
  8254. begin
  8255. gtk_menu_bar_prepend (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)));
  8256. end;
  8257. procedure TFPgtkMenuBar.GtkInsert (MenuItem:TFPgtkWidget; position:integer);
  8258. begin
  8259. gtk_menu_bar_insert (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)), position);
  8260. end;
  8261. procedure TFPgtkMenuBar.GtkAppend (MenuItem:TFPgtkWidget);
  8262. begin
  8263. gtk_menu_bar_append (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)));
  8264. end;
  8265. function TFPgtkMenuBar.GetShadow : TgtkShadowType;
  8266. begin
  8267. result := TheGtkObject^.shadow_type;
  8268. end;
  8269. procedure TFPgtkMenuBar.SetShadow (TheValue:TgtkShadowType);
  8270. begin
  8271. gtk_menu_bar_set_shadow_type(TheGtkObject,TheValue);
  8272. end;
  8273. { TFPgtkMenu }
  8274. function TFPgtkMenu.TheGtkObject : PGtkMenu;
  8275. begin
  8276. result := PgtkMenu(FGtkObject);
  8277. end;
  8278. procedure TFPgtkMenu.CreateGtkObject;
  8279. begin
  8280. FGtkObject := PGtkObject(gtk_menu_new);
  8281. end;
  8282. procedure TFPgtkMenu.GtkPrepend (MenuItem:TFPgtkWidget);
  8283. begin
  8284. gtk_menu_prepend (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)));
  8285. end;
  8286. procedure TFPgtkMenu.GtkInsert (MenuItem:TFPgtkWidget; position:integer);
  8287. begin
  8288. gtk_menu_insert (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)), position);
  8289. end;
  8290. procedure TFPgtkMenu.GtkAppend (MenuItem:TFPgtkWidget);
  8291. begin
  8292. gtk_menu_append (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)));
  8293. end;
  8294. procedure FPgtkMenuPos (Sender:PgtkMenu; x:pgint; y:pgint; data:pointer); Cdecl;
  8295. var p : TFPgtkMenuPosFunction;
  8296. begin
  8297. with PSignalData (data)^ do
  8298. begin
  8299. p := TFPgtkMenuPosFunction (TheSignalProc);
  8300. p(TFPgtkMenu(GetPascalInstance(PgtkObject(Sender))), x^, y^, data);
  8301. end;
  8302. end;
  8303. procedure FPgtkMenuDetacher (AttachedWidget:PgtkWidget; TheMenu:PgtkMenu); Cdecl;
  8304. var m : TFPgtkMenu;
  8305. a : TFPgtkWidget;
  8306. begin
  8307. m := (GetPascalInstance(PgtkObject(TheMenu)) as TFPgtkMenu);
  8308. if assigned(m) and assigned(m.FDetacher) then
  8309. begin
  8310. a := TFPgtkWidget (GetPascalInstance(PgtkObject(AttachedWidget)));
  8311. m.FDetacher (a, m);
  8312. end
  8313. end;
  8314. procedure TFPgtkMenu.ReorderChild (MenuItem:TFPgtkWidget; position:integer);
  8315. begin
  8316. gtk_menu_reorder_child (TheGtkObject, PGtkwidget(ConvertToGtkObject(MenuItem)), position);
  8317. end;
  8318. procedure TFPgtkMenu.Popup (button:guint); Overload;
  8319. begin
  8320. gtk_menu_popup (TheGtkObject, null, null, null, null, button, 0);
  8321. end;
  8322. procedure TFPgtkMenu.Popup (ParentShell:TFPgtkWidget; ParentItem:TFPgtkWidget; func:TFPgtkMenuPosFunction; data:pointer; button:guint; ActivateTime:guint32); Overload;
  8323. begin
  8324. gtk_menu_popup (TheGtkObject, ConvertTogtkWidget(ParentShell), ConvertTogtkWidget(ParentItem),
  8325. @FPgtkMenuPos, ConvertSignalData(TFPgtkSignalFunction(func), data, true), button, ActivateTime);
  8326. end;
  8327. procedure TFPgtkMenu.PopDown;
  8328. begin
  8329. gtk_menu_popdown (TheGtkObject);
  8330. end;
  8331. procedure TFPgtkMenu.Reposition;
  8332. begin
  8333. gtk_menu_reposition (TheGtkObject);
  8334. end;
  8335. procedure TFPgtkMenu.AttachToWidget (Widget:TFPgtkWidget; detacher:TFPgtkMenuDetachFunction);
  8336. begin
  8337. FDetacher := detacher;
  8338. gtk_menu_attach_to_widget (TheGtkObject, ConvertTogtkWidget(Widget), @FPgtkMenuDetacher);
  8339. end;
  8340. procedure TFPgtkMenu.Detach;
  8341. begin
  8342. gtk_menu_detach (TheGtkObject);
  8343. end;
  8344. procedure TFPgtkMenu.SetTitle (TheValue:string);
  8345. begin
  8346. gtk_menu_set_title(TheGtkObject,Pgchar(TheValue));
  8347. end;
  8348. function TFPgtkMenu.GetActive : TFPgtkWidget;
  8349. begin
  8350. result := GetPascalInstance(PGtkObject(gtk_menu_get_active(TheGtkObject)),tfpgtkwidget) as tfpgtkwidget;
  8351. end;
  8352. procedure TFPgtkMenu.SetActive (TheValue:TFPgtkWidget);
  8353. var r : integer;
  8354. begin
  8355. r := Children.indexof (TheValue);
  8356. if r >= 0 then
  8357. SetActiveIndex (r);
  8358. end;
  8359. function TFPgtkMenu.GetActiveIndex : integer;
  8360. begin
  8361. result := Children.indexof (GetActive);
  8362. end;
  8363. procedure TFPgtkMenu.SetActiveIndex (TheValue:integer);
  8364. begin
  8365. gtk_menu_set_active(TheGtkObject,TheValue);
  8366. end;
  8367. function TFPgtkMenu.GetTearOffState : boolean;
  8368. begin
  8369. result := boolean(gtk.torn_off(TheGtkObject^));
  8370. end;
  8371. procedure TFPgtkMenu.SetTearOffState (TheValue:boolean);
  8372. begin
  8373. gtk_menu_set_tearoff_state(TheGtkObject,TheValue);
  8374. end;
  8375. function TFPgtkMenu.GetAttachedTo : TFPgtkWidget;
  8376. begin
  8377. result := GetPascalInstance(PGtkObject(gtk_menu_get_attach_widget(TheGtkObject)),tfpgtkwidget) as tfpgtkwidget;
  8378. end;
  8379. procedure TFPgtkMenu.SetAttachedTo (TheValue:TFPgtkWidget);
  8380. begin
  8381. AttachToWidget (TheValue, nil);
  8382. end;
  8383. function TFPgtkMenu.GetAccelGroup : PGtkAccelGroup;
  8384. begin
  8385. result := gtk_menu_ensure_uline_accel_group(TheGtkObject);
  8386. end;
  8387. procedure TFPgtkMenu.SetAccelGroup (TheValue:PGtkAccelGroup);
  8388. begin
  8389. gtk_menu_set_accel_group(TheGtkObject,TheValue);
  8390. end;
  8391. { TFPgtkPacker }
  8392. function TFPgtkPacker.TheGtkObject : PGtkPacker;
  8393. begin
  8394. result := PgtkPacker(FGtkObject);
  8395. end;
  8396. procedure TFPgtkPacker.CreateGtkObject;
  8397. begin
  8398. FGtkObject := PGtkObject(gtk_packer_new);
  8399. end;
  8400. procedure TFPgtkPacker.Add (Child:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions); Overload;
  8401. begin
  8402. gtk_packer_add_defaults (TheGtkObject, Child.TheGtkWidget, Side, anchor, options);
  8403. Child.Show;
  8404. end;
  8405. procedure TFPgtkPacker.Add (Child:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions; aVisible:boolean); Overload;
  8406. begin
  8407. gtk_packer_add_defaults (TheGtkObject, Child.TheGtkWidget, Side, anchor, options);
  8408. if aVisible then
  8409. Child.Show;
  8410. end;
  8411. procedure TFPgtkPacker.Add (Child:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions; aBorder:guint; PadX:Guint; PadY:guint; IPadX:guint; IPadY:guint); Overload;
  8412. begin
  8413. gtk_packer_add (TheGtkObject, Child.TheGtkWidget, Side, anchor, options, aborder, padX, PadY, IPadX, IPadY);
  8414. Child.Show;
  8415. end;
  8416. procedure TFPgtkPacker.Add (Child:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions; aBorder:guint; PadX:Guint; PadY:guint; IPadX:guint; IPadY:guint; aVisible:boolean); Overload;
  8417. begin
  8418. gtk_packer_add (TheGtkObject, Child.TheGtkWidget, Side, anchor, options, aborder, padX, PadY, IPadX, IPadY);
  8419. if aVisible then
  8420. Child.Show;
  8421. end;
  8422. procedure TFPgtkPacker.ReorderChild (aChild:TFPgtkWidget; position:integer);
  8423. begin
  8424. gtk_packer_reorder_child (TheGtkObject, PGtkwidget(ConvertToGtkObject(aChild)), position);
  8425. end;
  8426. function TFPgtkPacker.GetSpacing : guint;
  8427. begin
  8428. result := TheGtkObject^.spacing;
  8429. end;
  8430. procedure TFPgtkPacker.SetSpacing (TheValue:guint);
  8431. begin
  8432. gtk_packer_set_spacing(TheGtkObject,TheValue);
  8433. end;
  8434. procedure TFPgtkPacker.DefaultBorder (aBorder:guint);
  8435. begin
  8436. gtk_packer_set_default_border_width (TheGtkObject, aBorder);
  8437. end;
  8438. procedure TFPgtkPacker.DefaultPad (PadX:guint; PadY:guint);
  8439. begin
  8440. gtk_packer_set_default_pad (TheGtkObject, PadX, PadY);
  8441. end;
  8442. procedure TFPgtkPacker.DefaultIPad (IPadX:guint; IPadY:guint);
  8443. begin
  8444. gtk_packer_set_default_ipad (TheGtkObject, IPadX, IPadY);
  8445. end;
  8446. procedure TFPgtkPacker.Configure (aChild:TFPgtkWidget; Side:TGtkSideType; Anchor:TGtkAnchorType; options:TGtkPackerOptions; aBorder:guint; PadX:Guint; PadY:guint; IPadX:guint; IPadY:guint); Overload;
  8447. begin
  8448. gtk_packer_set_child_packing (TheGtkObject, PGtkwidget(ConvertToGtkObject(aChild)), Side, Anchor, options, aBorder, PadX, PadY, IPadX, IPadY);
  8449. end;
  8450. { TFPgtkTable }
  8451. function TFPgtkTable.TheGtkObject : PGtkTable;
  8452. begin
  8453. result := PgtkTable(FGtkObject);
  8454. end;
  8455. procedure TFPgtkTable.CreateGtkObject;
  8456. begin
  8457. FGtkObject := PGtkObject(gtk_table_new (1,1,False));
  8458. end;
  8459. constructor TFPgtkTable.Create (AColumns:integer; ARows:integer);
  8460. begin
  8461. inherited create;
  8462. resize (AColumns, ARows);
  8463. end;
  8464. procedure TFPgtkTable.Resize (AColumns:integer; ARows:integer);
  8465. begin
  8466. gtk_table_resize (TheGtkObject, ARows, AColumns);
  8467. end;
  8468. procedure TFPgtkTable.Attach (Widget:TFPgtkWidget; left:integer; right:integer; top:integer; bottom:integer; XOptions:integer; YOptions:integer; XPadding:integer; YPadding:integer; IsVisible:boolean);
  8469. begin
  8470. gtk_table_attach (TheGtkObject, ConvertToGtkWidget(Widget), left, right, top, bottom,
  8471. XOptions, YOptions, XPadding, YPadding);
  8472. if isvisible then
  8473. widget.Show;
  8474. end;
  8475. procedure TFPgtkTable.Attach (Widget:TFPgtkWidget; left:integer; right:integer; top:integer; bottom:integer; XOptions:integer; YOptions:integer; XPadding:integer; YPadding:integer);
  8476. begin
  8477. gtk_table_attach (TheGtkObject, ConvertTogtkWidget(Widget), left, right, top, bottom,
  8478. XOptions, YOptions, XPadding, YPadding);
  8479. widget.Show;
  8480. end;
  8481. procedure TFPgtkTable.Attach (Widget:TFPgtkWidget; left:integer; right:integer; top:integer; bottom:integer; IsVisible:boolean);
  8482. begin
  8483. gtk_table_attach_defaults (TheGtkObject, ConvertTogtkWidget(Widget), left, right, top, bottom);
  8484. if isvisible then
  8485. widget.Show;
  8486. end;
  8487. procedure TFPgtkTable.Attach (Widget:TFPgtkWidget; left:integer; right:integer; top:integer; bottom:integer);
  8488. begin
  8489. gtk_table_attach_defaults (TheGtkObject, ConvertTogtkWidget(Widget), left, right, top, bottom);
  8490. widget.Show;
  8491. end;
  8492. function TFPgtkTable.GetRowCount : integer;
  8493. begin
  8494. result := TheGtkObject^.nrows;
  8495. end;
  8496. function TFPgtkTable.GetColCount : integer;
  8497. begin
  8498. result := TheGtkObject^.ncols;
  8499. end;
  8500. function TFPgtkTable.GetHomogeneous : boolean;
  8501. begin
  8502. result := boolean(gtk.homogeneous(TheGtkObject^));
  8503. end;
  8504. procedure TFPgtkTable.SetHomogeneous (TheValue:boolean);
  8505. begin
  8506. gtk_table_set_homogeneous(TheGtkObject,TheValue);
  8507. end;
  8508. function TFPgtkTable.GetRowSpacings : integer;
  8509. begin
  8510. result := TheGtkObject^.column_spacing;
  8511. end;
  8512. procedure TFPgtkTable.SetRowSpacings (TheValue:integer);
  8513. begin
  8514. gtk_table_set_row_spacings(TheGtkObject,TheValue);
  8515. end;
  8516. function TFPgtkTable.GetColSpacings : integer;
  8517. begin
  8518. result := TheGtkObject^.row_spacing;
  8519. end;
  8520. procedure TFPgtkTable.SetColSpacings (TheValue:integer);
  8521. begin
  8522. gtk_table_set_col_spacings(TheGtkObject,TheValue);
  8523. end;
  8524. procedure TFPgtkTable.SetOneRowSpacing (row:integer; TheValue:integer);
  8525. begin
  8526. gtk_table_set_row_spacing (TheGtkObject, row, TheValue);
  8527. end;
  8528. procedure TFPgtkTable.SetOneColSpacing (Column:integer; TheValue:integer);
  8529. begin
  8530. gtk_table_set_col_spacing (TheGtkObject, Column, TheValue);
  8531. end;
  8532. { TFPgtkToolbar }
  8533. function TFPgtkToolbar.TheGtkObject : PGtkToolbar;
  8534. begin
  8535. result := PgtkToolbar(FGtkObject);
  8536. end;
  8537. procedure TFPgtkToolbar.CreateGtkObject;
  8538. begin
  8539. FGtkObject := PGtkObject(gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,GTK_TOOLBAR_BOTH));
  8540. end;
  8541. function TFPgtkToolbar.GetButtonRelief : TGtkReliefStyle;
  8542. begin
  8543. result := gtk_toolbar_get_button_relief(TheGtkObject);
  8544. end;
  8545. procedure TFPgtkToolbar.SetButtonRelief (TheValue:TGtkReliefStyle);
  8546. begin
  8547. gtk_toolbar_set_button_relief(TheGtkObject,TheValue);
  8548. end;
  8549. function TFPgtkToolbar.GetTooltips : TFPgtkTooltips;
  8550. begin
  8551. result := GetPascalInstance(PGtkObject(TheGtkObject^.tooltips),tfpgtktooltips) as tfpgtktooltips;
  8552. end;
  8553. function TFPgtkToolbar.GetEnableTooltips : longbool;
  8554. begin
  8555. result := tooltips.enabled;
  8556. end;
  8557. procedure TFPgtkToolbar.SetEnableTooltips (TheValue:longbool);
  8558. begin
  8559. gtk_toolbar_set_tooltips(TheGtkObject,gint(TheValue));
  8560. end;
  8561. function TFPgtkToolbar.GetSpaceStyle : TGtkToolbarSpaceStyle;
  8562. begin
  8563. result := TheGtkObject^.space_style;
  8564. end;
  8565. procedure TFPgtkToolbar.SetSpaceStyle (TheValue:TGtkToolbarSpaceStyle);
  8566. begin
  8567. gtk_toolbar_set_space_style(TheGtkObject,TheValue);
  8568. end;
  8569. function TFPgtkToolbar.GetSpaceSize : integer;
  8570. begin
  8571. result := TheGtkObject^.space_size;
  8572. end;
  8573. procedure TFPgtkToolbar.SetSpaceSize (TheValue:integer);
  8574. begin
  8575. gtk_toolbar_set_space_size(TheGtkObject,TheValue);
  8576. end;
  8577. function TFPgtkToolbar.GetStyle : TGtkToolbarStyle;
  8578. begin
  8579. result := TheGtkObject^.style;
  8580. end;
  8581. procedure TFPgtkToolbar.SetStyle (TheValue:TGtkToolbarStyle);
  8582. begin
  8583. gtk_toolbar_set_style(TheGtkObject,TheValue);
  8584. end;
  8585. function TFPgtkToolbar.GetOrientation : tGtkOrientation;
  8586. begin
  8587. result := TheGtkObject^.orientation;
  8588. end;
  8589. procedure TFPgtkToolbar.SetOrientation (TheValue:tGtkOrientation);
  8590. begin
  8591. gtk_toolbar_set_orientation(TheGtkObject,TheValue);
  8592. end;
  8593. procedure TFPgtkToolbar.InsertWidget (Widget:TFPgtkWidget; TooltipText:string; TooltipPrivate:string; Position:integer);
  8594. begin
  8595. gtk_toolbar_insert_widget (TheGtkObject, ConvertToGtkWidget(Widget), ConvertToPgchar(TooltipText), ConvertTopgchar(TooltipPrivate), Position);
  8596. Widget.Show;
  8597. end;
  8598. procedure TFPgtkToolbar.PrependWidget (Widget:TFPgtkWidget; TooltipText:string; TooltipPrivate:string);
  8599. begin
  8600. gtk_toolbar_prepend_widget (TheGtkObject, ConvertToGtkWidget(Widget), ConvertTopgchar(TooltipText), ConvertTopgchar(TooltipPrivate));
  8601. Widget.Show;
  8602. end;
  8603. procedure TFPgtkToolbar.AppendWidget (Widget:TFPgtkWidget; TooltipText:string; TooltipPrivate:string);
  8604. begin
  8605. gtk_toolbar_append_widget (TheGtkObject, ConvertToGtkWidget(Widget), ConvertTopgchar(TooltipText), ConvertTopgchar(TooltipPrivate));
  8606. Widget.Show;
  8607. end;
  8608. function TFPgtkToolbar.InsertElement (ButtonType:TGtkToolbarChildType; PrevRadioBut:TFPgtkWidget; Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer; position:integer) : TFPgtkWidget;
  8609. var w : PGtkWidget;
  8610. t : TFPgtkObjectClass;
  8611. begin
  8612. w := gtk_toolbar_insert_element (TheGtkObject, ButtonType,
  8613. ConvertToGtkwidget(PrevRadioBut), ConvertTopgchar(Text),
  8614. ConvertTopgchar(TooltipText), ConvertTopgchar(TooltipPrivate),
  8615. ConvertToGtkwidget(Icon),
  8616. gtk_signal_func(@SignalProc),
  8617. ConvertSignalData(TFPgtkSignalFunction(callback), data, true),
  8618. position);
  8619. if assigned (w) then
  8620. begin
  8621. case ButtonType of
  8622. GTK_TOOLBAR_CHILD_WIDGET:
  8623. t := TFPgtkWidget;
  8624. GTK_TOOLBAR_CHILD_BUTTON:
  8625. t := TFPgtkButton;
  8626. GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
  8627. t := TFPgtkToggleButton;
  8628. GTK_TOOLBAR_CHILD_RADIOBUTTON:
  8629. t := TFPgtkRadioButton;
  8630. end;
  8631. if t = TFPgtkWidget then
  8632. result := GetPascalInstance (w)
  8633. else
  8634. result := GetPascalInstance (w, t);
  8635. end
  8636. else
  8637. result := nil;
  8638. end;
  8639. function TFPgtkToolbar.AppendElement (ButtonType:TGtkToolbarChildType; PrevRadioBut:TFPgtkWidget; Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget;
  8640. var w : PGtkWidget;
  8641. t : TFPgtkObjectClass;
  8642. begin
  8643. w := gtk_toolbar_append_element (TheGtkObject, ButtonType, ConvertToGtkwidget(PrevRadioBut),
  8644. ConvertTopgchar(Text), ConvertTopgchar(TooltipText), ConvertTopgchar(TooltipPrivate),
  8645. ConvertToGtkwidget(Icon), gtk_signal_func(@SignalProc),
  8646. ConvertSignalData(TFPgtkSignalFunction(callback), data, true));
  8647. if assigned (w) then
  8648. begin
  8649. case ButtonType of
  8650. GTK_TOOLBAR_CHILD_WIDGET:
  8651. t := TFPgtkWidget;
  8652. GTK_TOOLBAR_CHILD_BUTTON:
  8653. t := TFPgtkButton;
  8654. GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
  8655. t := TFPgtkToggleButton;
  8656. GTK_TOOLBAR_CHILD_RADIOBUTTON:
  8657. t := TFPgtkRadioButton;
  8658. end;
  8659. if t = TFPgtkWidget then
  8660. result := GetPascalInstance (w)
  8661. else
  8662. result := GetPascalInstance (w, t);
  8663. end
  8664. else
  8665. result := nil;
  8666. end;
  8667. function TFPgtkToolbar.PrependElement (ButtonType:TGtkToolbarChildType; PrevRadioBut:TFPgtkWidget; Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget;
  8668. var w : PGtkWidget;
  8669. t : TFPgtkObjectClass;
  8670. begin
  8671. w := gtk_toolbar_prepend_element (TheGtkObject, ButtonType, ConvertToGtkwidget(PrevRadioBut),
  8672. ConvertTopgchar(Text), ConvertTopgchar(TooltipText), ConvertTopgchar(TooltipPrivate),
  8673. ConvertToGtkwidget(Icon), gtk_signal_func(@SignalProc),
  8674. ConvertSignalData(TFPgtkSignalFunction(callback), data, true));
  8675. if assigned (w) then
  8676. begin
  8677. case ButtonType of
  8678. GTK_TOOLBAR_CHILD_WIDGET:
  8679. t := TFPgtkWidget;
  8680. GTK_TOOLBAR_CHILD_BUTTON:
  8681. t := TFPgtkButton;
  8682. GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
  8683. t := TFPgtkToggleButton;
  8684. GTK_TOOLBAR_CHILD_RADIOBUTTON:
  8685. t := TFPgtkRadioButton;
  8686. end;
  8687. if t = TFPgtkWidget then
  8688. result := GetPascalInstance (w)
  8689. else
  8690. result := GetPascalInstance (w, t);
  8691. end
  8692. else
  8693. result := nil;
  8694. end;
  8695. function TFPgtkToolbar.InsertItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer; position:integer) : TFPgtkWidget; Overload;
  8696. begin
  8697. result := GetPascalInstance (
  8698. gtk_toolbar_insert_item (TheGtkObject, ConvertTopgchar(Text), ConvertTopgchar(TooltipText), ConvertTopgchar(TooltipPrivate), ConvertToGtkWidget(Icon),
  8699. gtk_signal_func(@SignalProc), ConvertSignalData(TFPgtkSignalFunction(callback), data, true), position),
  8700. TFPgtkButton);
  8701. end;
  8702. function TFPgtkToolbar.AppendItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget; Overload;
  8703. begin
  8704. result := GetPascalInstance (
  8705. gtk_toolbar_append_item (TheGtkObject, ConvertTopgchar(Text), ConvertTopgchar(TooltipText), ConvertTopgchar(TooltipPrivate),
  8706. ConvertToGtkWidget(Icon), gtk_signal_func(@SignalProc), ConvertSignalData(TFPgtkSignalFunction(callback), data, true)),
  8707. TFPgtkButton);
  8708. end;
  8709. function TFPgtkToolbar.PrependItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:TFPgtkWidget; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget; Overload;
  8710. begin
  8711. result := GetPascalInstance (
  8712. gtk_toolbar_prepend_item (TheGtkObject, Converttopgchar(Text), Converttopgchar(TooltipText),
  8713. Converttopgchar(TooltipPrivate), ConvertToGtkWidget(Icon), gtk_signal_func(@SignalProc),
  8714. ConvertSignalData(TFPgtkSignalFunction(callback), data, true)),
  8715. TFPgtkButton);
  8716. end;
  8717. function TFPgtkToolbar.InsertItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:array of string; CallBack:TFPgtkSignalFunction; data:pointer; position:integer) : TFPgtkWidget; Overload;
  8718. var pm : TFPgtkPixmap;
  8719. begin
  8720. if low(icon) < high(icon) then
  8721. begin
  8722. pm := TFPgtkPixmap.Create;
  8723. pm.loadFromArray (icon);
  8724. end
  8725. else
  8726. pm := nil;
  8727. result := GetPascalInstance (
  8728. gtk_toolbar_insert_item (TheGtkObject, ConvertTopgchar(Text), ConvertTopgchar(TooltipText), ConvertTopgchar(TooltipPrivate), ConvertToGtkWidget(pm),
  8729. gtk_signal_func(@SignalProc), ConvertSignalData(TFPgtkSignalFunction(callback), data, true), position),
  8730. TFPgtkButton);
  8731. end;
  8732. function TFPgtkToolbar.AppendItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:array of string; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget; Overload;
  8733. var pm : TFPgtkPixmap;
  8734. begin
  8735. if low(icon) < high(icon) then
  8736. begin
  8737. pm := TFPgtkPixmap.Create;
  8738. pm.loadFromArray (icon);
  8739. end
  8740. else
  8741. pm := nil;
  8742. result := GetPascalInstance (
  8743. gtk_toolbar_append_item (TheGtkObject, ConvertTopgchar(Text), ConvertTopgchar(TooltipText), ConvertTopgchar(TooltipPrivate),
  8744. ConvertToGtkWidget(pm), gtk_signal_func(@SignalProc), ConvertSignalData(TFPgtkSignalFunction(callback), data, true)),
  8745. TFPgtkButton);
  8746. end;
  8747. function TFPgtkToolbar.PrependItem (Text:string; TooltipText:string; TooltipPrivate:string; Icon:array of string; CallBack:TFPgtkSignalFunction; data:pointer) : TFPgtkWidget; Overload;
  8748. var pm : TFPgtkPixmap;
  8749. begin
  8750. if low(icon) < high(icon) then
  8751. begin
  8752. pm := TFPgtkPixmap.Create;
  8753. pm.loadFromArray (icon);
  8754. end
  8755. else
  8756. pm := nil;
  8757. result := GetPascalInstance (
  8758. gtk_toolbar_prepend_item (TheGtkObject, Converttopgchar(Text), Converttopgchar(TooltipText),
  8759. Converttopgchar(TooltipPrivate), ConvertToGtkWidget(pm), gtk_signal_func(@SignalProc),
  8760. ConvertSignalData(TFPgtkSignalFunction(callback), data, true)),
  8761. TFPgtkButton);
  8762. end;
  8763. procedure TFPgtkToolbar.InsertSpace (position:integer);
  8764. begin
  8765. gtk_toolbar_insert_space (TheGtkObject, position);
  8766. end;
  8767. procedure TFPgtkToolbar.AppendSpace;
  8768. begin
  8769. gtk_toolbar_append_space (TheGtkObject);
  8770. end;
  8771. procedure TFPgtkToolbar.PrependSpace;
  8772. begin
  8773. gtk_toolbar_prepend_space (TheGtkObject);
  8774. end;
  8775. { TFPgtkTree }
  8776. function TFPgtkTree.TheGtkObject : PGtkTree;
  8777. begin
  8778. result := PgtkTree(FGtkObject);
  8779. end;
  8780. procedure TFPgtkTree.CreateGtkObject;
  8781. begin
  8782. FGtkObject := PGtkObject(gtk_tree_new);
  8783. end;
  8784. function TFPgtkTree.ConnectSelectionChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  8785. begin
  8786. result := SignalConnect (sgSelectionChanged, proc, data);
  8787. end;
  8788. function TFPgtkTree.ConnectAfterSelectionChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  8789. begin
  8790. result := SignalConnectAfter (sgSelectionChanged, proc, data);
  8791. end;
  8792. function TFPgtkTree.ConnectSelectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  8793. begin
  8794. result := WidgetSignalConnect (sgSelectChild, proc, data);
  8795. end;
  8796. function TFPgtkTree.ConnectAfterSelectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  8797. begin
  8798. result := WidgetSignalConnectAfter (sgSelectChild, proc, data);
  8799. end;
  8800. function TFPgtkTree.ConnectUnselectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  8801. begin
  8802. result := WidgetSignalConnect (sgUnselectChild, proc, data);
  8803. end;
  8804. function TFPgtkTree.ConnectAfterUnselectChild (proc:TFPgtkWidgetSignalFunction; data:pointer) : guint;
  8805. begin
  8806. result := WidgetSignalConnectAfter (sgUnselectChild, proc, data);
  8807. end;
  8808. function TFPgtkTree.GetSelectionMode : TGtkSelectionMode;
  8809. begin
  8810. result := gtk.selection_mode(TheGtkObject^);
  8811. end;
  8812. procedure TFPgtkTree.SetSelectionMode (TheValue:TGtkSelectionMode);
  8813. begin
  8814. gtk_tree_set_selection_mode(TheGtkObject,TheValue);
  8815. end;
  8816. function TFPgtkTree.GetViewLines : boolean;
  8817. begin
  8818. result := boolean(gtk.view_line(TheGtkObject^));
  8819. end;
  8820. procedure TFPgtkTree.SetViewLines (TheValue:boolean);
  8821. begin
  8822. gtk_tree_set_view_lines(TheGtkObject,guint(TheValue));
  8823. end;
  8824. function TFPgtkTree.GetViewMode : TGtkTreeViewMode;
  8825. begin
  8826. result := gtk.view_mode(TheGtkObject^);
  8827. end;
  8828. procedure TFPgtkTree.SetViewMode (TheValue:TGtkTreeViewMode);
  8829. begin
  8830. gtk_tree_set_view_mode(TheGtkObject,TheValue);
  8831. end;
  8832. procedure TFPgtkTree.Append (TreeItem:TFPgtkWidget);
  8833. begin
  8834. gtk_tree_append (TheGtkObject, PGtkwidget(ConvertToGtkObject(TreeItem)));
  8835. TreeItem.Show;
  8836. end;
  8837. procedure TFPgtkTree.Prepend (TreeItem:TFPgtkWidget);
  8838. begin
  8839. gtk_tree_prepend (TheGtkObject, PGtkwidget(ConvertToGtkObject(TreeItem)));
  8840. TreeItem.Show;
  8841. end;
  8842. procedure TFPgtkTree.Insert (TreeItem:TFPgtkWidget; position:integer);
  8843. begin
  8844. gtk_tree_insert (TheGtkObject, PGtkwidget(ConvertToGtkObject(TreeItem)),position);
  8845. TreeItem.show;
  8846. end;
  8847. procedure TFPgtkTree.Remove (TreeItem:TFPgtkWidget);
  8848. var l : PGList;
  8849. begin
  8850. {$ifndef win32}
  8851. gtk_tree_remove_item (TheGtkObject, ConvertToGtkWidget(TreeItem));
  8852. {$else}
  8853. l := null;
  8854. l := g_list_append (l, ConvertToGtkWidget(TreeItem));
  8855. gtk_tree_remove_items (TheGtkObject, l);
  8856. g_list_free (l);
  8857. {$endif}
  8858. end;
  8859. procedure TFPgtkTree.ClearItems (StartPos:integer; EndPos:integer);
  8860. begin
  8861. gtk_tree_clear_items (TheGtkObject, StartPos, EndPos);
  8862. end;
  8863. procedure TFPgtkTree.SelectItem (Item:integer);
  8864. begin
  8865. gtk_tree_select_item (TheGtkObject, Item);
  8866. end;
  8867. procedure TFPgtkTree.UnselectItem (Item:integer);
  8868. begin
  8869. gtk_tree_unselect_item (TheGtkObject, Item);
  8870. end;
  8871. procedure TFPgtkTree.SelectChild (TreeItem:TFPgtkWidget);
  8872. begin
  8873. gtk_tree_select_child (TheGtkObject, PGtkwidget(ConvertToGtkObject(TreeItem)));
  8874. end;
  8875. procedure TFPgtkTree.UnselectChild (TreeItem:TFPgtkWidget);
  8876. begin
  8877. gtk_tree_unselect_child (TheGtkObject, PGtkwidget(ConvertToGtkObject(TreeItem)));
  8878. end;
  8879. function TFPgtkTree.ChildPosition (TreeItem:TFPgtkWidget) : integer;
  8880. begin
  8881. result := gtk_tree_child_position (TheGtkObject, PGtkwidget(ConvertToGtkObject(TreeItem)));
  8882. end;
  8883. function TFPgtkTree.RootTree : TFPgtkTree;
  8884. begin
  8885. result := GetPascalInstance(PGtkObject(GTK_TREE_ROOT_TREE(TheGtkObject))) as TFPgtkTree;
  8886. end;
  8887. function TFPgtkTree.IsRootTree : boolean;
  8888. begin
  8889. result := GTK_IS_ROOT_TREE (TheGtkObject);
  8890. end;
  8891. procedure TFPgtkTree.GetSelection (aGroup:TFPgtkGroup);
  8892. begin
  8893. aGroup.ManageLists := false;
  8894. aGroup.GtkList := Gtk_Tree_selection (TheGtkObject);
  8895. end;
  8896. function TFPgtkTree.Level : integer;
  8897. begin
  8898. result := TheGtkObject^.level;
  8899. end;
  8900. { TFPgtkCalendar }
  8901. function TFPgtkCalendar.TheGtkObject : PGtkCalendar;
  8902. begin
  8903. result := PgtkCalendar(FGtkObject);
  8904. end;
  8905. procedure TFPgtkCalendar.CreateGtkObject;
  8906. begin
  8907. FGtkObject := PGtkObject(gtk_calendar_new);
  8908. end;
  8909. function TFPgtkCalendar.SelectMonth (aMonth:guint; aYear:guint) : integer;
  8910. begin
  8911. result := gtk_calendar_select_month (TheGtkObject, aMonth-1, aYear);
  8912. end;
  8913. procedure TFPgtkCalendar.SelectDay (aDay:guint);
  8914. begin
  8915. gtk_calendar_select_day (TheGtkObject, aDay);
  8916. end;
  8917. function TFPgtkCalendar.MarkDay (aDay:guint) : integer;
  8918. begin
  8919. result := gtk_calendar_mark_day (TheGtkObject, aDay);
  8920. end;
  8921. function TFPgtkCalendar.UnmarkDay (aDay:guint) : integer;
  8922. begin
  8923. result := gtk_calendar_unmark_day (TheGtkObject, aDay);
  8924. end;
  8925. procedure TFPgtkCalendar.ClearMarks;
  8926. begin
  8927. gtk_calendar_clear_marks (TheGtkObject);
  8928. end;
  8929. function TFPgtkCalendar.GetDisplayOptions : TGtkCalendarDisplayOptions;
  8930. begin
  8931. result := TheGtkObject^.display_flags;
  8932. end;
  8933. procedure TFPgtkCalendar.SetDisplayOptions (TheValue:TGtkCalendarDisplayOptions);
  8934. begin
  8935. gtk_calendar_display_options(TheGtkObject,TheValue);
  8936. end;
  8937. function TFPgtkCalendar.GetDate : TDatetime;
  8938. var y, m, d : guint;
  8939. begin
  8940. gtk_calendar_get_date (TheGtkObject, @y, @m, @d);
  8941. result := encodedate (y,m+1,d);
  8942. end;
  8943. procedure TFPgtkCalendar.SetDate (TheValue:TDatetime);
  8944. var y,m,d : word;
  8945. begin
  8946. decodedate (TheValue, y,m,d);
  8947. SelectMonth(m,y);
  8948. SelectDay(d);
  8949. end;
  8950. procedure TFPgtkCalendar.Freeze;
  8951. begin
  8952. gtk_calendar_freeze (TheGtkObject);
  8953. end;
  8954. procedure TFPgtkCalendar.Thaw;
  8955. begin
  8956. gtk_calendar_thaw (TheGtkObject);
  8957. end;
  8958. function TFPgtkCalendar.ConnectMonthChanged (proc:TFPgtksignalFunction; data:pointer) : guint;
  8959. begin
  8960. result := signalConnect (sgMonthChanged, proc, data);
  8961. end;
  8962. function TFPgtkCalendar.ConnectAfterMonthChanged (proc:TFPgtksignalFunction; data:pointer) : guint;
  8963. begin
  8964. result := signalConnectAfter (sgMonthChanged, proc, data);
  8965. end;
  8966. function TFPgtkCalendar.ConnectDaySelected (proc:TFPgtksignalFunction; data:pointer) : guint;
  8967. begin
  8968. result := signalConnect (sgDaySelected, proc, data);
  8969. end;
  8970. function TFPgtkCalendar.ConnectAfterDaySelected (proc:TFPgtksignalFunction; data:pointer) : guint;
  8971. begin
  8972. result := signalConnectAfter (sgDaySelected, proc, data);
  8973. end;
  8974. function TFPgtkCalendar.ConnectDaySelectedDoubleClick (proc:TFPgtksignalFunction; data:pointer) : guint;
  8975. begin
  8976. result := signalConnect (sgDaySelectedDoubleClick, proc, data);
  8977. end;
  8978. function TFPgtkCalendar.ConnectAfterDaySelectedDoubleClick (proc:TFPgtksignalFunction; data:pointer) : guint;
  8979. begin
  8980. result := signalConnectAfter (sgDaySelectedDoubleClick, proc, data);
  8981. end;
  8982. function TFPgtkCalendar.ConnectPrevMonth (proc:TFPgtksignalFunction; data:pointer) : guint;
  8983. begin
  8984. result := signalConnect (sgPrevMonth, proc, data);
  8985. end;
  8986. function TFPgtkCalendar.ConnectAfterPrevMonth (proc:TFPgtksignalFunction; data:pointer) : guint;
  8987. begin
  8988. result := signalConnectAfter (sgPrevMonth, proc, data);
  8989. end;
  8990. function TFPgtkCalendar.ConnectNextMonth (proc:TFPgtksignalFunction; data:pointer) : guint;
  8991. begin
  8992. result := signalConnect (sgNextMonth, proc, data);
  8993. end;
  8994. function TFPgtkCalendar.ConnectAfterNextMonth (proc:TFPgtksignalFunction; data:pointer) : guint;
  8995. begin
  8996. result := signalConnectAfter (sgNextMonth, proc, data);
  8997. end;
  8998. function TFPgtkCalendar.ConnectPrevYear (proc:TFPgtksignalFunction; data:pointer) : guint;
  8999. begin
  9000. result := signalConnect (sgPrevYear, proc, data);
  9001. end;
  9002. function TFPgtkCalendar.ConnectAfterPrevYear (proc:TFPgtksignalFunction; data:pointer) : guint;
  9003. begin
  9004. result := signalConnectAfter (sgPrevYear, proc, data);
  9005. end;
  9006. function TFPgtkCalendar.ConnectNextYear (proc:TFPgtksignalFunction; data:pointer) : guint;
  9007. begin
  9008. result := signalConnect (sgNextYear, proc, data);
  9009. end;
  9010. function TFPgtkCalendar.ConnectAfterNextYear (proc:TFPgtksignalFunction; data:pointer) : guint;
  9011. begin
  9012. result := signalConnectAfter (sgNextYear, proc, data);
  9013. end;
  9014. { TFPgtkDrawingArea }
  9015. function TFPgtkDrawingArea.TheGtkObject : PGtkDrawingArea;
  9016. begin
  9017. result := PgtkDrawingArea(FGtkObject);
  9018. end;
  9019. procedure TFPgtkDrawingArea.CreateGtkObject;
  9020. begin
  9021. FGtkObject := PGtkObject(gtk_drawing_area_new);
  9022. end;
  9023. procedure TFPgtkDrawingArea.SetSize (Width:integer; Height:integer);
  9024. begin
  9025. gtk_drawing_area_Size (TheGtkObject, Width, Height);
  9026. end;
  9027. { TFPgtkCurve }
  9028. function TFPgtkCurve.TheGtkObject : PGtkCurve;
  9029. begin
  9030. result := PgtkCurve(FGtkObject);
  9031. end;
  9032. procedure TFPgtkCurve.CreateGtkObject;
  9033. begin
  9034. FGtkObject := PGtkObject(gtk_curve_new);
  9035. end;
  9036. procedure TFPgtkCurve.SetRange (MinX:float; MaxX:float; MinY:float; MaxY:float);
  9037. begin
  9038. gtk_curve_set_range (TheGtkObject, MinX, MaxX, MinY, MaxY);
  9039. end;
  9040. procedure TFPgtkCurve.Reset;
  9041. begin
  9042. gtk_curve_reset (TheGtkObject);
  9043. end;
  9044. procedure TFPgtkCurve.SetGamma (GammaValue:float);
  9045. begin
  9046. gtk_curve_set_gamma (TheGtkObject, GammaValue);
  9047. end;
  9048. function TFPgtkCurve.GetCurveType : TGtkCurveType;
  9049. begin
  9050. result := TheGtkObject^.curve_type;
  9051. end;
  9052. procedure TFPgtkCurve.SetCurveType (TheValue:TGtkCurveType);
  9053. begin
  9054. gtk_curve_set_curve_type(TheGtkObject,TheValue);
  9055. end;
  9056. { TFPgtkEditable }
  9057. function TFPgtkEditable.TheGtkObject : PGtkEditable;
  9058. begin
  9059. result := PgtkEditable(FGtkObject);
  9060. end;
  9061. function TFPgtkEditable.GetHasSelection : boolean;
  9062. begin
  9063. result := SelectionStart <> SelectionEnd;
  9064. end;
  9065. function TFPgtkEditable.GetEditable : boolean;
  9066. begin
  9067. result := boolean(gtk.editable(TheGtkObject^));
  9068. end;
  9069. procedure TFPgtkEditable.SetEditable (TheValue:boolean);
  9070. begin
  9071. gtk_Editable_set_editable(TheGtkObject,TheValue);
  9072. end;
  9073. function TFPgtkEditable.GetVisible : boolean;
  9074. begin
  9075. result := boolean(gtk.visible(TheGtkObject^));
  9076. end;
  9077. procedure TFPgtkEditable.SetVisible (TheValue:boolean);
  9078. begin
  9079. gtk.Set_visible(TheGtkObject^,guint(TheValue))
  9080. end;
  9081. function TFPgtkEditable.GetPosition : integer;
  9082. begin
  9083. result := gtk_Editable_get_position(TheGtkObject);
  9084. end;
  9085. procedure TFPgtkEditable.SetPosition (TheValue:integer);
  9086. begin
  9087. gtk_Editable_set_position(TheGtkObject,TheValue);
  9088. end;
  9089. function TFPgtkEditable.GetSelectionStart : integer;
  9090. begin
  9091. result := TheGtkObject^.selection_start_pos;
  9092. end;
  9093. procedure TFPgtkEditable.SetSelectionStart (TheValue:integer);
  9094. begin
  9095. gtk_editable_select_region (TheGtkObject, TheValue, SelectionEnd);
  9096. end;
  9097. function TFPgtkEditable.GetSelectionEnd : integer;
  9098. begin
  9099. result := TheGtkObject^.Selection_end_pos;
  9100. end;
  9101. procedure TFPgtkEditable.SetSelectionEnd (TheValue:integer);
  9102. begin
  9103. gtk_editable_select_region (TheGtkObject, SelectionStart, TheValue);
  9104. end;
  9105. procedure TFPgtkEditable.SetSelection (TheValue:string);
  9106. var b : integer;
  9107. begin
  9108. if HasSelection then
  9109. begin
  9110. b := SelectionStart;
  9111. deleteText (SelectionStart, SelectionEnd);
  9112. end
  9113. else
  9114. b := position;
  9115. InsertText (TheValue, b);
  9116. Position := b + length(TheValue);
  9117. SelectRegion (b, position);
  9118. end;
  9119. function TFPgtkEditable.GetSelection : string;
  9120. var c : pgchar;
  9121. begin
  9122. c := gtk_editable_get_chars (TheGtkObject, SelectionStart, SelectionEnd);
  9123. result := string (c);
  9124. g_free (c);
  9125. end;
  9126. function TFPgtkEditable.GetText : string;
  9127. var c : pgchar;
  9128. begin
  9129. c := gtk_editable_get_chars (TheGtkObject, 0, -1);
  9130. result := string (c);
  9131. g_free (c);
  9132. end;
  9133. procedure TFPgtkEditable.Changed;
  9134. begin
  9135. gtk_Editable_Changed (TheGtkObject);
  9136. end;
  9137. procedure TFPgtkEditable.InsertText (NewText:string; AtPosition:integer);
  9138. var p : integer;
  9139. begin
  9140. p := AtPosition;
  9141. gtk_editable_insert_text (TheGtkObject, pgchar(NewText), length(NewText), @p);
  9142. end;
  9143. procedure TFPgtkEditable.DeleteText (StartPos:integer; EndPos:integer);
  9144. begin
  9145. gtk_Editable_Delete_Text (TheGtkObject, StartPos, EndPos);
  9146. end;
  9147. procedure TFPgtkEditable.GetChars (StartPos:integer; EndPos:integer);
  9148. begin
  9149. gtk_Editable_get_chars (TheGtkObject, StartPos, EndPos);
  9150. end;
  9151. procedure TFPgtkEditable.CutClipboard;
  9152. begin
  9153. gtk_Editable_cut_clipboard (TheGtkObject);
  9154. end;
  9155. procedure TFPgtkEditable.CopyClipboard;
  9156. begin
  9157. gtk_Editable_copy_clipboard (TheGtkObject);
  9158. end;
  9159. procedure TFPgtkEditable.PasteClipboard;
  9160. begin
  9161. gtk_Editable_paste_clipboard (TheGtkObject);
  9162. end;
  9163. procedure TFPgtkEditable.SelectRegion (StartPos:integer; EndPos:integer);
  9164. begin
  9165. gtk_Editable_select_region (TheGtkObject, StartPos, EndPos);
  9166. end;
  9167. procedure TFPgtkEditable.ClaimSelection (claim:boolean; time:guint32);
  9168. begin
  9169. gtk_Editable_claim_selection (TheGtkObject, claim, time);
  9170. end;
  9171. procedure TFPgtkEditable.DeleteSelection;
  9172. begin
  9173. gtk_Editable_delete_selection (TheGtkObject);
  9174. end;
  9175. procedure TFPgtkEditable.Clear;
  9176. begin
  9177. DeleteText (0,-1);
  9178. end;
  9179. procedure InsertSignalproc (Sender:PGtkobject; NewText:pgChar; TextLength:integer; var Position:integer; data:pointer); cdecl;
  9180. var p : TFPgtkInsertSignalFunction;
  9181. begin
  9182. with PSignalData(data)^ do
  9183. begin
  9184. p := TFPgtkInsertSignalFunction (TheSignalProc);
  9185. p (TheWidget as TFPgtkObject, NewText, TextLength, Position, TheData)
  9186. end;
  9187. end;
  9188. function TFPgtkEditable.InsertSignalConnect (signal:string; proc:TFPgtkInsertSignalFunction; data:pointer) : guint;
  9189. begin
  9190. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@InsertSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9191. end;
  9192. function TFPgtkEditable.InsertSignalConnectAfter (signal:string; proc:TFPgtkInsertSignalFunction; data:pointer) : guint;
  9193. begin
  9194. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@InsertSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9195. end;
  9196. procedure DeleteSignalproc (Sender:PGtkobject; StartPos:integer; EndPos:integer; data:pointer); cdecl;
  9197. var p : TFPgtkDeleteSignalFunction;
  9198. begin
  9199. with PSignalData(data)^ do
  9200. begin
  9201. p := TFPgtkDeleteSignalFunction (TheSignalProc);
  9202. p (TheWidget as TFPgtkObject, StartPos, EndPos, TheData)
  9203. end;
  9204. end;
  9205. function TFPgtkEditable.DeleteSignalConnect (signal:string; proc:TFPgtkDeleteSignalFunction; data:pointer) : guint;
  9206. begin
  9207. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@DeleteSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9208. end;
  9209. function TFPgtkEditable.DeleteSignalConnectAfter (signal:string; proc:TFPgtkDeleteSignalFunction; data:pointer) : guint;
  9210. begin
  9211. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@DeleteSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9212. end;
  9213. procedure XYSignalproc (Sender:PGtkobject; x:integer; y:integer; data:pointer); cdecl;
  9214. var p : TFPgtkXYSignalFunction;
  9215. begin
  9216. with PSignalData(data)^ do
  9217. begin
  9218. p := TFPgtkXYSignalFunction (TheSignalProc);
  9219. p (TheWidget as TFPgtkObject, x, y, TheData)
  9220. end;
  9221. end;
  9222. function TFPgtkEditable.XYSignalConnect (signal:string; proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  9223. begin
  9224. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@XYSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9225. end;
  9226. function TFPgtkEditable.XYSignalConnectAfter (signal:string; proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  9227. begin
  9228. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@XYSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9229. end;
  9230. procedure DirectionSignalproc (Sender:PGtkobject; Direction:integer; data:pointer); cdecl;
  9231. var p : TFPgtkDirectionSignalFunction;
  9232. begin
  9233. with PSignalData(data)^ do
  9234. begin
  9235. p := TFPgtkDirectionSignalFunction (TheSignalProc);
  9236. p (TheWidget as TFPgtkObject, Direction, TheData)
  9237. end;
  9238. end;
  9239. function TFPgtkEditable.DirectionSignalConnect (signal:string; proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  9240. begin
  9241. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@DirectionSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9242. end;
  9243. function TFPgtkEditable.DirectionSignalConnectAfter (signal:string; proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  9244. begin
  9245. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@DirectionSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9246. end;
  9247. procedure MoveWordSignalproc (Sender:PGtkobject; NumWords:integer; data:pointer); cdecl;
  9248. var p : TFPgtkMoveWordSignalFunction;
  9249. begin
  9250. with PSignalData(data)^ do
  9251. begin
  9252. p := TFPgtkMoveWordSignalFunction (TheSignalProc);
  9253. p (TheWidget as TFPgtkObject, NumWords, TheData)
  9254. end;
  9255. end;
  9256. function TFPgtkEditable.MoveWordSignalConnect (signal:string; proc:TFPgtkMoveWordSignalFunction; data:pointer) : guint;
  9257. begin
  9258. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@MoveWordSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9259. end;
  9260. function TFPgtkEditable.MoveWordSignalConnectAfter (signal:string; proc:TFPgtkMoveWordSignalFunction; data:pointer) : guint;
  9261. begin
  9262. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@MoveWordSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9263. end;
  9264. procedure MovetoSignalproc (Sender:PGtkobject; MoveTo:integer; data:pointer); cdecl;
  9265. var p : TFPgtkMovetoSignalFunction;
  9266. begin
  9267. with PSignalData(data)^ do
  9268. begin
  9269. p := TFPgtkMovetoSignalFunction (TheSignalProc);
  9270. p (TheWidget as TFPgtkObject, MoveTo, TheData)
  9271. end;
  9272. end;
  9273. function TFPgtkEditable.MovetoSignalConnect (signal:string; proc:TFPgtkMovetoSignalFunction; data:pointer) : guint;
  9274. begin
  9275. result := gtk_signal_connect (FGtkObject, pgChar(signal), gtk_signal_func(@MovetoSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9276. end;
  9277. function TFPgtkEditable.MovetoSignalConnectAfter (signal:string; proc:TFPgtkMovetoSignalFunction; data:pointer) : guint;
  9278. begin
  9279. result := gtk_signal_connect_After (FGtkObject, pgChar(signal), gtk_signal_func(@MovetoSignalproc), ConvertSignalData(TFPgtkSignalFunction(proc), data, true));
  9280. end;
  9281. function TFPgtkEditable.ConnectChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9282. begin
  9283. result := SignalConnect (sgChanged, proc, data);
  9284. end;
  9285. function TFPgtkEditable.ConnectAfterChanged (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9286. begin
  9287. result := SignalConnectAfter (sgChanged, proc, data);
  9288. end;
  9289. function TFPgtkEditable.ConnectActivate (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9290. begin
  9291. result := SignalConnect (sgActivate, proc, data);
  9292. end;
  9293. function TFPgtkEditable.ConnectAfterActivate (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9294. begin
  9295. result := SignalConnectAfter (sgActivate, proc, data);
  9296. end;
  9297. function TFPgtkEditable.ConnectInsertText (proc:TFPgtkInsertSignalFunction; data:pointer) : guint;
  9298. begin
  9299. result := InsertSignalConnect (sgInsertText, proc, data);
  9300. end;
  9301. function TFPgtkEditable.ConnectAfterInsertText (proc:TFPgtkInsertSignalFunction; data:pointer) : guint;
  9302. begin
  9303. result := InsertSignalConnectAfter (sgInsertText, proc, data);
  9304. end;
  9305. function TFPgtkEditable.ConnectDeleteText (proc:TFPgtkDeleteSignalFunction; data:pointer) : guint;
  9306. begin
  9307. result := DeleteSignalConnect (sgDeleteText, proc, data);
  9308. end;
  9309. function TFPgtkEditable.ConnectAfterDeleteText (proc:TFPgtkDeleteSignalFunction; data:pointer) : guint;
  9310. begin
  9311. result := DeleteSignalConnectAfter (sgDeleteText, proc, data);
  9312. end;
  9313. function TFPgtkEditable.ConnectSetEditable (proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  9314. begin
  9315. result := BooleanSignalConnect (sgSetEditable, proc, data);
  9316. end;
  9317. function TFPgtkEditable.ConnectAfterSetEditable (proc:TFPgtkBooleanSignalFunction; data:pointer) : guint;
  9318. begin
  9319. result := BooleanSignalConnectAfter (sgSetEditable, proc, data);
  9320. end;
  9321. function TFPgtkEditable.ConnectMoveCursor (proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  9322. begin
  9323. result := XYSignalConnect (sgMoveCursor, proc, data);
  9324. end;
  9325. function TFPgtkEditable.ConnectAfterMoveCursor (proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  9326. begin
  9327. result := XYSignalConnectAfter (sgMoveCursor, proc, data);
  9328. end;
  9329. function TFPgtkEditable.ConnectMoveWord (proc:TFPgtkMoveWordSignalFunction; data:pointer) : guint;
  9330. begin
  9331. result := MoveWordSignalConnect (sgMoveWord, proc, data);
  9332. end;
  9333. function TFPgtkEditable.ConnectAfterMoveWord (proc:TFPgtkMoveWordSignalFunction; data:pointer) : guint;
  9334. begin
  9335. result := MoveWordSignalConnectAfter (sgMoveWord, proc, data);
  9336. end;
  9337. function TFPgtkEditable.ConnectMovePage (proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  9338. begin
  9339. result := XYSignalConnect (sgMovePage, proc, data);
  9340. end;
  9341. function TFPgtkEditable.ConnectAfterMovePage (proc:TFPgtkXYSignalFunction; data:pointer) : guint;
  9342. begin
  9343. result := XYSignalConnectAfter (sgMovePage, proc, data);
  9344. end;
  9345. function TFPgtkEditable.ConnectMoveToRow (proc:TFPgtkMoveToSignalFunction; data:pointer) : guint;
  9346. begin
  9347. result := MoveToSignalConnect (sgMoveToRow, proc, data);
  9348. end;
  9349. function TFPgtkEditable.ConnectAfterMoveToRow (proc:TFPgtkMoveToSignalFunction; data:pointer) : guint;
  9350. begin
  9351. result := MoveToSignalConnectAfter (sgMoveToRow, proc, data);
  9352. end;
  9353. function TFPgtkEditable.ConnectMoveToCol (proc:TFPgtkMoveToSignalFunction; data:pointer) : guint;
  9354. begin
  9355. result := MoveToSignalConnect (sgMoveToCol, proc, data);
  9356. end;
  9357. function TFPgtkEditable.ConnectAfterMoveToCol (proc:TFPgtkMoveToSignalFunction; data:pointer) : guint;
  9358. begin
  9359. result := MoveToSignalConnectAfter (sgMoveToCol, proc, data);
  9360. end;
  9361. function TFPgtkEditable.ConnectKillChar (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  9362. begin
  9363. result := DirectionSignalConnect (sgKillChar, proc, data);
  9364. end;
  9365. function TFPgtkEditable.ConnectAfterKillChar (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  9366. begin
  9367. result := DirectionSignalConnectAfter (sgKillChar, proc, data);
  9368. end;
  9369. function TFPgtkEditable.ConnectKillWord (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  9370. begin
  9371. result := DirectionSignalConnect (sgKillWord, proc, data);
  9372. end;
  9373. function TFPgtkEditable.ConnectAfterKillWord (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  9374. begin
  9375. result := DirectionSignalConnectAfter (sgKillWord, proc, data);
  9376. end;
  9377. function TFPgtkEditable.ConnectKillLine (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  9378. begin
  9379. result := DirectionSignalConnect (sgKillLine, proc, data);
  9380. end;
  9381. function TFPgtkEditable.ConnectAfterKillLine (proc:TFPgtkDirectionSignalFunction; data:pointer) : guint;
  9382. begin
  9383. result := DirectionSignalConnectAfter (sgKillLine, proc, data);
  9384. end;
  9385. function TFPgtkEditable.ConnectCutClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9386. begin
  9387. result := SignalConnect (sgCutClipboard, proc, data);
  9388. end;
  9389. function TFPgtkEditable.ConnectAfterCutClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9390. begin
  9391. result := SignalConnectAfter (sgCutClipboard, proc, data);
  9392. end;
  9393. function TFPgtkEditable.ConnectCopyClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9394. begin
  9395. result := SignalConnect (sgCopyClipboard, proc, data);
  9396. end;
  9397. function TFPgtkEditable.ConnectAfterCopyClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9398. begin
  9399. result := SignalConnectAfter (sgCopyClipboard, proc, data);
  9400. end;
  9401. function TFPgtkEditable.ConnectPasteClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9402. begin
  9403. result := SignalConnect (sgPasteClipboard, proc, data);
  9404. end;
  9405. function TFPgtkEditable.ConnectAfterPasteClipboard (proc:TFPgtkSignalFunction; data:pointer) : guint;
  9406. begin
  9407. result := SignalConnectAfter (sgPasteClipboard, proc, data);
  9408. end;
  9409. { TFPgtkEntry }
  9410. function TFPgtkEntry.TheGtkObject : PGtkEntry;
  9411. begin
  9412. result := PgtkEntry(FGtkObject);
  9413. end;
  9414. procedure TFPgtkEntry.CreateGtkObject;
  9415. begin
  9416. FGtkObject := PGtkObject(gtk_Entry_new);
  9417. end;
  9418. procedure TFPgtkEntry.SetText (TheValue:string);
  9419. begin
  9420. gtk_Entry_set_text (TheGtkObject, Pgchar(TheValue));
  9421. end;
  9422. procedure TFPgtkEntry.AppendText (aText:string);
  9423. begin
  9424. gtk_Entry_append_text (TheGtkObject, ConvertToPgchar(aText));
  9425. end;
  9426. procedure TFPgtkEntry.PrependText (aText:string);
  9427. begin
  9428. gtk_Entry_prepend_text (TheGtkObject, ConvertToPgchar(aText));
  9429. end;
  9430. function TFPgtkEntry.GetVisibility : boolean;
  9431. begin
  9432. result := boolean(gtk.visible(TheGtkObject^));
  9433. end;
  9434. procedure TFPgtkEntry.SetVisibility (TheValue:boolean);
  9435. begin
  9436. gtk_Entry_set_visibility(TheGtkObject,TheValue);
  9437. end;
  9438. function TFPgtkEntry.GetMaxLength : word;
  9439. begin
  9440. result := TheGtkObject^.text_max_length;
  9441. end;
  9442. procedure TFPgtkEntry.SetMaxLength (TheValue:word);
  9443. begin
  9444. gtk_Entry_set_max_length(TheGtkObject,TheValue);
  9445. end;
  9446. { TFPgtkSpinButton }
  9447. function TFPgtkSpinButton.TheGtkObject : PGtkSpinButton;
  9448. begin
  9449. result := PgtkSpinButton(FGtkObject);
  9450. end;
  9451. procedure TFPgtkSpinButton.CreateGtkObject;
  9452. begin
  9453. FGtkObject := PGtkObject(gtk_spin_button_new (TFPgtkAdjustment.Create.TheGtkObject,1,0));
  9454. end;
  9455. procedure TFPgtkSpinButton.Configure (Adj:TFPgtkAdjustment; aClimbRate:gfloat; aDigits:integer);
  9456. begin
  9457. if assigned (Adj) then
  9458. gtk_spin_button_configure (TheGtkObject, PGtkadjustment(Adj.TheGtkObject), aClimbRate, aDigits)
  9459. else
  9460. gtk_spin_button_configure (TheGtkObject, nil, aClimbRate, aDigits);
  9461. end;
  9462. function TFPgtkSpinButton.GetAdjustment : TFPgtkAdjustment;
  9463. begin
  9464. result := GetPascalInstance(PGtkObject(gtk_spin_button_get_adjustment(TheGtkObject)),TFPGtkAdjustment) as TFPgtkAdjustment;
  9465. end;
  9466. procedure TFPgtkSpinButton.SetAdjustment (TheValue:TFPgtkAdjustment);
  9467. begin
  9468. gtk_spin_button_set_adjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  9469. end;
  9470. function TFPgtkSpinButton.GetClimbRate : gfloat;
  9471. begin
  9472. result := TheGtkObject^.climb_rate;
  9473. end;
  9474. procedure TFPgtkSpinButton.SetClimbRate (TheValue:gfloat);
  9475. begin
  9476. TheGtkObject^.climb_rate := TheValue;
  9477. end;
  9478. function TFPgtkSpinButton.GetDigits : integer;
  9479. begin
  9480. result := gtk.digits(TheGtkObject^);
  9481. end;
  9482. procedure TFPgtkSpinButton.SetDigits (TheValue:integer);
  9483. begin
  9484. gtk_spin_button_set_digits(TheGtkObject,TheValue);
  9485. end;
  9486. function TFPgtkSpinButton.GetAsInteger : integer;
  9487. begin
  9488. result := gtk_spin_button_get_value_as_int(TheGtkObject);
  9489. end;
  9490. procedure TFPgtkSpinButton.SetAsInteger (TheValue:integer);
  9491. begin
  9492. gtk_spin_button_set_Value(TheGtkObject,TheValue);
  9493. end;
  9494. function TFPgtkSpinButton.GetAsFloat : gfloat;
  9495. begin
  9496. result := gtk_spin_button_get_value_as_int(TheGtkObject);
  9497. end;
  9498. procedure TFPgtkSpinButton.SetAsFloat (TheValue:gfloat);
  9499. begin
  9500. gtk_spin_button_set_Value(TheGtkObject,TheValue);
  9501. end;
  9502. function TFPgtkSpinButton.GetUpdatePolicy : TGtkSpinButtonUpdatePolicy;
  9503. begin
  9504. result := TheGtkObject^.update_policy;
  9505. end;
  9506. procedure TFPgtkSpinButton.SetUpdatePolicy (TheValue:TGtkSpinButtonUpdatePolicy);
  9507. begin
  9508. gtk_spin_button_set_update_policy(TheGtkObject,TheValue);
  9509. end;
  9510. function TFPgtkSpinButton.GetNumeric : boolean;
  9511. begin
  9512. result := boolean(gtk.numeric(TheGtkObject^));
  9513. end;
  9514. procedure TFPgtkSpinButton.SetNumeric (TheValue:boolean);
  9515. begin
  9516. gtk_spin_button_set_numeric(TheGtkObject,TheValue);
  9517. end;
  9518. procedure TFPgtkSpinButton.Spin (direction:TGtkSpinType; increment:gfloat);
  9519. begin
  9520. gtk_spin_button_spin (TheGtkObject, direction, increment);
  9521. end;
  9522. function TFPgtkSpinButton.GetWrap : boolean;
  9523. begin
  9524. result := boolean(gtk.wrap(TheGtkObject^));
  9525. end;
  9526. procedure TFPgtkSpinButton.SetWrap (TheValue:boolean);
  9527. begin
  9528. gtk_spin_button_set_wrap(TheGtkObject,TheValue);
  9529. end;
  9530. function TFPgtkSpinButton.GetShadowType : TGtkShadowType;
  9531. begin
  9532. result := TheGtkObject^.shadow_type;
  9533. end;
  9534. procedure TFPgtkSpinButton.SetShadowType (TheValue:TGtkShadowType);
  9535. begin
  9536. gtk_spin_button_set_shadow_type(TheGtkObject,TheValue);
  9537. end;
  9538. function TFPgtkSpinButton.GetSnapToTicks : boolean;
  9539. begin
  9540. result := boolean(gtk.snap_to_ticks(TheGtkObject^));
  9541. end;
  9542. procedure TFPgtkSpinButton.SetSnapToTicks (TheValue:boolean);
  9543. begin
  9544. gtk_spin_button_set_snap_to_ticks(TheGtkObject,TheValue);
  9545. end;
  9546. procedure TFPgtkSpinButton.Update;
  9547. begin
  9548. gtk_spin_button_update (TheGtkObject);
  9549. end;
  9550. { TFPgtkText }
  9551. function TFPgtkText.TheGtkObject : PGtkText;
  9552. begin
  9553. result := PgtkText(FGtkObject);
  9554. end;
  9555. procedure TFPgtkText.CreateGtkObject;
  9556. begin
  9557. FGtkObject := PGtkObject(gtk_Text_new (null,null));
  9558. end;
  9559. constructor TFPgtkText.Create;
  9560. begin
  9561. inherited create;
  9562. editable := true;
  9563. wordwrap := true;
  9564. linewrap := true;
  9565. FLines := TStringlist.Create;
  9566. ConnectChanged (@SigChanged, nil);
  9567. end;
  9568. destructor TFPgtkText.Destroy;
  9569. begin
  9570. FLines.Free;
  9571. inherited;
  9572. end;
  9573. procedure TFPgtkText.SigChanged (Sender:TFPgtkObject; data:pointer);
  9574. begin
  9575. FIsChanged := True;
  9576. end;
  9577. procedure TFPgtkText.RefreshLines;
  9578. begin
  9579. if not assigned (FLines) then
  9580. FLines := TStringlist.Create;
  9581. FLines.Text := Text;
  9582. end;
  9583. function TFPgtkText.GetLines : TStrings;
  9584. begin
  9585. if FIsChanged then
  9586. RefreshLines;
  9587. result := FLines;
  9588. end;
  9589. procedure TFPgtkText.Freeze;
  9590. begin
  9591. gtk_Text_Freeze (TheGtkObject);
  9592. end;
  9593. procedure TFPgtkText.Thaw;
  9594. begin
  9595. gtk_Text_Thaw (TheGtkObject);
  9596. end;
  9597. function TFPgtkText.TextLength : guint;
  9598. begin
  9599. result := gtk_Text_get_length (TheGtkObject);
  9600. end;
  9601. procedure TFPgtkText.Insert (font:PgdkFont; fore:PgdkColor; back:PgdkColor; TheText:string);
  9602. begin
  9603. gtk_text_insert (TheGtkObject, font, fore, back, pgchar(TheText), length(TheText));
  9604. end;
  9605. procedure TFPgtkText.DeleteBackward (number:longword);
  9606. begin
  9607. gtk_Text_Backward_Delete (TheGtkObject, number);
  9608. end;
  9609. procedure TFPgtkText.DeleteForward (number:longword);
  9610. begin
  9611. gtk_Text_Forward_Delete (TheGtkObject, number);
  9612. end;
  9613. function TFPgtkText.GetWordWrap : boolean;
  9614. begin
  9615. result := boolean(gtk.word_wrap(TheGtkObject^));
  9616. end;
  9617. procedure TFPgtkText.SetWordWrap (TheValue:boolean);
  9618. begin
  9619. gtk_text_set_word_wrap (TheGtkObject,gint(TheValue));
  9620. end;
  9621. function TFPgtkText.GetLineWrap : boolean;
  9622. begin
  9623. result := boolean(gtk.Line_Wrap(TheGtkObject^));
  9624. end;
  9625. procedure TFPgtkText.SetLineWrap (TheValue:boolean);
  9626. begin
  9627. {$IFDEF win32 or go32v2}
  9628. Set_Line_Wrap (TheGtkObject^, gint(TheValue));
  9629. {$ELSE}
  9630. gtk_Text_Set_Line_Wrap (TheGtkObject, gint(TheValue));
  9631. {$ENDIF}
  9632. end;
  9633. function TFPgtkText.GetPoint : integer;
  9634. begin
  9635. result := gtk_Text_get_Point(TheGtkObject);
  9636. end;
  9637. procedure TFPgtkText.SetPoint (TheValue:integer);
  9638. begin
  9639. gtk_Text_set_Point(TheGtkObject,TheValue);
  9640. end;
  9641. procedure TFPgtkText.SetAdjustments (hadj:TFPgtkAdjustment; vadj:TFPgtkAdjustment);
  9642. begin
  9643. gtk_text_set_adjustments (TheGtkObject, hadj.TheGtkObject, vadj.TheGtkObject);
  9644. end;
  9645. function TFPgtkText.GetHAdjustment : TFPgtkAdjustment;
  9646. begin
  9647. result := GetPascalInstance(PGtkObject(TheGtkObject^.hadj),tfpgtkadjustment) as tfpgtkadjustment;
  9648. end;
  9649. procedure TFPgtkText.SetHAdjustment (TheValue:TFPgtkAdjustment);
  9650. begin
  9651. gtk_Text_Set_Adjustments(TheGtkObject, TheValue.TheGtkObject, TheGtkObject^.vadj);
  9652. end;
  9653. function TFPgtkText.GetVAdjustment : TFPgtkAdjustment;
  9654. begin
  9655. result := GetPascalInstance(PGtkObject(TheGtkObject^.vadj),tfpgtkadjustment) as tfpgtkadjustment;
  9656. end;
  9657. procedure TFPgtkText.SetVAdjustment (TheValue:TFPgtkAdjustment);
  9658. begin
  9659. gtk_Text_Set_Adjustments(TheGtkObject, TheGtkObject^.hadj, TheValue.TheGtkObject);
  9660. end;
  9661. procedure TFPgtkText.SetText (TheValue:string);
  9662. begin
  9663. Freeze;
  9664. {$ifdef gtkwin}
  9665. TheValue := stringreplace (TheValue, #13#10, #10, [rfReplaceAll]);
  9666. {$endif}
  9667. clear;
  9668. Insert (null, null, null, TheValue);
  9669. Thaw;
  9670. end;
  9671. { TFPgtkRuler }
  9672. function TFPgtkRuler.TheGtkObject : PGtkRuler;
  9673. begin
  9674. result := PgtkRuler(FGtkObject);
  9675. end;
  9676. procedure TFPgtkRuler.SetMetric (aMetric:TGtkMetricType);
  9677. begin
  9678. gtk_ruler_set_metric (TheGtkObject, aMetric);
  9679. end;
  9680. procedure TFPgtkRuler.SetRange (Lower:float; Upper:float; Position:float; MaxSize:float);
  9681. begin
  9682. gtk_ruler_set_range (TheGtkObject, Lower, Upper, Position, MaxSize);
  9683. end;
  9684. { TFPgtkHRuler }
  9685. function TFPgtkHRuler.TheGtkObject : PGtkHRuler;
  9686. begin
  9687. result := PgtkHRuler(FGtkObject);
  9688. end;
  9689. procedure TFPgtkHRuler.CreateGtkObject;
  9690. begin
  9691. FGtkObject := PGtkObject(gtk_hruler_new);
  9692. end;
  9693. { TFPgtkVRuler }
  9694. function TFPgtkVRuler.TheGtkObject : PGtkVRuler;
  9695. begin
  9696. result := PgtkVRuler(FGtkObject);
  9697. end;
  9698. procedure TFPgtkVRuler.CreateGtkObject;
  9699. begin
  9700. FGtkObject := PGtkObject(gtk_vruler_new);
  9701. end;
  9702. { TFPgtkRange }
  9703. function TFPgtkRange.TheGtkObject : PGtkRange;
  9704. begin
  9705. result := PgtkRange(FGtkObject);
  9706. end;
  9707. function TFPgtkRange.GetAdjustment : TFPgtkAdjustment;
  9708. begin
  9709. result := GetPascalInstance(PGtkObject(gtk_Range_get_Adjustment(TheGtkObject)),tfpgtkadjustment) as tfpgtkadjustment;
  9710. end;
  9711. procedure TFPgtkRange.SetAdjustment (TheValue:TFPgtkAdjustment);
  9712. begin
  9713. gtk_Range_set_adjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  9714. end;
  9715. function TFPgtkRange.GetUpdatePolicy : TgtkUpdateType;
  9716. begin
  9717. result := gtk.policy(TheGtkObject^);
  9718. end;
  9719. procedure TFPgtkRange.SetUpdatePolicy (TheValue:TgtkUpdateType);
  9720. begin
  9721. gtk_Range_set_update_policy(TheGtkObject,TheValue);
  9722. end;
  9723. constructor TFPgtkRange.Create (AnAdjustment:TFPgtkAdjustment);
  9724. begin
  9725. FAdj := AnAdjustment;
  9726. inherited create;
  9727. end;
  9728. procedure TFPgtkRange.DrawBackground;
  9729. begin
  9730. gtk_Range_draw_background (TheGtkObject);
  9731. end;
  9732. procedure TFPgtkRange.DrawTrough;
  9733. begin
  9734. gtk_Range_draw_trough (TheGtkObject);
  9735. end;
  9736. procedure TFPgtkRange.DrawStepForw;
  9737. begin
  9738. gtk_Range_draw_step_forw (TheGtkObject);
  9739. end;
  9740. procedure TFPgtkRange.DrawStepBack;
  9741. begin
  9742. gtk_Range_draw_step_back (TheGtkObject);
  9743. end;
  9744. procedure TFPgtkRange.DrawSlider;
  9745. begin
  9746. gtk_Range_draw_slider (TheGtkObject);
  9747. end;
  9748. procedure TFPgtkRange.SliderUpdate;
  9749. begin
  9750. gtk_Range_slider_update (TheGtkObject);
  9751. end;
  9752. function TFPgtkRange.TroughClick (X:integer; Y:integer; var JumpPerc:gfloat) : integer;
  9753. begin
  9754. result := gtk_Range_trough_click (TheGtkObject, X, Y, @JumpPerc);
  9755. end;
  9756. procedure TFPgtkRange.DefaultHSliderUpdate;
  9757. begin
  9758. gtk_Range_default_hslider_update (TheGtkObject);
  9759. end;
  9760. procedure TFPgtkRange.DefaultVSliderUpdate;
  9761. begin
  9762. gtk_Range_default_vslider_update (TheGtkObject);
  9763. end;
  9764. function TFPgtkRange.DefaultHTroughClick (X:integer; Y:integer; var JumpPerc:gfloat) : integer;
  9765. begin
  9766. result := gtk_Range_default_htrough_click (TheGtkObject, X, Y, @JumpPerc);
  9767. end;
  9768. function TFPgtkRange.DefaultVTroughClick (X:integer; Y:integer; var JumpPerc:gfloat) : integer;
  9769. begin
  9770. result := gtk_Range_default_vtrough_click (TheGtkObject, X, Y, @JumpPerc);
  9771. end;
  9772. procedure TFPgtkRange.defaultHMotion (XDelta:integer; YDelta:integer);
  9773. begin
  9774. gtk_Range_default_hmotion (TheGtkObject, XDelta, YDelta);
  9775. end;
  9776. procedure TFPgtkRange.defaultVMotion (XDelta:integer; YDelta:integer);
  9777. begin
  9778. gtk_Range_default_vmotion (TheGtkObject, XDelta, YDelta);
  9779. end;
  9780. procedure TFPgtkRange.ClearBackground;
  9781. begin
  9782. gtk_Range_clear_background (TheGtkObject);
  9783. end;
  9784. { TFPgtkScale }
  9785. function TFPgtkScale.TheGtkObject : PGtkScale;
  9786. begin
  9787. result := PgtkScale(FGtkObject);
  9788. end;
  9789. procedure TFPgtkScale.SetDigits (TheValue:integer);
  9790. begin
  9791. gtk_scale_set_digits (TheGtkObject, TheValue);
  9792. end;
  9793. function TFPgtkScale.GetDrawValue : boolean;
  9794. begin
  9795. result := boolean(gtk.draw_value(TheGtkObject^));
  9796. end;
  9797. procedure TFPgtkScale.SetDrawValue (TheValue:boolean);
  9798. begin
  9799. gtk_scale_set_draw_value(TheGtkObject,TheValue);
  9800. end;
  9801. function TFPgtkScale.GetValuePos : TGtkPositionType;
  9802. begin
  9803. result := gtk.value_pos(TheGtkObject^);
  9804. end;
  9805. procedure TFPgtkScale.SetValuePos (TheValue:TGtkPositionType);
  9806. begin
  9807. gtk_scale_set_value_pos(TheGtkObject,TheValue);
  9808. end;
  9809. { TFPgtkHScale }
  9810. function TFPgtkHScale.TheGtkObject : PGtkHScale;
  9811. begin
  9812. result := PgtkHScale(FGtkObject);
  9813. end;
  9814. procedure TFPgtkHScale.CreateGtkObject;
  9815. begin
  9816. FGtkObject := PGtkObject(gtk_hscale_new (nil));
  9817. end;
  9818. { TFPgtkVScale }
  9819. function TFPgtkVScale.TheGtkObject : PGtkVScale;
  9820. begin
  9821. result := PgtkVScale(FGtkObject);
  9822. end;
  9823. procedure TFPgtkVScale.CreateGtkObject;
  9824. begin
  9825. FGtkObject := PGtkObject(gtk_vscale_new (nil));
  9826. end;
  9827. { TFPgtkScrollbar }
  9828. function TFPgtkScrollbar.TheGtkObject : PGtkScrollbar;
  9829. begin
  9830. result := PgtkScrollbar(FGtkObject);
  9831. end;
  9832. { TFPgtkHScrollbar }
  9833. function TFPgtkHScrollbar.TheGtkObject : PGtkHScrollbar;
  9834. begin
  9835. result := PgtkHScrollbar(FGtkObject);
  9836. end;
  9837. procedure TFPgtkHScrollbar.CreateGtkObject;
  9838. var a : PgtkAdjustment;
  9839. begin
  9840. if assigned (FAdj) then
  9841. a := FAdj.TheGtkObject
  9842. else
  9843. a := null;
  9844. FGtkObject := PgtkObject (gtk_hscrollbar_new (a));
  9845. FAdj := nil;
  9846. end;
  9847. { TFPgtkVScrollbar }
  9848. procedure TFPgtkVScrollbar.CreateGtkObject;
  9849. var a : PgtkAdjustment;
  9850. begin
  9851. if assigned (FAdj) then
  9852. a := FAdj.TheGtkObject
  9853. else
  9854. a := null;
  9855. FGtkObject := PgtkObject (gtk_vscrollbar_new (a));
  9856. FAdj := nil;
  9857. end;
  9858. { TFPgtkSeparator }
  9859. function TFPgtkSeparator.TheGtkObject : PGtkSeparator;
  9860. begin
  9861. result := PgtkSeparator(FGtkObject);
  9862. end;
  9863. { TFPgtkHSeparator }
  9864. function TFPgtkHSeparator.TheGtkObject : PGtkHSeparator;
  9865. begin
  9866. result := PgtkHSeparator(FGtkObject);
  9867. end;
  9868. procedure TFPgtkHSeparator.CreateGtkObject;
  9869. begin
  9870. FGtkObject := PGtkObject(gtk_HSeparator_new);
  9871. end;
  9872. { TFPgtkVSeparator }
  9873. function TFPgtkVSeparator.TheGtkObject : PGtkVSeparator;
  9874. begin
  9875. result := PgtkVSeparator(FGtkObject);
  9876. end;
  9877. procedure TFPgtkVSeparator.CreateGtkObject;
  9878. begin
  9879. FGtkObject := PGtkObject(gtk_VSeparator_new);
  9880. end;
  9881. { TFPgtkPreview }
  9882. function TFPgtkPreview.TheGtkObject : PGtkPreview;
  9883. begin
  9884. result := PgtkPreview(FGtkObject);
  9885. end;
  9886. procedure TFPgtkPreview.CreateGtkObject;
  9887. begin
  9888. FGtkObject := PGtkObject(gtk_preview_new (GTK_PREVIEW_COLOR));
  9889. end;
  9890. procedure TFPgtkPreview.Size (aWidth:integer; aHeight:integer);
  9891. begin
  9892. gtk_preview_size (TheGtkObject, aWidth, aHeight);
  9893. end;
  9894. procedure TFPgtkPreview.Put (aWindow:PGdkWindow; gc:PGdkGC; SrcX:integer; SrcY:integer; destX:integer; DestY:integer; aWidth:integer; aHeight:integer);
  9895. begin
  9896. gtk_preview_put (TheGtkObject, aWindow, gc, SrcX, SrcY, destX, DestY, aWidth, aHeight);
  9897. end;
  9898. procedure TFPgtkPreview.DrawRow (data:pguchar; X:integer; Y:integer; W:integer);
  9899. begin
  9900. gtk_preview_draw_row (TheGtkObject, data, X, Y, W);
  9901. end;
  9902. procedure SetGamma (aGamma:double);
  9903. begin
  9904. gtk_preview_set_gamma (aGamma);
  9905. end;
  9906. function TFPgtkPreview.GetExpand : longbool;
  9907. begin
  9908. result := longbool(gtk.expand(TheGtkObject^));
  9909. end;
  9910. procedure TFPgtkPreview.SetExpand (TheValue:longbool);
  9911. begin
  9912. gtk_preview_set_expand(TheGtkObject,gint(TheValue));
  9913. end;
  9914. function TFPgtkPreview.GetDither : TGdkRgbDither;
  9915. begin
  9916. result := TheGtkObject^.dither;
  9917. end;
  9918. procedure TFPgtkPreview.SetDither (TheValue:TGdkRgbDither);
  9919. begin
  9920. gtk_preview_set_dither(TheGtkObject,TheValue);
  9921. end;
  9922. { TFPgtkProgress }
  9923. function TFPgtkProgress.TheGtkObject : PGtkProgress;
  9924. begin
  9925. result := PgtkProgress(FGtkObject);
  9926. end;
  9927. function TFPgtkProgress.GetShowtext : longbool;
  9928. begin
  9929. result := longbool(gtk.show_text(TheGtkObject^));
  9930. end;
  9931. procedure TFPgtkProgress.SetShowtext (TheValue:longbool);
  9932. begin
  9933. gtk_progress_set_show_text(TheGtkObject,gint(TheValue));
  9934. end;
  9935. function TFPgtkProgress.GetTextXAlign : gfloat;
  9936. begin
  9937. result := TheGtkObject^.x_align;
  9938. end;
  9939. procedure TFPgtkProgress.SetTextXAlign (TheValue:gfloat);
  9940. begin
  9941. gtk_progress_set_text_alignment (TheGtkObject, TheValue, TextYAlign);
  9942. end;
  9943. function TFPgtkProgress.GetTextYAlign : gfloat;
  9944. begin
  9945. result := TheGtkObject^.y_align;
  9946. end;
  9947. procedure TFPgtkProgress.SetTextYAlign (TheValue:gfloat);
  9948. begin
  9949. gtk_progress_set_text_alignment (TheGtkObject, TextXAlign, TheValue);
  9950. end;
  9951. procedure TFPgtkProgress.SetTextAlignment (anXalign:gfloat; anYAlign:gfloat);
  9952. begin
  9953. gtk_progress_set_text_alignment (TheGtkObject, anXalign, anYAlign);
  9954. end;
  9955. function TFPgtkProgress.GetCurrentValue : float;
  9956. begin
  9957. result := gtk_progress_get_Value(TheGtkObject);
  9958. end;
  9959. procedure TFPgtkProgress.SetCurrentValue (TheValue:float);
  9960. begin
  9961. gtk_progress_Set_value (TheGtkObject, TheValue);
  9962. Draw (nil);
  9963. end;
  9964. function TFPgtkProgress.GetPercentage : float;
  9965. begin
  9966. result := gtk_progress_get_current_percentage(TheGtkObject);
  9967. end;
  9968. procedure TFPgtkProgress.SetPercentage (TheValue:float);
  9969. begin
  9970. gtk_progress_set_percentage(TheGtkObject,TheValue);
  9971. end;
  9972. function TFPgtkProgress.PercentageFromValue (aValue:gfloat) : gfloat;
  9973. begin
  9974. result := gtk_progress_get_percentage_from_value (TheGtkObject, aValue);
  9975. end;
  9976. function TFPgtkProgress.GetFormatString : string;
  9977. begin
  9978. result := TheGtkObject^.format;
  9979. end;
  9980. procedure TFPgtkProgress.SetFormatString (TheValue:string);
  9981. begin
  9982. gtk_progress_set_format_string(TheGtkObject,ConvertToPgchar(TheValue));
  9983. end;
  9984. function TFPgtkProgress.GetAdjustment : TFPgtkAdjustment;
  9985. begin
  9986. result := GetPascalInstance (PGtkObject(TheGtkObject^.adjustment), TFPgtkAdjustment) as TFPgtkAdjustment;
  9987. end;
  9988. procedure TFPgtkProgress.SetAdjustment (TheValue:TFPgtkAdjustment);
  9989. begin
  9990. gtk_progress_set_adjustment(TheGtkObject,PGtkadjustment(ConvertToGtkObject(TheValue)));
  9991. end;
  9992. function TFPgtkProgress.GetActivityMode : longbool;
  9993. begin
  9994. result := longbool(gtk.activity_mode(TheGtkObject^));
  9995. end;
  9996. procedure TFPgtkProgress.SetActivityMode (TheValue:longbool);
  9997. begin
  9998. gtk_progress_set_activity_mode(TheGtkObject,gint(TheValue));
  9999. end;
  10000. function TFPgtkProgress.CurrentText : string;
  10001. begin
  10002. result := gtk_progress_get_current_text (TheGtkObject);
  10003. end;
  10004. function TFPgtkProgress.TextFromValue (aValue:gfloat) : string;
  10005. begin
  10006. result := gtk_progress_get_text_from_value (TheGtkObject, aValue);
  10007. end;
  10008. procedure TFPgtkProgress.Configure (aValue:gfloat; aMin:gfloat; aMax:gfloat);
  10009. begin
  10010. gtk_progress_configure (TheGtkObject, aValue, aMin, aMax);
  10011. end;
  10012. { TFPgtkProgressBar }
  10013. function TFPgtkProgressBar.TheGtkObject : PGtkProgressBar;
  10014. begin
  10015. result := PgtkProgressBar(FGtkObject);
  10016. end;
  10017. constructor TFPgtkProgressBar.Create (adj:TFPgtkAdjustment);
  10018. begin
  10019. FAdj := adj;
  10020. inherited create;
  10021. end;
  10022. procedure TFPgtkProgressBar.CreateGtkObject;
  10023. begin
  10024. if assigned (FAdj) then
  10025. TheGtkWidget := gtk_progress_bar_new_with_adjustment (FAdj.TheGtkObject)
  10026. else
  10027. TheGtkWidget := gtk_progress_bar_new;
  10028. end;
  10029. function TFPgtkProgressBar.GetBarStyle : TGtkProgressBarStyle;
  10030. begin
  10031. result := TheGtkObject^.bar_style;
  10032. end;
  10033. procedure TFPgtkProgressBar.SetBarStyle (TheValue:TGtkProgressBarStyle);
  10034. begin
  10035. gtk_progress_bar_set_bar_style(TheGtkObject,TheValue);
  10036. end;
  10037. function TFPgtkProgressBar.GetDiscreteBlocks : longword;
  10038. begin
  10039. result := TheGtkObject^.blocks;
  10040. end;
  10041. procedure TFPgtkProgressBar.SetDiscreteBlocks (TheValue:longword);
  10042. begin
  10043. gtk_progress_bar_set_discrete_blocks(TheGtkObject,TheValue);
  10044. end;
  10045. function TFPgtkProgressBar.GetActivityStep : longword;
  10046. begin
  10047. result := TheGtkObject^.activity_step;
  10048. end;
  10049. procedure TFPgtkProgressBar.SetActivityStep (TheValue:longword);
  10050. begin
  10051. gtk_progress_bar_set_activity_step(TheGtkObject,TheValue);
  10052. end;
  10053. function TFPgtkProgressBar.GetActivityBlocks : longword;
  10054. begin
  10055. result := TheGtkObject^.activity_blocks;
  10056. end;
  10057. procedure TFPgtkProgressBar.SetActivityBlocks (TheValue:longword);
  10058. begin
  10059. gtk_progress_bar_set_activity_blocks(TheGtkObject,TheValue);
  10060. end;
  10061. function TFPgtkProgressBar.GetOrientation : TGtkProgressBarOrientation;
  10062. begin
  10063. result := TheGtkObject^.orientation;
  10064. end;
  10065. procedure TFPgtkProgressBar.SetOrientation (TheValue:TGtkProgressBarOrientation);
  10066. begin
  10067. gtk_progress_bar_set_orientation(TheGtkObject,TheValue);
  10068. end;
  10069. { TFPgtkItemFactory }
  10070. INITIALIZATION
  10071. ObjectsToFree := TList.Create;
  10072. FINALIZATION
  10073. ObjectsToFree.Free;
  10074. if assigned (TheTooltips) then
  10075. TheTooltips.Free;
  10076. End.