Background

Name

Background -- 

Synopsis


#include <history.h>


enum        BackgroundMethod;
            Background;
Background* background_new                  (GtkTextView *widget);
void        background_set_secondary_text_view
                                            (Background *bg,
                                             GtkTextView *text_view);
void        background_set_method           (Background *bg,
                                             BackgroundMethod method);
gint        cui_background_append_widget    (Background *bg,
                                             gpointer widget);
gpointer*   background_get_last_dnd_target  (Background *background);
gpointer*   background_get_last_dnd_source  (Background *background);
gboolean    background_expose_event         (GtkWidget *widget,
                                             GdkEventExpose *event,
                                             gpointer user_data);
gboolean    background_button_press_event   (Background *bg,
                                             GtkWidget *widget,
                                             GdkEventButton *event,
                                             gpointer user_data);
gboolean    background_motion_notify_event  (Background *bg,
                                             GtkWidget *widget,
                                             GdkEventMotion *event,
                                             gpointer user_data);
gboolean    background_dnd_motion_notify    (GtkWidget *widget,
                                             Background *background,
                                             GdkDragContext *drag_context,
                                             gint x,
                                             gint y);
gboolean    background_leave_notify_event   (Background *bg,
                                             GtkWidget *widget,
                                             GdkEventCrossing *event,
                                             gpointer user_data);

Description

Details

enum BackgroundMethod

typedef enum {
	MethodGraphics,
	MethodSelection,
	MethodEditor
} BackgroundMethod;

MethodGraphics

using the CUI as a graphical user interface

MethodSelection

using the CUI to select items

MethodEditor

using the CUI as a text editor


Background

typedef struct {
	GList            *bg_widgets;
	GdkColormap      *colormap;
	
	GtkTextView      *text_view, *secondary_text_view;
	GtkWidget        *widget;
	GdkWindow        *window, *secondary_window;
	
	GtkTextBuffer    *text_buffer;
	GdkGC            *gc;
	GdkCursor        *mouse_cursor_arrow;
	GdkCursor        *mouse_cursor_hand;
	GdkCursor        *mouse_cursor_text;
	BackgroundMethod  method;
} Background;

GList *bg_widgets;

a list of CuiWidgets

GdkColormap *colormap;

the colormap to draw objects (FIXME: do we need this?)

GtkTextView *text_view;

same as the widget but as a GtkTextView

GtkTextView *secondary_text_view;

GtkWidget *widget;

the terminal widget

GdkWindow *window;

the window to draw in (A GtkTextView has 3 windows!)

GdkWindow *secondary_window;

GtkTextBuffer *text_buffer;

the terminal's text_buffer (FIXME: do we need this?)

GdkGC *gc;

the graphics context to draw

GdkCursor *mouse_cursor_arrow;

an arrow like mouse cursor

GdkCursor *mouse_cursor_hand;

a hand mouse cursor to use

GdkCursor *mouse_cursor_text;

a mouse cursor like the text editors used to show

BackgroundMethod method;

the user communication method of the background


background_new ()

Background* background_new                  (GtkTextView *widget);

Creates a new background for the given GtkWidget.

widget :

a GtkTextView which will hold the new background

Returns :

a new background


background_set_secondary_text_view ()

void        background_set_secondary_text_view
                                            (Background *bg,
                                             GtkTextView *text_view);

Sets the secondary text view which uses this background.

bg :

a Background

text_view :

a GtkTextView also shows the given background


background_set_method ()

void        background_set_method           (Background *bg,
                                             BackgroundMethod method);

Sets the usage method of the background.

bg :

a background to set

method :

the usage method of the background


cui_background_append_widget ()

gint        cui_background_append_widget    (Background *bg,
                                             gpointer widget);

Adds the widget to the background so it can be appear on the screen and the user can use it to control the application.

bg :

the Background which will contain the widget

widget :

a CuiWidget

Returns :

0 if everything is fine


background_get_last_dnd_target ()

gpointer*   background_get_last_dnd_target  (Background *background);

Returns the CuiWidget used as a Drag&Drop target. The return value can be NULL if there were no widget under the mouse pointer.

background :

a background

Returns :

the last CuiWidget used as a DnD target.


background_get_last_dnd_source ()

gpointer*   background_get_last_dnd_source  (Background *background);

Returns the CuiWidget used as a Drag&Drop source. The return value can be NULL if there were no widget under the mouse pointer.

background :

a background

Returns :

the last CuiWidget used as a DnD source.


background_expose_event ()

gboolean    background_expose_event         (GtkWidget *widget,
                                             GdkEventExpose *event,
                                             gpointer user_data);

widget :

event :

user_data :

Returns :


background_button_press_event ()

gboolean    background_button_press_event   (Background *bg,
                                             GtkWidget *widget,
                                             GdkEventButton *event,
                                             gpointer user_data);

Called when the any of the mouse buttons are pressed on a Background. This function will decide what to do and call the appropriate function to handle the event.

bg :

a Background

widget :

the GtkWidget the Background pertain to

event :

the mouse event we try to handle

user_data :

the pointer given for the signal connection (may be NULL)

Returns :

TRUE if the event handled


background_motion_notify_event ()

gboolean    background_motion_notify_event  (Background *bg,
                                             GtkWidget *widget,
                                             GdkEventMotion *event,
                                             gpointer user_data);

bg :

widget :

event :

user_data :

Returns :


background_dnd_motion_notify ()

gboolean    background_dnd_motion_notify    (GtkWidget *widget,
                                             Background *background,
                                             GdkDragContext *drag_context,
                                             gint x,
                                             gint y);

Called when the mouse is moving during the DnD operation. This function will try to find a matching DnD target, selecting a DnD target type, and highlight the DnD target if a match found.

widget :

background :

a Background

drag_context :

the context

x :

the mouse x coordinate

y :

the mouse y coordinate

Returns :

TRUE if a DnD target has been found


background_leave_notify_event ()

gboolean    background_leave_notify_event   (Background *bg,
                                             GtkWidget *widget,
                                             GdkEventCrossing *event,
                                             gpointer user_data);

bg :

widget :

event :

user_data :

Returns :