## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

1.     -----------------------------------------------------------------------

2.     --               GtkAda - Ada95 binding for Gtk+/Gnome               --

3.     --                                                                   --

4.     --      Copyright (C) 2000 E. Briot, J. Brobecker and A. Charlet     --

5.     --                Copyright (C) 2000-2013, AdaCore                   --

6.     --                                                                   --

7.     -- This library is free software; you can redistribute it and/or     --

8.     -- modify it under the terms of the GNU General Public               --

9.     -- License as published by the Free Software Foundation; either      --

10.     -- version 2 of the License, or (at your option) any later version.  --

11.     --                                                                   --

12.     -- This library is distributed in the hope that it will be useful,   --

13.     -- but WITHOUT ANY WARRANTY; without even the implied warranty of    --

14.     -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --

15.     -- General Public License for more details.                          --

16.     --                                                                   --

17.     -- You should have received a copy of the GNU General Public         --

18.     -- License along with this library; if not, write to the             --

19.     -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --

20.     -- Boston, MA 02111-1307, USA.                                       --

21.     --                                                                   --

22.     -- As a special exception, if other files instantiate generics from  --

23.     -- this unit, or you link this unit with other files to produce an   --

24.     -- executable, this  unit  does not  by itself cause  the resulting  --

25.     -- executable to be covered by the GNU General Public License. This  --

26.     -- exception does not however invalidate any other reasons why the   --

27.     -- executable file  might be covered by the  GNU Public License.     --

28.     -----------------------------------------------------------------------

30.     --  <description>

31.     --  A Gtk_Plot_Canvas is a special kind of drawing area used with Gtk_Plot

32.     --  widgets.

33.     --  It provides drag-and-drop capabilities for the texts, legends, points...

34.     --  available in a Gtk_Plot.

35.     --  Note that this widget is specifically designed for Gtk_Plot widgets, and

36.     --  won't provide any other capability for other kinds of widgets.

37.     --

38.     --  Like any child of Gtk_Layout, this widget can have an almost unlimited

39.     --  size for its children, and provides scrolling.

40.     --  </description>

41.     --  <c_version>gtkextra 2.1.1</c_version>

42.     --  <group>Plotting Data</group>

44.     with Glib.ObjectTo API docTo specTo body;

45.     with GdkTo API docTo spec;

46.     with Gtk.Extra.Plot_DataTo API docTo specTo body;

47.     with Gtk.FixedTo API docTo specTo body;

48.     with Gdk.ColorTo API docTo specTo body;

50.     package Gtk.Extra.Plot_CanvasTo API docTo specTo body is

52.        type Gtk_Plot_Canvas_RecordTo API docTo body is new Gtk.Fixed.Gtk_Fixed_RecordTo API docTo spec with private;

53.        type Gtk_Plot_Canvas is access all Gtk_Plot_Canvas_RecordTo API docTo specTo body'Class;

55.        type Gtk_Plot_Canvas_Child_RecordTo API docTo body is

56.          new Glib.Object.GObject_RecordTo API docTo specTo body with private;

57.        type Gtk_Plot_Canvas_Child is access all Gtk_Plot_Canvas_Child_RecordTo API docTo specTo body'Class;

59.        ----------------

60.        -- Enum types --

61.        ----------------

63.        type Plot_Canvas_Action is

64.          (Action_Inactive,

65.           Action_Selection,

66.           Action_Drag,

67.           Action_Resize);

68.        --  The action being performed on the canvas.

69.        pragma Convention (C, Plot_Canvas_ActionTo API docTo spec);

71.        type Plot_Canvas_Flag is new GintTo API docTo spec;

72.        Frozen     : constant Plot_Canvas_FlagTo API docTo spec;

73.        Can_Move   : constant Plot_Canvas_FlagTo API docTo spec;

74.        Can_Resize : constant Plot_Canvas_FlagTo API docTo spec;

76.        type Plot_Canvas_Selection is

77.          (Select_None,

78.           Select_Markers,

79.           Select_Target);

80.        pragma Convention (C, Plot_Canvas_SelectionTo API docTo spec);

82.        type Plot_Canvas_Pos is

83.          (Canvas_Out,

84.           Canvas_In,

85.           Canvas_Left,

86.           Canvas_Right,

87.           Canvas_Top,

88.           Canvas_Bottom,

89.           Canvas_Top_Left,

90.           Canvas_Top_Right,

91.           Canvas_Bottom_Left,

92.           Canvas_Bottom_Right);

93.        --  The position of the items in the canvas.

94.        pragma Convention (C, Plot_Canvas_PosTo API docTo spec);

96.        type Plot_Canvas_Selection_Mode is

97.          (Select_Click_1,

98.           Select_Click_2);

99.        pragma Convention (C, Plot_Canvas_Selection_ModeTo API docTo spec);

101.        ------------------------------------------

102.        -- Creating and manipulating the canvas --

103.        ------------------------------------------

105.        procedure Gtk_NewTo API docTo body

106.          (Widget        : out Gtk_Plot_CanvasTo API docTo spec;

107.           Width         : GintTo API docTo spec;

108.           Height        : GintTo API docTo spec;

109.           Magnification : GdoubleTo API docTo spec := 1.0);

110.        --  Create a new Gtk_Plot_Canvas, with a specific screen size.

111.        --  Since the widget can have an unlimited internal size, it does not try

112.        --  to set its size to accommodate all of its children.

114.        procedure InitializeTo API docTo body

115.          (Widget        : access Gtk_Plot_Canvas_RecordTo API docTo specTo body'Class;

116.           Width         : GintTo API docTo spec;

117.           Height        : GintTo API docTo spec;

118.           Magnification : GdoubleTo API docTo spec := 1.0);

119.        --  Internal initialization function.

120.        --  See the section "Creating your own widgets" in the documentation.

122.        function Get_TypeTo API docTo body return Gtk.Gtk_TypeTo API docTo spec;

123.        --  Return the internal value associated with a Gtk_Plot_Canvas.

125.        function Child_Get_TypeTo API docTo body return Gtk.Gtk_TypeTo API docTo spec;

126.        --  Return the internal value associated with a Gtk_Plot_Canvas_Child.

128.        procedure RefreshTo API docTo body (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body);

129.        --  Force a refresh of the canvas on the screen. The screen is updated from

130.        --  the contents of the double-buffer.

132.        procedure PaintTo API docTo body (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body);

133.        --  Redraw each of the items included in the canvas. The painting is done

134.        --  in the double-buffer, and must be drawn on the screen with Refresh.

136.        procedure FreezeTo API docTo body (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body);

137.        --  Freeze all graphical updates to the screen. This significanly speeds up

138.        --  the updates to the plot

140.        procedure ThawTo API docTo body (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body);

141.        --  Reactivate all graphical updates to the screen

143.        procedure Grid_Set_VisibleTo API docTo body

144.          (Canvas  : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

145.           Visible : Boolean);

146.        --  Indicate whether the grid should be visible or not.

148.        procedure Grid_Set_StepTo API docTo body

149.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

150.           Step   : GdoubleTo API docTo spec);

151.        --  Set the space between two lines of the grid.

153.        procedure Grid_Set_AttributesTo API docTo body

154.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

155.           StyleTo API docTo body  : Gtk.Extra.Plot_Data.Plot_Line_StyleTo API docTo spec;

156.           Width  : GintTo API docTo spec;

157.           ColorTo API docTo body  : Gdk.Color.Gdk_ColorTo API docTo specTo body);

158.        --  Set the attributes of the grid.

160.        procedure Cancel_ActionTo API docTo body (Plot_Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body);

161.        --  Cancel the current action.

162.        --  This can be called in the user callbacks to ignore temporarily some of

163.        --  the signals below.

165.        procedure UnselectTo API docTo body (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body);

166.        --  Unselect the currently selected item.

168.        function Get_Active_ItemTo API docTo body

169.          (Canvas  : access Gtk_Plot_Canvas_RecordTo API docTo specTo body)

170.          return Gtk_Plot_Canvas_ChildTo API docTo spec;

171.        --  Return the currently selected item.

173.        procedure Set_SizeTo API docTo body

174.          (Canvas  : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

175.           Width   : GintTo API docTo spec;

176.           Height  : GintTo API docTo spec);

177.        --  Modify the size allocated for the canvas, and the size of the pixmap

178.        --  the plots are displayed on.

180.        procedure Set_MagnificationTo API docTo body

181.          (Canvas        : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

182.           Magnification : GdoubleTo API docTo spec := 1.0);

183.        --  Changes the magnification for the canvas.

184.        --  1.0 is the default value. Higher values will zoom in, while lower values

185.        --  will zoom out.

187.        procedure Set_TransparentTo API docTo body

188.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body; Transparent : Boolean);

189.        --  Whether the canvas should be transparent. If Transparent is True, all

190.        --  background attributes are ignored

192.        function TransparentTo API docTo body

193.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body) return Boolean;

194.        --  Whether the canvas is currently transparent

196.        procedure Set_BackgroundTo API docTo body

197.          (Canvas     : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

198.           BackgroundTo API docTo body : Gdk.Color.Gdk_ColorTo API docTo specTo body);

199.        --  Set the background color for the canvas.

201.        procedure Get_PixelTo API docTo body

202.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

203.           Px     : GdoubleTo API docTo spec;

204.           Py     : GdoubleTo API docTo spec;

205.           X      : out GintTo API docTo spec;

206.           Y      : out GintTo API docTo spec);

207.        --  Convert from relative coordinates to absolute ones.

209.        procedure Get_PositionTo API docTo body

210.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

211.           X      : GintTo API docTo spec;

212.           Y      : GintTo API docTo spec;

213.           Px     : out GdoubleTo API docTo spec;

214.           Py     : out GdoubleTo API docTo spec);

215.        --  Convert from absolute coordinates to relative ones.

217.        procedure Put_ChildTo API docTo body

218.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

219.           Child  : access Gtk_Plot_Canvas_Child_RecordTo API docTo specTo body'Class;

220.           X1     : GdoubleTo API docTo spec;

221.           Y1     : GdoubleTo API docTo spec;

222.           X2     : GdoubleTo API docTo spec := 0.0;

223.           Y2     : GdoubleTo API docTo spec := 0.0);

224.        --  Insert a new item in the canvas. It will occupy the area defined by

225.        --  the four coordinates.

226.        --  See the various packages Gtk.Extra.Plot_Canvas.* on how to create

227.        --  such children.

228.        --  Leaving X2 and Y2 to their default value will ensure that the child uses

229.        --  as much space as it needs

231.        procedure Remove_ChildTo API docTo body

232.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

233.           Child  : access Gtk_Plot_Canvas_Child_RecordTo API docTo specTo body'Class);

234.        --  Remove a child from the canvas

236.        procedure Child_MoveTo API docTo body

237.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

238.           Child  : access Gtk_Plot_Canvas_Child_RecordTo API docTo specTo body'Class;

239.           X1     : GdoubleTo API docTo spec;

240.           Y1     : GdoubleTo API docTo spec);

241.        --  Move an item, but does not change its size.

243.        procedure Child_Move_ResizeTo API docTo body

244.          (Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

245.           Child  : access Gtk_Plot_Canvas_Child_RecordTo API docTo specTo body'Class;

246.           X1     : GdoubleTo API docTo spec;

247.           Y1     : GdoubleTo API docTo spec;

248.           X2     : GdoubleTo API docTo spec;

249.           Y2     : GdoubleTo API docTo spec);

250.        --  Move an resize an item in the canvas.

252.        procedure Set_SelectionTo API docTo body

253.          (Child     : access Gtk_Plot_Canvas_Child_RecordTo API docTo specTo body;

254.           SelectionTo API docTo body : Plot_Canvas_SelectionTo API docTo spec);

256.        procedure Set_Selection_ModeTo API docTo body

257.          (Child     : access Gtk_Plot_Canvas_Child_RecordTo API docTo specTo body;

258.           ModeTo API docTo body      : Plot_Canvas_Selection_ModeTo API docTo spec);

260.        procedure Get_PositionTo API docTo body

261.          (Canvas    : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

262.           Child     : access Gtk_Plot_Canvas_Child_RecordTo API docTo specTo body'Class;

263.           X1, Y1    : out GdoubleTo API docTo spec;

264.           X2, Y2    : out GdoubleTo API docTo spec);

266.        ---------------------

267.        -- Custom children --

268.        ---------------------

269.        --  You can insert your own items in a canvas.

270.        --  While the canvas will take care of moving the item, it is your

271.        --  responsability to provide a visual rendering for it.

273.        -----------

274.        -- Flags --

275.        -----------

276.        --  Some flags are defined for this widget. You can not access them through

277.        --  the usual interface in Gtk.Widget.Flag_Is_Set since this widget is not

278.        --  part of the standard gtk+ packages. Instead, use the functions below.

279.        --

280.        --  - "can_select"

281.        --    True if it is possible to select a region of the canvas

282.        --

283.        --  - "can_select_item"

284.        --    True if it is possible to select any of the item on the canvas.

285.        --

286.        --  - "can_dnd"

287.        --    True if it is possible to drag an item on the canvas.

288.        --

290.        Can_Select       : constant := 2 ** 0;

291.        Can_Select_Item  : constant := 2 ** 1;

292.        Can_Dnd          : constant := 2 ** 2;

293.        Dnd_Flags        : constant := Can_Select_ItemTo API docTo spec + Can_DndTo API docTo spec;

295.        function Plot_Canvas_Flag_Is_SetTo API docTo body

296.          (Plot_Canvas : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

297.           Flag        : Guint16To API docTo spec)

298.          return Boolean;

299.        --  Test whether one of the flags for a Gtk_Plot_Canvas widget or its

300.        --  children is set.

302.        procedure Plot_Canvas_Set_FlagsTo API docTo body

303.          (Plot_Canvas  : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

304.           Flags        : Guint16To API docTo spec);

305.        --  Set the flags for a Gtk_Plot_Canvas widget or its children.

306.        --  Note that the flags currently set are not touched by this function.

307.        --  This can only be used for the flags defined in the

308.        --  Gtk.Extra.Gtk_Plot_Canvas package.

310.        procedure Plot_Canvas_Unset_FlagsTo API docTo body

311.          (Plot_Canvas  : access Gtk_Plot_Canvas_RecordTo API docTo specTo body;

312.           Flags        : Guint16To API docTo spec);

313.        --  Unset the flags for a Gtk_Plot_Canvas.

315.        -------------

316.        -- Signals --

317.        -------------

319.        --  <signals>

320.        --  The following new signals are defined for this widget:

321.        --

322.        --  - "select_item"

323.        --    function Handler (Canvas : access Gtk_Plot_Canvas_Record'Class;

324.        --                      Event  : Gdk_Button_Event;

325.        --                      Item   : Gtk_Plot_Canvas_Child)

326.        --                     return Boolean;

327.        --

328.        --    Called when an item was selected.

329.        --    An item can be anything, from a text to a plot

330.        --    When this signal is called, the item was simply selected, but not

331.        --    dragged.

332.        --    The handler should return False if the item can not be selected.

333.        --

334.        --  - "move_item"

335.        --    function Handler (Canvas : access Gtk_Plot_Canvas_Record'Class;

336.        --                      Item   : Gtk_Plot_Canvas_Child;

337.        --                      New_X  : Gdouble;

338.        --                      New_Y  : Gdouble)

339.        --                     return Boolean;

340.        --

341.        --    An item was moved on the canvas.

342.        --    Its coordinates have not changed yet, but if the handler returns True

343.        --    they will become (New_X, New_Y). If the handler returns False,

344.        --    nothing happens.

345.        --

346.        --  - "resize_item"

347.        --    function Handler (Canvas     : access Gtk_Plot_Canvas_Record'Class;

348.        --                      Item       : Gtk_Plot_Canvas_Child;

349.        --                      New_Width  : Gdouble;

350.        --                      New_Height : Gdouble)

351.        --                     return Boolean;

352.        --

353.        --    An item is being resized.

354.        --    Its size has not changed yet, but if the handler returns True

355.        --    it will become (New_Width, New_Height). If the handler returns False,

356.        --    nothing happens.

357.        --

358.        --  - "add_item"

359.        --    procedure Handler (Canvas : access Gtk_Plot_Canvas_Record'Class;

360.        --                       Item   : Gtk_Plot_Canvas_Child);

361.        --    Called when a new child is added into the canvas

362.        --

363.        --  - "delete_item"

364.        --    function Handler (Canvas : access Gtk_Plot_Canvas_Record'Class;

365.        --                      Item   : Gtk_Plot_Canvas_Child) return GBoolean;

366.        --    Called when an item is being removed from the canvas

367.        --

368.        --  - "select_region"

369.        --    procedure Handler (Canvas : access Gtk_Plot_Canvas_Record'Class;

370.        --                       X_Min  : Gdouble;

371.        --                       Y_Min  : Gdouble;

372.        --                       X_Max  : Gdouble;

373.        --                       Y_Max  : Gdouble);

374.        --    A region of the canvas was selected by the user.

375.        --

376.        --  - "changed"

377.        --    procedure Handler (Canvas : access Gtk_Plot_Canvas_Record'Class);

378.        --    Called when the contents of the canvas has changed (an item was

379.        --    moved interactively by the user).

380.        --  </signals>

382.     private

383.        type Gtk_Plot_Canvas_RecordTo API docTo spec is new Gtk.Fixed.Gtk_Fixed_RecordTo API docTo spec

384.          with null record;

385.        type Gtk_Plot_Canvas_Child_RecordTo API docTo spec is

386.          new Glib.Object.GObject_RecordTo API docTo specTo body with null record;

387.        pragma Import (C, Get_TypeTo API docTo spec, "gtk_plot_canvas_get_type");

388.        pragma Import (C, Child_Get_TypeTo API docTo spec, "gtk_plot_canvas_child_get_type");

390.        FrozenTo API docTo spec     : constant Plot_Canvas_FlagTo API docTo spec := 0;

391.        Can_MoveTo API docTo spec   : constant Plot_Canvas_FlagTo API docTo spec := 1;

392.        Can_ResizeTo API docTo spec : constant Plot_Canvas_FlagTo API docTo spec := 2;

394.     end Gtk.Extra.Plot_CanvasTo API docTo specTo body;

396.     --  Unbound

397.     --    gtk_plot_canvas_set_pc

398.     --    gtk_plot_canvas_set_line_attributes