![]() |
![]() |
![]() |
Libmergeant Reference Manual | ![]() |
---|---|---|---|---|
MgDataEntryMgDataEntry — Interface which provides the user with specific widgets to manipulate data |
MgDataEntry; enum MgDataEntryAttribute; MgDataEntryIface; guint mg_data_entry_get_type (void); void mg_data_entry_set_value_type (MgDataEntry *de, GdaValueType type); GdaValueType mg_data_entry_get_value_type (MgDataEntry *de); void mg_data_entry_set_value (MgDataEntry *de, const GdaValue *value); GdaValue* mg_data_entry_get_value (MgDataEntry *de); void mg_data_entry_set_value_orig (MgDataEntry *de, const GdaValue *value); const GdaValue* mg_data_entry_get_value_orig (MgDataEntry *de); void mg_data_entry_set_current_as_orig (MgDataEntry *de); void mg_data_entry_set_value_default (MgDataEntry *de, const GdaValue *value); void mg_data_entry_set_attributes (MgDataEntry *de, guint attrs, guint mask); guint mg_data_entry_get_attributes (MgDataEntry *de); MgDataHandler* mg_data_entry_get_handler (MgDataEntry *de); gboolean mg_data_entry_expand_in_layout (MgDataEntry *de);
MgDataEntry is implemented by MgEntryTime, MgEntryCombo, MgEntryString, MgEntryNone, MgEntryCidr, MgEntryBoolean, MgEntryPassmd5 and MgEntryWrapper.
"contents-modified" void user_function (MgDataEntry *mgdataentry, gpointer user_data) : Run first "status-changed" void user_function (MgDataEntry *mgdataentry, gpointer user_data) : Run first
This interface is implemented by widgets to enable users to manipulate data of different types. Such widgets are created by objects implementing the MgDataHandler interface.
typedef enum { MG_DATA_ENTRY_IS_NULL = 1 << 0, /* READ | WRITE */ MG_DATA_ENTRY_CAN_BE_NULL = 1 << 1, /* READ | WRITE */ MG_DATA_ENTRY_IS_DEFAULT = 1 << 2, /* READ | WRITE */ MG_DATA_ENTRY_CAN_BE_DEFAULT = 1 << 3, /* READ | WRITE */ MG_DATA_ENTRY_IS_UNCHANGED = 1 << 4, /* READ | WRITE */ MG_DATA_ENTRY_ACTIONS_SHOWN = 1 << 5, /* READ | WRITE */ MG_DATA_ENTRY_DATA_NON_VALID = 1 << 6, /* READ */ MG_DATA_ENTRY_HAS_VALUE_ORIG = 1 << 7 /* READ */ } MgDataEntryAttribute;
typedef struct { GTypeInterface g_iface; /* signals */ void (* contents_modified) (MgDataEntry *de); void (* status_changed) (MgDataEntry *de); /* virtual table */ void ( *set_value_type) (MgDataEntry *de, GdaValueType type); GdaValueType ( *get_value_type) (MgDataEntry *de); void ( *set_value) (MgDataEntry *de, const GdaValue * value); GdaValue *( *get_value) (MgDataEntry *de); void ( *set_value_orig) (MgDataEntry *de, const GdaValue * value); const GdaValue *( *get_value_orig) (MgDataEntry *de); void ( *set_value_default) (MgDataEntry *de, const GdaValue * value); void ( *set_attributes) (MgDataEntry *de, guint attrs, guint mask); guint ( *get_attributes) (MgDataEntry *de); MgDataHandler *( *get_handler) (MgDataEntry *de); gboolean ( *expand_in_layout) (MgDataEntry *de); } MgDataEntryIface;
void mg_data_entry_set_value_type (MgDataEntry *de, GdaValueType type);
Sets the type of value the MgDataEntry will handle. The type must be compatible with what the widget can handle.
de : |
a GtkWidget object which implements the MgDataEntry interface |
type : |
GdaValueType mg_data_entry_get_value_type (MgDataEntry *de);
Fetch the type of data the MgDataEntry handles
de : |
a GtkWidget object which implements the MgDataEntry interface |
Returns : | the GdaValueType type |
void mg_data_entry_set_value (MgDataEntry *de, const GdaValue *value);
Push a value into the MgDataEntry. The value parameter must either be: - NULL or of type GDA_VALUE_TYPE_NULL, or - of type specified using mg_data_entry_set_value_type.
de : |
a GtkWidget object which implements the MgDataEntry interface |
value : |
GdaValue* mg_data_entry_get_value (MgDataEntry *de);
Fetch the value held in the MgDataEntry widget. If the value is set to NULL,
the returned value is of type GDA_VALUE_TYPE_NULL. If the value is set to default,
then the returned value is of type GDA_VALUE_TYPE_NULL or is the default value if it
has been provided to the widget (and is of the same type as the one provided by de
).
de : |
a GtkWidget object which implements the MgDataEntry interface |
Returns : | a new GdaValue |
void mg_data_entry_set_value_orig (MgDataEntry *de, const GdaValue *value);
Push a value into the MgDataEntry in the same way as mg_data_entry_set_value()
but
also sets this value as the original value.
de : |
a GtkWidget object which implements the MgDataEntry interface |
value : |
const GdaValue* mg_data_entry_get_value_orig (MgDataEntry *de);
Fetch the original value held in the MgDataEntry widget
de : |
a GtkWidget object which implements the MgDataEntry interface |
Returns : | the GdaValue |
void mg_data_entry_set_current_as_orig (MgDataEntry *de);
Tells that the current value in de
is to be considered as the original value
de : |
a GtkWidget object which implements the MgDataEntry interface |
void mg_data_entry_set_value_default (MgDataEntry *de, const GdaValue *value);
Sets the default value for the MgDataEntry which gets displayed when the user forces the default value. If it is not set then it is set to type GDA_VALUE_TYPE_NULL. The value parameter must either be: - NULL or of type GDA_VALUE_TYPE_NULL, or - of type specified using mg_data_entry_set_value_type.
de : |
a GtkWidget object which implements the MgDataEntry interface |
value : |
void mg_data_entry_set_attributes (MgDataEntry *de, guint attrs, guint mask);
Sets the parameters of the MgDataEntry. Only the attributes corresponding to the mask are set, the other ones are ignored.
de : |
a GtkWidget object which implements the MgDataEntry interface |
attrs : |
the attributes to set (OR'ed between them) |
mask : |
the mask corresponding to the considered attributes |
guint mg_data_entry_get_attributes (MgDataEntry *de);
Retreives the parameters of the MgDataEntry widget.
de : |
a GtkWidget object which implements the MgDataEntry interface |
Returns : | the OR'ed bits corresponding to the attributes. |
MgDataHandler* mg_data_entry_get_handler (MgDataEntry *de);
Fetch the MgDataHandler the MgDataEntry is using
de : |
a GtkWidget object which implements the MgDataEntry interface |
Returns : | the MgDataHandler object |
gboolean mg_data_entry_expand_in_layout (MgDataEntry *de);
Used for the layout of the widget in containers.
de : |
a GtkWidget object which implements the MgDataEntry interface |
Returns : | TRUE if the widget should expand |
void user_function (MgDataEntry *mgdataentry, gpointer user_data) : Run first
mgdataentry : |
the object which received the signal. |
user_data : |
user data set when the signal handler was connected. |
void user_function (MgDataEntry *mgdataentry, gpointer user_data) : Run first
mgdataentry : |
the object which received the signal. |
user_data : |
user data set when the signal handler was connected. |