_
CanvasA Gtk_Plot_Canvas is a special kind of drawing area used with Gtk_Plot widgets. It provides drag-and-drop capabilities for the texts, legends, points... available in a Gtk_Plot. Note that this widget is specifically designed for Gtk_Plot widgets, and won't provide any other capability for other kinds of widgets.
Like any child of Gtk_Layout, this widget can have an almost unlimited size for its children, and provides scrolling.
Widget Hierarchy |
---|
Gtk_Object (see section Package Gtk.Object)
\___ Gtk_Widget (see section Package Gtk.Widget)
\___ Gtk_Container (see section Package Gtk.Container)
\___ Gtk_Fixed (see section Package Gtk.Fixed)
\___ Gtk_Plot_Canvas (see section Package Gtk.Extra.Plot
|
Signals |
---|
Types |
---|
type Child_Draw_Func is access procedure (Canvas : System.Address; Child : Gtk_Plot_Canvas_Child); | |
Generic format of functions used to draw a child of the canvas.
Canvas is a System.Address since these functions are called directly
from C and GtkAda can't insert its hooks. However, you can use the
Convert function below to convert to a Gtk_Plot_Canvas.
| |
type Gtk_Plot_Canvas_Child is new Gdk.C_Proxy; | |
| |
type Plot_Canvas_Action is (Action_Inactive, Action_Selection, Action_Drag, Action_Resize); | |
The action being performed on the canvas.
| |
type Plot_Canvas_Arrow is new Gint; | |
| |
type Plot_Canvas_Flag is new Gint; | |
| |
type Plot_Canvas_Pos is (Canvas_Out, Canvas_In, Canvas_Left, Canvas_Right, Canvas_Top, Canvas_Bottom, Canvas_Top_Left, Canvas_Top_Right, Canvas_Bottom_Left, Canvas_Bottom_Right); | |
The position of the items in the canvas.
| |
type Plot_Canvas_Type is (None, Plot, Axis, Legends, Title, Text, Data, Line, Rectangle, Ellipse, Custom); | |
The type of data that can be put in a canvas.
Plot is only for a Gtk.Extra.Plot.Gtk_Plot widget.
|
Subprograms |
---|
Creating and manipulating the canvas | ||
procedure Gtk_New (Widget : out Gtk_Plot_Canvas; Width : in Gint; Height : in Gint; Magnification : in Gdouble := 1.0); | ||
Create a new Gtk_Plot_Canvas, with a specific screen size. | ||
function Get_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_Plot_Canvas.
| ||
function Child_Get_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_Plot_Canvas_Child.
| ||
procedure Refresh (Canvas : access Gtk_Plot_Canvas_Record); | ||
Force a refresh of the canvas on the screen. The screen is updated from | ||
procedure Paint (Canvas : access Gtk_Plot_Canvas_Record); | ||
Redraw each of the items included in the canvas. The painting is done | ||
function Get_Pixmap (Canvas : access Gtk_Plot_Canvas_Record) return Gdk.Pixmap.Gdk_Pixmap; | ||
Return the pixmap associated with the Canvas. | ||
procedure Grid_Set_Visible (Canvas : access Gtk_Plot_Canvas_Record; Visible : in Boolean); | ||
Indicate whether the grid should be visible or not.
| ||
procedure Grid_Set_Step (Canvas : access Gtk_Plot_Canvas_Record; Step : in Gint); | ||
Set the space between two lines of the grid.
| ||
procedure Grid_Set_Attributes (Canvas : access Gtk_Plot_Canvas_Record; Style : in Gtk.Extra.Plot_Data.Plot_Line_Style; Width : in Gint; Color : in Gdk.Color.Gdk_Color); | ||
Set the attributes of the grid.
| ||
procedure Add_Plot (Plot_Canvas : access Gtk_Plot_Canvas_Record; Plot : access Gtk.Extra.Plot.Gtk_Plot_Record'Class; X : in Gdouble; Y : in Gdouble); | ||
Add a new plot to the list handled by the canvas. | ||
procedure Set_Active_Plot (Plot_Canvas : access Gtk_Plot_Canvas_Record; Plot : access Gtk.Extra.Plot.Gtk_Plot_Record'Class); | ||
Modify the active plot in the canvas. | ||
procedure Cancel_Action (Plot_Canvas : access Gtk_Plot_Canvas_Record); | ||
Cancel the current action. | ||
function Get_Active_Plot (Canvas : access Gtk_Plot_Canvas_Record) return Gtk.Extra.Plot.Gtk_Plot; | ||
Return the active plot. | ||
function Get_Active_Data (Canvas : access Gtk_Plot_Canvas_Record) return Gtk.Extra.Plot_Data.Gtk_Plot_Data; | ||
Return the active dataset (which of course belongs to the active plot). | ||
procedure Get_Active_Point (Canvas : access Gtk_Plot_Canvas_Record; X : out Gdouble; Y : out Gdouble; Index : out Gint); | ||
Return the relative coordinates of the active point in the | ||
procedure Set_Size (Canvas : access Gtk_Plot_Canvas_Record; Width : in Gint; Height : in Gint); | ||
Modify the size allocated for the canvas, and the size of the pixmap | ||
procedure Unselect (Canvas : access Gtk_Plot_Canvas_Record); | ||
Unselect the currently selected item.
| ||
procedure Set_Magnification (Canvas : access Gtk_Plot_Canvas_Record; Magnification : Gdouble := 1.0); | ||
Changes the magnification for the canvas. | ||
procedure Set_Background (Canvas : access Gtk_Plot_Canvas_Record; Background : Gdk.Color.Gdk_Color); | ||
Set the background color for the canvas.
| ||
procedure Get_Pixel (Canvas : access Gtk_Plot_Canvas_Record; Px : in Gdouble; Py : in Gdouble; X : out Gint; Y : out Gint); | ||
Convert from relative coordinates to absolute ones.
| ||
procedure Get_Position (Canvas : access Gtk_Plot_Canvas_Record; X : in Gint; Y : in Gint; Px : out Gdouble; Py : out Gdouble); | ||
Convert from absolute coordinates to relative ones.
| ||
Canvas items | ||
There are several different types of items that can be put on the | ||
function Convert (Canvas : System.Address) return Gtk_Plot_Canvas; | ||
Convert from a System.Address returned by C to a real Gtk_Plot_Canvas | ||
procedure Set_Draw_Func (Child : Gtk_Plot_Canvas_Child; Draw : Child_Draw_Func); | ||
Set the function used to draw the item. | ||
function Get_Active_Item (Canvas : access Gtk_Plot_Canvas_Record) return Gtk_Plot_Canvas_Child; | ||
Return the currently selected item.
| ||
function Put_Text (Canvas : access Gtk_Plot_Canvas_Record; X : in Gdouble; Y : in Gdouble; Ps_Font : in String; Height : in Gint; Angle : in Gint; Fg : in Gdk.Color.Gdk_Color; Bg : in Gdk.Color.Gdk_Color; Transparent : in Boolean; Justification : in Gtk.Enums.Gtk_Justification; Text : in String) return Gtk_Plot_Canvas_Child; | ||
Put an arbitrary text in the layout. Text can contain some special characters, that change is renderering. They all begin with a '\' (backslash) character, followed by one of:
| ||
function Put_Line (Canvas : access Gtk_Plot_Canvas_Record; X1 : Gdouble; Y1 : Gdouble; X2 : Gdouble; Y2 : Gdouble; Style : Gtk.Extra.Plot_Data.Plot_Line_Style; Width : Gfloat; Color : Gdk.Color.Gdk_Color; Arrow_Mask : Plot_Canvas_Arrow) return Gtk_Plot_Canvas_Child; | ||
Draw a line in the background of the canvas.
| ||
function Put_Rectangle (Canvas : access Gtk_Plot_Canvas_Record; X1 : Gdouble; Y1 : Gdouble; X2 : Gdouble; Y2 : Gdouble; Style : Gtk.Extra.Plot_Data.Plot_Line_Style; Width : Gfloat; Fg : Gdk.Color.Gdk_Color; Bg : Gdk.Color.Gdk_Color; Border : Gtk.Extra.Plot.Plot_Border_Style; Fill : Boolean := False) return Gtk_Plot_Canvas_Child; | ||
Draw a rectangle in the canvas.
| ||
function Put_Ellipse (Canvas : access Gtk_Plot_Canvas_Record; X1 : Gdouble; Y1 : Gdouble; X2 : Gdouble; Y2 : Gdouble; Style : Gtk.Extra.Plot_Data.Plot_Line_Style; Width : Gfloat; Fg : Gdk.Color.Gdk_Color; Bg : Gdk.Color.Gdk_Color; Fill : Boolean := False) return Gtk_Plot_Canvas_Child; | ||
Draw an ellipse in the canvas.
| ||
procedure Line_Set_Attributes (Child : Gtk_Plot_Canvas_Child; Style : Gtk.Extra.Plot_Data.Plot_Line_Style; Width : Gfloat; Color : Gdk.Color.Gdk_Color; Mask : Plot_Canvas_Arrow); | ||
Change the attributes of a line.
| ||
procedure Rectangle_Set_Attributes (Child : Gtk_Plot_Canvas_Child; Style : Gtk.Extra.Plot_Data.Plot_Line_Style; Width : Gfloat; Fg : Gdk.Color.Gdk_Color; Bg : Gdk.Color.Gdk_Color; Border : Gtk.Extra.Plot.Plot_Border_Style; Fill : Boolean := False); | ||
Change the attributes of a rectangle.
| ||
procedure Ellipse_Set_Attributes (Child : Gtk_Plot_Canvas_Child; Style : Gtk.Extra.Plot_Data.Plot_Line_Style; Width : Gfloat; Fg : Gdk.Color.Gdk_Color; Bg : Gdk.Color.Gdk_Color; Fill : Boolean := False); | ||
Change the attributes for an ellipse.
| ||
Custom children | ||
You can insert your own items in a canvas. | ||
function Child_New (Child_Type : Plot_Canvas_Type := Custom) return Gtk_Plot_Canvas_Child; | ||
Create a new child.
| ||
procedure Put_Child (Canvas : access Gtk_Plot_Canvas_Record; Child : Gtk_Plot_Canvas_Child; X1 : Gdouble; Y1 : Gdouble; X2 : Gdouble; Y2 : Gdouble); | ||
Insert a new item in the canvas. It will occupy the area defined by | ||
procedure Child_Move (Canvas : access Gtk_Plot_Canvas_Record; Child : Gtk_Plot_Canvas_Child; X1 : Gdouble; Y1 : Gdouble); | ||
Move an item, but does not change its size.
| ||
procedure Child_Move_Resize (Canvas : access Gtk_Plot_Canvas_Record; Child : Gtk_Plot_Canvas_Child; X1 : Gdouble; Y1 : Gdouble; X2 : Gdouble; Y2 : Gdouble); | ||
Move an resize an item in the canvas.
| ||
function Get_Item_Type (Item : Gtk_Plot_Canvas_Child) return Plot_Canvas_Type; | ||
Return the type of the item.
| ||
function Get_Allocation_Width (Child : Gtk_Plot_Canvas_Child) return Guint; | ||
Return the current width of the child.
| ||
function Get_Allocation_Height (Child : Gtk_Plot_Canvas_Child) return Guint; | ||
Return the current height of the child.
| ||
function Get_Allocation_X (Child : Gtk_Plot_Canvas_Child) return Gint; | ||
Return the current position of the child, relative to its canvas.
| ||
function Get_Allocation_Y (Child : Gtk_Plot_Canvas_Child) return Gint; | ||
Return the current position of the child, relative to its canvas.
| ||
function Get_Flags (Child : Gtk_Plot_Canvas_Child) return Plot_Canvas_Flag; | ||
Return the list of actions currently possible on the child.
| ||
procedure Set_Flags (Child : Gtk_Plot_Canvas_Child; Flags : Plot_Canvas_Flag); | ||
Modify the list of actions possible for a child.
| ||
Flags | ||
Some flags are defined for this widget. You can not access them through
| ||
function Plot_Canvas_Flag_Is_Set (Plot_Canvas : access Gtk_Plot_Canvas_Record; Flag : in Guint16) return Boolean; | ||
Test whether one of the flags for a Gtk_Plot_Canvas widget or its | ||
procedure Plot_Canvas_Set_Flags (Plot_Canvas : access Gtk_Plot_Canvas_Record; Flags : in Guint16); | ||
Set the flags for a Gtk_Plot_Canvas widget or its children. | ||
procedure Plot_Canvas_Unset_Flags (Plot_Canvas : access Gtk_Plot_Canvas_Record; Flags : in Guint16); | ||
Unset the flags for a Gtk_Plot_Canvas.
|