Package Graphics.Graphic_Component.Gtk_GC

This package contains the classes required for the gtk graphic component.

Class GC_With_Dirty_Count

This is a record which holds a Graphic Context and a dirty counter.

Class Gtk_Graphic_Component

extends Graphics.Graphic_Component.Graphic_Component

This implementation of a Graphic Component uses GtkAda to draw.


private Graphics.Pixmaps.Pixmap Draw_Area 

The component to draw on.

private Gdk.Pixmap.Gdk_Pixmap Back_Area 

the back area, i.e. the background

private Gdk.GC.Gdk_GC Context 

The graphic context.

private Gdk.Font.Gdk_Font Font 

The font which is used for drawing text

private Glib.Gint Depth 

holds the color depth which is used by OpenCAGE

private Graphics.Area_Sizes.Area_Size Size 

The area-size of this GC.

private Graphics.Area_Sizes.Area_Size Trans_Vector 

Holds the range in x and y direction for which the position has to be corrected when you draw something on this graphic component. The translation will be done in all drawing functions of Graphic_Component (Draw_Pixmap, Draw_Line, Draw_Text) and if explicitly noticed in the description.

private Boolean Use_Clip_Mask_Of_Own_Pixmap 

Whether or not this graphic component should tell the pixmap to use its own mask as clipping mask when drawing.

private Graphics.Graphic_Component.Gtk_GC.GC_With_Dirty_Count Draw_GC 

The context used for drawing operations.

private Graphics.Graphic_Component.Gtk_GC.GC_Color_Table.Mapping Color_Table 

the color table for this gc

private Gdk.Rectangle.Gdk_Rectangle Clip_Rectangle 

This attribut holds the rectangle for the clipping. So only the area inside of the rectangle will be drawn.

private Natural GC_Clip_Rectangle_Dirty_Counter 

every time, the size of the clipping rectangle changes the counter will be increased by one

private Boolean Use_Clip_Rectangle 

Whether or not this graphic component should tell the pixmap to use the clip rectangle or not


public Draw_Pixmap ( Graphics.Pixmaps.Pixmap Pixmap , Graphics.Points.Point Pos );

Draws a pixmap. The position is in the middle of the pixmap. [This description is adopted from 'Graphics.Graphic_Component.Graphic_Component'.]

public Draw_Line ( Graphics.Points.Point Start_Pos , Graphics.Points.Point End_Pos , Ada.Strings.Unbounded.Unbounded_String Color );

Draws a line between the given positions. [This description is adopted from 'Graphics.Graphic_Component.Graphic_Component'.]

public Draw_Text ( String Text , Graphics.Points.Point Pos , Ada.Strings.Unbounded.Unbounded_String Color );

Draws a text. [This description is adopted from 'Graphics.Graphic_Component.Graphic_Component'.]

public Draw_Rectangle ( Graphics.Points.Point Pos1 , Graphics.Points.Point Pos2 , Boolean Filled := False , Ada.Strings.Unbounded.Unbounded_String Color );

Draws a rectangle. Note: Pos1 is not required to be the upper left corner, it can also be the lower right corner. [This description is adopted from 'Graphics.Graphic_Component.Graphic_Component'.]

public Create_Draw_Area ( Graphics.Area_Sizes.Area_Size Size , Gdk.Window.Gdk_Window Ref_Window := Gdk.Window.Null_Window , Boolean Transparent := True );

Creates a new draw area.

public Dump ( Gdk.Drawable.Gdk_Drawable Target , Graphics.Points.Point Target_Pos , Graphics.Points.Point Source_Pos , Graphics.Area_Sizes.Area_Size Size );

Copies the back area (if it does exist) and the draw area to the given target.

public Clear (void);

Clears the content of the graphic component.

public Copy_To_Back_Area (void);

Copies the current back area (if it does exist) plus the draw area to a new back area.

public Clear_Back_Area (void);

Clears (removes) the back area.

public Graphics.Pixmaps.Pixmap Dump_To_New_Pixmap (void);

Copies the back area (if it does exist) and the draw area to a new pixmap which is returned. It will use the graphic context from the draw area.

public Draw_GC ( Graphics.Points.Point Position , Graphics.Graphic_Component.Gtk_GC.Gtk_Graphic_Component Src_Comp , Graphics.Area_Sizes.Area_Size Drawn_Area );

Draws a part of GC (beginning point is upper left corner) in this GC.

private Gdk.GC.Gdk_GC Get_Color_GC ( Ada.Strings.Unbounded.Unbounded_String Color );

returns a colored graphic context in the desired color. If the color is not found, black is returned by default. The string can be one of : (1) "RBG:FF/FF/FF" where the "FF" substrings are respectively the value of the red, green and blue components. Some other prefixes than RGB are defined in the X11 definition, please see some X11 documentation (or the man page XParseColor on unix systems). (2) "color_name" which can be any color name defined in the file rgb.txt of the user's system. You should always check that Wrong_Color was not raised, in case the color was not known on the user's system. This string is case insensitive.

public Move_Part_Of_GC ( Graphics.Area_Sizes.Area_Size Dist );

copies a part of a GC to another position in the GC

public Clear ( Graphics.Points.Point Upper_Left , Graphics.Points.Point Lower_Right );

Clears the content of the graphic component within the given positions.

public Set_Clip_Rectangle ( Graphics.Points.Point Upper_Left , Graphics.Points.Point Lower_Right );

sets a new Clip_Rectangle to a given Gdk.GC between to given points.

private Apply_Clip_Mask_To_GC ( Graphics.Graphic_Component.Gtk_GC.GC_With_Dirty_Count GC );

sets the clip mask of a given GC

public Copy_Back_Area_To_Front ( Graphics.Points.Point Upper_Left , Graphics.Points.Point Lower_Right );

copies an area given by two points of the Back_Area into the Draw_Area

public Copy_Back_Area_To_Front (void);

copies the whole Back_Area into the Draw_Area

private Inc_GC_Clip_Rectangle_Dirty_Counter (void);

Increases the dirty counter for the rectangle clip option. This must be called (internally) everytime the clip rectangle is updated to make sure that the gdk graphic contexts are also updated.