![]() | ![]() | ![]() | Cuiterm Reference Manual | ![]() |
---|
#include <history.h> CuiWidget; void cui_widget_set_name (CuiWidget *widget, const gchar *name); gchar* cui_widget_get_name (CuiWidget *widget); void cui_widget_set_active (CuiWidget *widget, gboolean active); gboolean cui_widget_get_active (CuiWidget *widget); void cui_widget_set_directory (CuiWidget *widget, const gchar *directory); gchar* cui_widget_get_directory (CuiWidget *widget); void cui_widget_set_background (CuiWidget *widget, const Background *background); Background* cui_widget_get_background (CuiWidget *widget); void cui_widget_set_terminal (CuiWidget *widget, const Terminal *terminal); Terminal* cui_widget_get_terminal (CuiWidget *widget); void cui_widget_set_appbar (CuiWidget *widget, GtkWidget *appbar); void cui_widget_set_tooltip (CuiWidget *widget, const gchar *tooltip); void cui_widget_set_active_style (CuiWidget *widget, const gchar *style); void cui_widget_add_tag_by_name (CuiWidget *widget, const gchar *tag); void cui_widget_set_area (CuiWidget *widget, const GdkRectangle *rectangle); void cui_widget_move (CuiWidget *widget, gint dx, gint dy); void cui_widget_set_area_by_coord (CuiWidget *widget, gint x, gint y, gint dx, gint dy); void cui_widget_set_area_by_marks (CuiWidget *widget, GtkTextMark *begin, GtkTextMark *end); void cui_widget_set_width_by_percent (CuiWidget *widget, gdouble percent); void cui_widget_set_start_and_stop_by_percent (CuiWidget *widget, gdouble start, gdouble stop); void cui_widget_set_area_by_iter (CuiWidget *widget, GtkTextIter *iter); GdkRectangle* cui_widget_get_area (CuiWidget *widget); GdkRectangle* cui_widget_get_area_window_coords (CuiWidget *widget); gint cui_widget_get_size (CuiWidget *widget); gboolean cui_widget_is_mouse_over (CuiWidget *widget, gint x, gint y); void cui_widget_mouse_enter (CuiWidget *widget); void cui_widget_mouse_leave (CuiWidget *widget); CuiCommand; void cui_widget_append_file_command (CuiWidget *widget, CuiCommandOpcode opcode, CuiFilename *file_arg); void cui_widget_append_file_command_with_arg (CuiWidget *widget, CuiCommandOpcode opcode, CuiFilename *file_arg, gpointer arg); void cui_widget_append_window_command (CuiWidget *widget, CuiCommandOpcode opcode, gpointer window); void cui_widget_append_window_command_with_arg (CuiWidget *widget, CuiCommandOpcode opcode, gpointer window, gpointer arg); void cui_widget_activate (CuiWidget *widget);
GObject +----CuiWidget +----CuiActionArea +----CuiPixmap +----CuiEntry +----CuiCalendar +----CuiPopupMenu +----CuiRectangle
"active" gboolean : Read / Write "active-style" gchararray : Read / Write "appbar" gpointer : Read / Write "area" gpointer : Read / Write "background" gpointer : Read / Write "directory" gchararray : Read / Write "name" gchararray : Read / Write "terminal" gpointer : Read / Write "tooltip" gchararray : Read / Write
typedef struct { gchar *name; gchar *groupname; GdkRectangle *area; gboolean active; gchar *tooltip; gchar *directory; Background *background; Terminal *terminal; GtkWidget *appbar; gboolean visible; GList *commands; GdkCursor *mouse_cursor_active; GdkCursor *mouse_cursor_inactive; gboolean mouse_is_over; GtkTextMark *begin_mark; GtkTextMark *end_mark; gchar *active_style; } CuiWidget;
This is a base class for the widgets in the CUI environment. Currently I'm marking some fields as public since I didn't write the accessing functions for them.
gchar *name ; | the name of the widget instance if any |
gchar *groupname ; | the name of the group if any |
GdkRectangle *area ; | the location and the size of the widget |
gboolean active ; | if the widget can be activated |
gchar *tooltip ; | some descriptive text for the user |
gchar *directory ; | the working directory of the command |
Background *background ; | the background this widgets belongs to |
Terminal *terminal ; | the terminal to send the commands to |
GtkWidget *appbar ; | for the tooltip information |
gboolean visible ; | if the widget is currently visible (FIXME: do we use this?) |
GList *commands ; | The list with the commands we want to execite when the widget is activated. |
GdkCursor *mouse_cursor_active ; | The mouse cursor we want to see over the widget. |
GdkCursor *mouse_cursor_inactive ; | The mouse cursor we want to see when the mouse leaves the widget. |
gboolean mouse_is_over ; | This field is TRUE if the mouse cursor is currently over the widget. |
GtkTextMark *begin_mark ; | |
GtkTextMark *end_mark ; | |
gchar *active_style ; |
void cui_widget_set_name (CuiWidget *widget, const gchar *name);
Sets the name for this widget instance. The name appears in messages, help texts and several other places.
widget : | |
name : | the name of the widget |
gchar* cui_widget_get_name (CuiWidget *widget);
Gets the name of this widget instance. The returned string should be freed.
widget : | |
Returns : | a newly allocated string |
void cui_widget_set_active (CuiWidget *widget, gboolean active);
Sets is the widget can be activated by the mouse.
widget : | |
active : | sets if the widget is an active one |
gboolean cui_widget_get_active (CuiWidget *widget);
Gets if the widget can be activated by the mouse.
widget : | |
Returns : | TRUE if the widget can be activated |
void cui_widget_set_directory (CuiWidget *widget, const gchar *directory);
Sets the directory for this widget instance. The directory shows what was the working directory when this widget has been created.
widget : | |
directory : | the working directory of the widget's creator |
gchar* cui_widget_get_directory (CuiWidget *widget);
Gets the working directory of this widget instance.
widget : | |
Returns : | a newly allocated string |
void cui_widget_set_background (CuiWidget *widget, const Background *background);
Sets the background for this widget instance. The background is the place where we show the widget. This function also registers the widget calling cui_background_append_widget.
widget : | |
background : | the background this widget belongs to |
Background* cui_widget_get_background (CuiWidget *widget);
Gets the background this widget instance appears on.
widget : | |
Returns : | a pointer to the background |
void cui_widget_set_terminal (CuiWidget *widget, const Terminal *terminal);
Sets the terminal for this widget instance. The terminal is a Terminal object we send the commands to execute.
widget : | |
terminal : | the terminal we use to send the commands to the shell |
Terminal* cui_widget_get_terminal (CuiWidget *widget);
Gets the terminal of this widget. The terminal is a Terminal object we use to send the command to the shell.
widget : | |
Returns : | a pointer to the background |
void cui_widget_set_appbar (CuiWidget *widget, GtkWidget *appbar);
Sets the appbar for this widget instance. The appbar is a widget where we send tooltip text when needed.
widget : | |
appbar : | the application bar we send the tooltip text |
void cui_widget_set_tooltip (CuiWidget *widget, const gchar *tooltip);
Sets the tooltip text for this widget instance. The tooltip text is a short remainder appears in a different GtkWidget.
widget : | |
tooltip : | the tooltip text of the widget |
void cui_widget_set_active_style (CuiWidget *widget, const gchar *style);
Sets the active style name text for this widget instance. The active style is a text style used when the mouse is over the widget.
widget : | |
style : | the active style text of the widget |
void cui_widget_add_tag_by_name (CuiWidget *widget, const gchar *tag);
Convinient utility function to highlight the text belongs to the widget.
widget : | a CuiWidget widget |
tag : | the name of the tag to apply |
void cui_widget_set_area (CuiWidget *widget, const GdkRectangle *rectangle);
Sets the activation area for this widget instance. This function will copy the GdkRectangle to an allocated memory, so it can be freed.
widget : | |
rectangle : | the rectangle of the activation area for this widget |
void cui_widget_move (CuiWidget *widget, gint dx, gint dy);
Moves the widget by modifying its coordinates.
widget : | the widget to move |
dx : | movement on the x axis |
dy : | movement on the y axis |
void cui_widget_set_area_by_coord (CuiWidget *widget, gint x, gint y, gint dx, gint dy);
Sets the activation area for this widget instance.
widget : | |
x : | the x coordinate |
y : | the y coordinate |
dx : | the width |
dy : | the height |
void cui_widget_set_area_by_marks (CuiWidget *widget, GtkTextMark *begin, GtkTextMark *end);
Sets the activation area for this widget instance. This function copy the marks so they can be eliminated.
widget : | |
begin : | the GtkTextMark of the upper left corner |
end : | the GtkTextMark of the lower right corner |
void cui_widget_set_width_by_percent (CuiWidget *widget, gdouble percent);
Sets the width of the widget as the fraction of the background text window.
widget : | |
percent : | the new width of the widget as a fraction of 100 |
void cui_widget_set_start_and_stop_by_percent (CuiWidget *widget, gdouble start, gdouble stop);
Sets the left and right coordinates of the widget as the fraction of the background text window.
widget : | |
start : | |
stop : |
|
void cui_widget_set_area_by_iter (CuiWidget *widget, GtkTextIter *iter);
Sets the activation area of the widgets using a GtkTextIter to find a character. This function is usefull to create action areas for one given character on the user interface.
widget : | a CuiWidget to set |
iter : | the GtkTextIter storing the place of the char |
GdkRectangle* cui_widget_get_area (CuiWidget *widget);
Gets the activation area of this widget. The return value should not be modified or freed.
widget : | |
Returns : | the rectangular area of the widget |
GdkRectangle* cui_widget_get_area_window_coords (CuiWidget *widget);
Gets the activation area of this widget relative to the text_view this widget is in. Note that the Background of the widget must be valid and the GtkTextView of the Background also must be set.
The return value of the function is a dinamically allocated area which should be freed.
widget : | |
Returns : | the rectangular area of the widget relative to the text_view |
gboolean cui_widget_is_mouse_over (CuiWidget *widget, gint x, gint y);
Checks if the mouse is over the given widget, that is the given coordinates are inside the activation area.
This function gets x and y coordinate in the widget coordinate system. Use # gtk_text_view_window_to_buffer_coords to convert mouse coordinates to this coordinate system.
widget : | |
x : | the x coordinate of the mouse |
y : | the y coordinate of the mouse |
Returns : | TRUE if the given coordinates are inside the activation area |
void cui_widget_mouse_enter (CuiWidget *widget);
This function must be called when the mouse enters the area of the widget. I'm sure there is a better solution, but I have not found yet... yep, found we should use signals of course. FIXME: we really should use signals.
widget : | a CuiWidget widget |
void cui_widget_mouse_leave (CuiWidget *widget);
This function must be called when the mouse leaves the area of the widget. I'm sure there is a better solution, but I have not found yet...
widget : | a CuiWidget widget |
typedef struct { CuiCommandType type; CuiCommandOpcode opcode; gpointer parg1; gpointer parg2; } CuiCommand;
CuiCommandType type ; | the type of the command used to decide how to perform |
CuiCommandOpcode opcode ; | the operation code (what to do) |
gpointer parg1 ; | a pointer argument |
gpointer parg2 ; | an optional second argument |
void cui_widget_append_file_command (CuiWidget *widget, CuiCommandOpcode opcode, CuiFilename *file_arg);
The functions appends a new command to the widget. The commands are instructions we have to execute when the user activates the widget. As it is obvious I'm not exactly sure how we have to develop this command feature, but it is essential to send lines to the shell.
This function handles only commands used to handle files.
widget : | |
opcode : | the code of this operation |
file_arg : | the CuiFilename argument of the command |
void cui_widget_append_file_command_with_arg (CuiWidget *widget, CuiCommandOpcode opcode, CuiFilename *file_arg, gpointer arg);
widget : | |
opcode : | |
file_arg : | |
arg : |
|
void cui_widget_append_window_command (CuiWidget *widget, CuiCommandOpcode opcode, gpointer window);
Appends a new window command to the widget.
widget : | |
opcode : | the opcode of the command |
window : |
void cui_widget_append_window_command_with_arg (CuiWidget *widget, CuiCommandOpcode opcode, gpointer window, gpointer arg);
Appends a new window command to the widget.
widget : | |
opcode : | the opcode of the command |
window : | |
arg : | the argument |
"active" gboolean : Read / Write
If this widget is shown and working.
Default value: TRUE
"active-style" gchararray : Read / Write
Text style for the active state if any.
Default value: ""
"appbar" gpointer : Read / Write
The GtkWidget to send the tooltip information.
"background" gpointer : Read / Write
The background containing this widget.
"directory" gchararray : Read / Write
The working directory of the creator command.
Default value: ""
"name" gchararray : Read / Write
The name of this widget instance.
Default value: "unknown name"
<<< program | CuiRectangle >>> |