The Gnome Chemistry Utils  0.14.0
Macros | Typedefs | Enumerations | Functions
gcuperiodic.h File Reference
#include <gdk/gdk.h>
#include <gtk/gtk.h>

Go to the source code of this file.

Macros

#define GCU_TYPE_PERIODIC   (gcu_periodic_get_type ())
#define GCU_PERIODIC(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCU_TYPE_PERIODIC, GcuPeriodic))
#define GCU_PERIODIC_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GCU_TYPE_PERIODIC, GcuPeriodicClass))
#define GCU_IS_PERIODIC(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCU_TYPE_PERIODIC))
#define GCU_IS_PERIODIC_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GCU_TYPE_PERIODIC))
#define GCU_PERIODIC_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GCU_TYPE_PERIODIC, GcuPeriodicClass))

Typedefs

typedef struct _GcuPeriodic GcuPeriodic
typedef struct _GcuPeriodicClass GcuPeriodicClass
typedef void(* GcuPeriodicColorFunc )(int, GdkRGBA *, gpointer)

Enumerations

enum  GcuPeriodicColorSchemes
enum  GcuPeriodicTipSchemes { GCU_PERIODIC_TIP_NAME, GCU_PERIODIC_TIP_STANDARD }

Functions

GType gcu_periodic_get_type (void) G_GNUC_CONST
GtkWidget * gcu_periodic_new (void)
guint gcu_periodic_get_element (GcuPeriodic *periodic)
void gcu_periodic_set_element (GcuPeriodic *periodic, guint element)
int gcu_periodic_add_color_scheme (GcuPeriodic *periodic, GcuPeriodicColorFunc func, GtkWidget *extra_widget, gpointer user_data)
void gcu_periodic_set_colors (GcuPeriodic *periodic)
void gcu_periodic_set_tips (GcuPeriodic *periodic, unsigned scheme)

Detailed Description

Declaration of the GcuPeriodic widget.

Definition in file gcuperiodic.h.

Macro Definition Documentation

#define GCU_IS_PERIODIC (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCU_TYPE_PERIODIC))
Returns
TRUE if obj points to a GcuPeriodic widget, FALSE otherwise.

Definition at line 82 of file gcuperiodic.h.

Referenced by gcu_periodic_get_element(), and gcu_periodic_set_element().

#define GCU_IS_PERIODIC_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCU_TYPE_PERIODIC))
Returns
TRUE if klass points to a GcuPeriodicClass, FALSE otherwise.

Definition at line 86 of file gcuperiodic.h.

#define GCU_PERIODIC (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCU_TYPE_PERIODIC, GcuPeriodic))

Casts obj to a GcuPeriodic * pointer.

Returns
a pointer to the GcuPeriodic * or NULL if obj does not point to a GcuPeriodic widget.

Definition at line 73 of file gcuperiodic.h.

Referenced by gcu_combo_periodic_get_element(), gcu_combo_periodic_set_element(), and main().

#define GCU_PERIODIC_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GCU_TYPE_PERIODIC, GcuPeriodicClass))

Casts klass to a GcuPeriodicClass * pointer.

Returns
a pointer to the GcuPeriodicClass * or NULL if obj not point to a GcuPeriodicClass.

Definition at line 78 of file gcuperiodic.h.

#define GCU_PERIODIC_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GCU_TYPE_PERIODIC, GcuPeriodicClass))
Returns
the GcuPeriodicClass * associated to obj if obj points to a GcuPeriodic widget, NULL otherwise.

Definition at line 91 of file gcuperiodic.h.

#define GCU_TYPE_PERIODIC   (gcu_periodic_get_type ())
Returns
the GType associated to GcuPeriodic

Definition at line 67 of file gcuperiodic.h.

Typedef Documentation

typedef struct _GcuPeriodic GcuPeriodic

The GcuPeriodic widget.

Definition at line 94 of file gcuperiodic.h.

typedef struct _GcuPeriodicClass GcuPeriodicClass

The GcuPeriodic widget object class.

Definition at line 96 of file gcuperiodic.h.

typedef void(* GcuPeriodicColorFunc)(int, GdkRGBA *, gpointer)

The callback used for color schemes. It takes three arguments:

  • the atomic number Z.
  • a pointer to the GdkColor structure to be filled by the callback
  • a pointer to user's data.

Definition at line 140 of file gcuperiodic.h.

Enumeration Type Documentation

Predefined coloring scheme used for the buttons when displaying the periodic table of the GcuPeriodic widget. Possible values are:

  • GCU_PERIODIC_COLOR_NONE: the default Gtk theme is used.
  • GCU_PERIODIC_COLOR_DEFAULT: the default color for each element is used as returned by gcu_element_get_default_color. Other values can be added using gcu_periodic_add_color_scheme.

Definition at line 43 of file gcuperiodic.h.

Predefined tipsg scheme used when the mouse cursor is over an element button.

Enumerator:
GCU_PERIODIC_TIP_NAME 

Show the element name in the tips popup.

GCU_PERIODIC_TIP_STANDARD 

Show the element atomic number, symbol, name, electronic configuration, and atomic weight.

Definition at line 53 of file gcuperiodic.h.

Function Documentation

int gcu_periodic_add_color_scheme ( GcuPeriodic periodic,
GcuPeriodicColorFunc  func,
GtkWidget *  extra_widget,
gpointer  user_data 
)
Parameters
periodica GcuPeriodic widget.
functhe callback used to get the color for an element in the new color scheme.
extra_widgeta widget to be added as a child of periodic.
user_datadata to be passed to the func callback.

Using this function and the appropriate callback, the color used for the elements buttons can be changed to depend on any property of the elements.

Returns
the identifier of the new color scheme.

Definition at line 399 of file gcuperiodic.c.

guint gcu_periodic_get_element ( GcuPeriodic periodic)

gcu_periodic_get_element:

Parameters
periodica GcuPeriodic widget

Description: used to get the currently selected element in the periodic table.

Returns: the atomic number of the currently selected element or %0 if none is selected.

Definition at line 317 of file gcuperiodic.c.

References GCU_IS_PERIODIC.

GType gcu_periodic_get_type ( void  )
Returns
the GType associated to GcuPeriodic
GtkWidget* gcu_periodic_new ( void  )
Returns
a new GcuPeriodic

Referenced by main().

void gcu_periodic_set_colors ( GcuPeriodic periodic)
Parameters
periodica GcuPeriodic widget.

Forces the update of the current color scheme. This is useful when the color scheme depends upon a parameter which has changed.

Definition at line 340 of file gcuperiodic.c.

References gcu_element_get_default_color().

void gcu_periodic_set_element ( GcuPeriodic periodic,
guint  element 
)

gcu_periodic_set_element:

Parameters
periodica GcuPeriodic widget
elementthe atomic number of the element to select or 0

Description: sets the selected element in the periodic table.

Definition at line 323 of file gcuperiodic.c.

References GCU_IS_PERIODIC.

void gcu_periodic_set_tips ( GcuPeriodic periodic,
unsigned  scheme 
)
Parameters
periodica GcuPeriodic widget.
schemea tips scheme identifier.

Configures the element buttons tips. scheme must be one of the values defined in the GcuPeriodicTipSchemes enum.

Definition at line 413 of file gcuperiodic.c.

References gcu_element_get_electronic_configuration(), gcu_element_get_name(), gcu_element_get_symbol(), gcu_element_get_weight_as_string(), GCU_PERIODIC_TIP_NAME, and GCU_PERIODIC_TIP_STANDARD.