本文整理汇总了C++中OBJ_GET函数的典型用法代码示例。如果您正苦于以下问题:C++ OBJ_GET函数的具体用法?C++ OBJ_GET怎么用?C++ OBJ_GET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OBJ_GET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ms1_tlogger_button_handler
EXPORT gboolean ms1_tlogger_button_handler(GtkWidget * widget, gpointer data)
{
gint handler = (GINT)OBJ_GET(widget, "handler");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
{ /* It's pressed (or checked) */
switch ((ToggleButton)handler)
{
case START_TOOTHMON_LOGGER:
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget("triggerlogger_buttons_table")),FALSE);
bind_ttm_to_page((GINT)OBJ_GET(widget,"page"));
start_tickler(TOOTHMON_TICKLER);
break;
case START_TRIGMON_LOGGER:
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget("toothlogger_buttons_table")),FALSE);
bind_ttm_to_page((GINT)OBJ_GET(widget,"page"));
start_tickler(TRIGMON_TICKLER);
break;
case STOP_TOOTHMON_LOGGER:
stop_tickler(TOOTHMON_TICKLER);
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget("triggerlogger_buttons_table")),TRUE);
break;
case STOP_TRIGMON_LOGGER:
stop_tickler(TRIGMON_TICKLER);
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget("toothlogger_buttons_table")),TRUE);
break;
default:
break;
}
}
return TRUE;
}
示例2: ecu_toggle_button_handler
/*!
\brief ECU specific toggle button handler
\param widget is a pointer to the widget the user modified
\param data is unused
\returns TRUE
*/
G_MODULE_EXPORT gboolean ecu_toggle_button_handler(GtkWidget *widget, gpointer data)
{
extern MS2_TTMon_Data *ttm_data;
gint handler = -1;
ENTER();
handler = (GINT)OBJ_GET(widget,"handler");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
{ /* It's pressed (or checked) */
switch ((MS2ToggleHandler)handler)
{
case START_TOOTHMON_LOGGER:
ttm_data->stop = FALSE;
OBJ_SET(ttm_data->darea,"io_cmd_function",(gpointer)"ms2_e_read_toothmon");
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget_f("triggerlogger_buttons_table")),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget_f("compositelogger_buttons_table")),FALSE);
bind_ttm_to_page((GINT)OBJ_GET(widget,"page"));
io_cmd_f("ms2_e_read_toothmon",NULL);
break;
case START_TRIGMON_LOGGER:
ttm_data->stop = FALSE;
OBJ_SET(ttm_data->darea,"io_cmd_function",(gpointer)"ms2_e_read_trigmon");
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget_f("toothlogger_buttons_table")),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget_f("compositelogger_buttons_table")),FALSE);
bind_ttm_to_page((GINT)OBJ_GET(widget,"page"));
io_cmd_f("ms2_e_read_trigmon",NULL);
break;
case START_COMPOSITEMON_LOGGER:
ttm_data->stop = FALSE;
OBJ_SET(ttm_data->darea,"io_cmd_function",(gpointer)"ms2_e_read_compositemon");
alter_widget_state_f(GTK_WIDGET(lookup_widget_f("toothlogger_buttons_table")),NULL);
alter_widget_state_f(GTK_WIDGET(lookup_widget_f("triggerlogger_buttons_table")),NULL);
bind_ttm_to_page((GINT)OBJ_GET(widget,"page"));
io_cmd_f("ms2_e_read_compositemon",NULL);
break;
case STOP_TOOTHMON_LOGGER:
ttm_data->stop = TRUE;
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget_f("triggerlogger_buttons_table")),TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(lookup_widget_f("compositelogger_buttons_table")),TRUE);
break;
case STOP_TRIGMON_LOGGER:
ttm_data->stop = TRUE;
alter_widget_state_f(GTK_WIDGET(lookup_widget_f("toothlogger_buttons_table")),NULL);
alter_widget_state_f(GTK_WIDGET(lookup_widget_f("compositelogger_buttons_table")),NULL);
break;
case STOP_COMPOSITEMON_LOGGER:
ttm_data->stop = TRUE;
alter_widget_state_f(GTK_WIDGET(lookup_widget_f("toothlogger_buttons_table")),NULL);
alter_widget_state_f(GTK_WIDGET(lookup_widget_f("triggerlogger_buttons_table")),NULL);
break;
default:
MTXDBG(CRITICAL,_("Default case reached, i.e. handler not found in global, common or ECU plugins for widget %s, BUG!\n"),glade_get_widget_name(widget));
break;
}
}
EXIT();
return TRUE;
}
示例3: gauge_motion
gboolean gauge_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
GtkWidget *x_spin = NULL;
GtkWidget *y_spin = NULL;
GtkWidget *x_o_spin = NULL;
GtkWidget *y_o_spin = NULL;
gfloat x_origin = 0.0;
gfloat y_origin = 0.0;
x_spin = (GtkWidget *)OBJ_GET(widget,"x_spin");
y_spin = (GtkWidget *)OBJ_GET(widget,"y_spin");
if ((!GTK_IS_WIDGET(x_spin)) || (!GTK_IS_WIDGET(y_spin)))
return FALSE;
if ((GBOOLEAN)OBJ_GET(x_spin,"relative"))
{
x_o_spin = (GtkWidget *)OBJ_GET(x_spin,"x_o_spin");
y_o_spin = (GtkWidget *)OBJ_GET(x_spin,"y_o_spin");
x_origin = gtk_spin_button_get_value(GTK_SPIN_BUTTON(x_o_spin));
y_origin = gtk_spin_button_get_value(GTK_SPIN_BUTTON(y_o_spin));
if (GTK_IS_WIDGET(x_spin))
gtk_spin_button_set_value(GTK_SPIN_BUTTON(x_spin),((event->x-(widget->allocation.width/2.0))/(widget->allocation.width/2.0))-x_origin);
if (GTK_IS_WIDGET(y_spin))
gtk_spin_button_set_value(GTK_SPIN_BUTTON(y_spin),((event->y-(widget->allocation.height/2.0))/(widget->allocation.height/2.0))-y_origin);
}
else
{
if (GTK_IS_WIDGET(x_spin))
gtk_spin_button_set_value(GTK_SPIN_BUTTON(x_spin),(event->x-(widget->allocation.width/2.0))/(widget->allocation.width/2.0));
if (GTK_IS_WIDGET(y_spin))
gtk_spin_button_set_value(GTK_SPIN_BUTTON(y_spin),(event->y-(widget->allocation.height/2.0))/(widget->allocation.height/2.0));
}
return TRUE;
}
示例4: add_additional_rtt
/*!
\brief add_additional_rtt() is called as a post function for Tab loading
to add an RTT on a normal widget tab. (AE wizard currently)
\param widget, pointer to widget containing the data needed
*/
G_MODULE_EXPORT void add_additional_rtt(GtkWidget *widget)
{
GHashTable *rtt_hash = NULL;
gchar * ctrl_name = NULL;
gchar * source = NULL;
Rt_Text *rt_text = NULL;
gboolean show_prefix = FALSE;
rtt_hash = DATA_GET(global_data,"rtt_hash");
ctrl_name = OBJ_GET(widget,"ctrl_name");
source = OBJ_GET(widget,"source");
show_prefix = (GBOOLEAN)OBJ_GET(widget,"show_prefix");
if (!rtt_hash)
{
rtt_hash = g_hash_table_new_full(g_str_hash,g_str_equal,g_free,dealloc_rtt);
DATA_SET_FULL(global_data,"rtt_hash",(gpointer)rtt_hash,g_hash_table_destroy);
}
if ((rtt_hash) && (ctrl_name) && (source))
rt_text = add_rtt(widget,ctrl_name,source,show_prefix);
if (rt_text)
{
if (!g_hash_table_lookup(rtt_hash,ctrl_name))
g_hash_table_insert(rtt_hash,
g_strdup(ctrl_name),
(gpointer)rt_text);
}
return;
}
示例5: close_2d_editor
/*!
\brief Closes a 2-D table editor and deallocates any required resources
\param widget is the 2D table editor window containing the widget list to
be deallocated
\param data is unused
\returns FALSE
*/
G_MODULE_EXPORT gboolean close_2d_editor(GtkWidget * widget, gpointer data)
{
GList *list = NULL;
list = OBJ_GET(widget, "widget_list");
if (list)
{
g_list_foreach(list,remove_widget,NULL);
g_list_free(list);
list = NULL;
}
list = OBJ_GET(widget, "curve_list");
if (list)
{
g_list_foreach(list,clean_curve,NULL);
g_list_free(list);
list = NULL;
}
list = OBJ_GET(widget, "gauge_list");
if (list)
{
g_list_foreach(list,gauge_cleanup,NULL);
g_list_free(list);
list = NULL;
}
gtk_widget_destroy(widget);
return FALSE;
}
示例6: list_object_sort
gint list_object_sort(gconstpointer a, gconstpointer b, gpointer data)
{
GObject *a1 = (GObject *)a;
GObject *b1 = (GObject *)b;
const gchar *key = (const gchar *)data;
return g_ascii_strcasecmp((gchar *)OBJ_GET(a1,key),(gchar *)OBJ_GET(b1,key));
}
示例7: generic_spin_button_handler
G_MODULE_EXPORT gboolean generic_spin_button_handler(GtkWidget *widget, gpointer data)
{
gfloat tmpf = 0.0;
MtxGaugeFace *g = NULL;
gint handler = 0;
tmpf = (gfloat)gtk_spin_button_get_value((GtkSpinButton *)widget);
if (!OBJ_GET((widget),"handler"))
{
printf("control %s has no handler\n",(gchar *)gtk_widget_get_name(widget));
return FALSE;
}
handler = (GINT)OBJ_GET((widget),"handler");
if (GTK_IS_WIDGET(gauge))
g = MTX_GAUGE_FACE(gauge);
else
return FALSE;
if (hold_handlers)
return TRUE;
changed = TRUE;
mtx_gauge_face_set_attribute(g,handler,tmpf);
if ((handler == UBOUND) || (handler == LBOUND))
update_attributes();
return TRUE;
}
示例8: ecu_std_button_handler
/*!
\brief ECU specific std button handler
\param widget is a pointer to the widget the user modified
\param data is unused
\returns TRUE
*/
G_MODULE_EXPORT gboolean ecu_std_button_handler(GtkWidget *widget, gpointer data)
{
gint handler = 0;
gchar *tmpbuf = NULL;
gfloat tmpf = 0.0;
const gchar *dest = NULL;
ENTER();
handler = (MS2StdHandler)(GINT)OBJ_GET(widget,"handler");
switch ((MS2StdHandler)handler)
{
case GET_CURR_TPS:
tmpbuf = (gchar *)OBJ_GET(widget,"source");
lookup_current_value_f(tmpbuf,&tmpf);
dest = (const gchar *)OBJ_GET(widget,"dest_widget");
tmpbuf = g_strdup_printf("%.0f",tmpf);
gtk_entry_set_text(GTK_ENTRY(lookup_widget_f(dest)),tmpbuf);
g_signal_emit_by_name(lookup_widget_f(dest),"activate",NULL);
g_free(tmpbuf);
break;
default:
MTXDBG(CRITICAL,_("ERROR handler NOT found for widget %s, command aborted! BUG!!!\n"),glade_get_widget_name(widget));
break;
}
EXIT();
return TRUE;
}
示例9: alter_widget_state
/*!
\brief sets a widget sensitive or insensitive based on the status of
dependant groups
\param key is the pointer to Widget
\param data is unused
*/
G_MODULE_EXPORT void alter_widget_state(gpointer key, gpointer data)
{
GtkWidget * widget = key;
gchar * tmpbuf = NULL;
//const gchar * name = NULL;
gchar ** groups = NULL;
gint num_groups = 0;
gint i = 0;
gboolean value = FALSE;
gboolean state = FALSE;
MatchType type = AND;
GHashTable *widget_group_states = NULL;
if (!GTK_IS_WIDGET(widget))
return;
if (!OBJ_GET(widget,"bind_to_list"))
{
/* Not in a list, then enable it */
gtk_widget_set_sensitive(GTK_WIDGET(widget),TRUE);
/*name = glade_get_widget_name(widget);
MTXDBG(CRITICAL,(_("alter_widget_state(): Error with widget \"%s\", bind_to_list is null\n"),(name == NULL ? "undefined":name)));*/
return;
}
else
tmpbuf = (gchar *)OBJ_GET(widget,"bind_to_list");
widget_group_states = DATA_GET(global_data,"widget_group_states");
if (OBJ_GET(widget,"match_type"))
type = (MatchType)OBJ_GET(widget,"match_type");
groups = parse_keys(tmpbuf,&num_groups,",");
state = TRUE;
/*printf("setting state for %s in groups \"%s\" to:",(gchar *) OBJ_GET(widget,"name"),tmpbuf);*/
for (i=0;i<num_groups;i++)
{
value = (GBOOLEAN)g_hash_table_lookup(widget_group_states,groups[i]);
if (type == AND)
{
if (value == FALSE)
{
state = FALSE;
break;
}
}
else if (type == OR)
{
if (value == TRUE)
{
state = TRUE;
break;
}
else
state = FALSE;
}
}
g_strfreev(groups);
/*printf("%i\n",state);*/
gtk_widget_set_sensitive(GTK_WIDGET(widget),state);
}
示例10: gauge_cleanup
/*!
\brief removes the watch that drives the gauge on the 2D editor winddow
\param gauge_ptr is the pointer to the Gauge object
\param data is unused
*/
G_MODULE_EXPORT void gauge_cleanup(gpointer gauge_ptr, gpointer data)
{
gint id = 0;
GtkWidget *widget = (GtkWidget *)gauge_ptr;
if (OBJ_GET(widget, "gauge_id"))
{
id = (GINT)OBJ_GET(widget, "gauge_id");
remove_rtv_watch_f(id);
}
}
示例11: alter_tgroup_data
gboolean alter_tgroup_data(GtkWidget *widget, gpointer data)
{
gint index = (GINT)OBJ_GET((widget),"index");
gfloat value = 0.0;
gchar * tmpbuf = NULL;
GdkColor color;
TgField field = (TgField)OBJ_GET(widget,"handler");
if (!GTK_IS_WIDGET(gauge))
return FALSE;
switch (field)
{
case TG_FONT_SCALE:
case TG_LAYER:
case TG_TEXT_INSET:
case TG_MAJ_TICK_INSET:
case TG_MIN_TICK_INSET:
case TG_MAJ_TICK_WIDTH:
case TG_MAJ_TICK_LENGTH:
case TG_MIN_TICK_WIDTH:
case TG_MIN_TICK_LENGTH:
case TG_START_ANGLE:
case TG_SWEEP_ANGLE:
case TG_NUM_MAJ_TICKS:
case TG_NUM_MIN_TICKS:
value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
mtx_gauge_face_alter_tick_group(MTX_GAUGE_FACE(gauge),index,field,(void *)&value);
break;
case TG_MAJ_TICK_COLOR_DAY:
case TG_MAJ_TICK_COLOR_NITE:
case TG_MIN_TICK_COLOR_DAY:
case TG_MIN_TICK_COLOR_NITE:
case TG_TEXT_COLOR_DAY:
case TG_TEXT_COLOR_NITE:
gtk_color_button_get_color(GTK_COLOR_BUTTON(widget),&color);
mtx_gauge_face_alter_tick_group(MTX_GAUGE_FACE(gauge),index,field,(void *)&color);
break;
case TG_FONT:
tmpbuf = g_strdup(gtk_font_button_get_font_name (GTK_FONT_BUTTON(widget)));
tmpbuf = g_strchomp(g_strdelimit(tmpbuf,"0123456789",' '));
mtx_gauge_face_alter_tick_group(MTX_GAUGE_FACE(gauge),index,field,(void *)tmpbuf);
g_free(tmpbuf);
break;
case TG_TEXT:
tmpbuf = g_strdup(gtk_entry_get_text (GTK_ENTRY(widget)));
mtx_gauge_face_alter_tick_group(MTX_GAUGE_FACE(gauge),index,field,(void *)tmpbuf);
g_free(tmpbuf);
default:
break;
}
return TRUE;
}
示例12: main
int main (int argc, char ** argv )
{
GtkWidget *vbox;
gchar *filename = NULL;
gchar *tmpbuf = NULL;
gchar *dirname = NULL;
GError *error = NULL;
gtk_init (&argc, &argv);
filename = get_file(g_build_filename(DASHDESIGNER_GLADE_DIR,"main.ui",NULL),NULL);
if (filename)
{
toplevel = gtk_builder_new();
if(!gtk_builder_add_from_file(toplevel,filename,&error))
{
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free(error);
exit(-1);
}
g_free(filename);
}
else
{
printf("Can't locate primary ui file!!!!\n");
exit(-1);
}
gtk_builder_connect_signals(toplevel,NULL);
main_window = GTK_WIDGET (gtk_builder_get_object(toplevel,"main_window"));
menu_setup(toplevel);
gtk_window_set_resizable(GTK_WINDOW(main_window),TRUE);
gtk_widget_set_sensitive(OBJ_GET(toplevel,"save_dash_menuitem"),FALSE);
gtk_widget_set_sensitive(OBJ_GET(toplevel,"save_dash_as_menuitem"),FALSE);
gtk_widget_set_sensitive(OBJ_GET(toplevel,"close_dash_menuitem"),FALSE);
retrieve_rt_vars();
gtk_widget_show_all(main_window);
if (argc == 2)
{
tmpbuf = g_get_current_dir();
dirname = g_path_get_dirname(argv[1]);
cwd = g_strconcat(tmpbuf,PSEP,dirname,NULL);
g_free(tmpbuf);
g_free(dirname);
if (g_file_test(argv[1],G_FILE_TEST_IS_REGULAR))
import_dash_xml(argv[1]);
}
gtk_main();
return (0);
}
示例13: grab_coords_event
EXPORT gboolean grab_coords_event(GtkWidget *widget, gpointer data)
{
gdouble x = 0.0;
gdouble y = 0.0;
gtk_widget_set_sensitive(OBJ_GET(widget,"x_spin"),FALSE);
gtk_widget_set_sensitive(OBJ_GET(widget,"y_spin"),FALSE);
gtk_widget_set_sensitive(widget,FALSE);
OBJ_SET(gauge,"x_spin",OBJ_GET(widget,"x_spin"));
OBJ_SET(gauge,"y_spin",OBJ_GET(widget,"y_spin"));
OBJ_SET(gauge,"edit_but",widget);
return TRUE;
}
示例14: save_default_choices
/*!
\brief Saves the default loggable choices
\param widget is unused
\returns FALSE
*/
G_MODULE_EXPORT gboolean save_default_choices(GtkWidget *widget)
{
GtkWidget *tmpwidget = NULL;
GList * list = NULL;
GList * defaults = NULL;
gconstpointer *object = NULL;
gchar *name = NULL;
gint i = 0;
defaults = get_list("logviewer_defaults");
if (defaults)
{
g_list_foreach(defaults,(GFunc)g_free,NULL);
g_list_free(defaults);
defaults = NULL;
remove_list("logviewer_defaults");
}
list = get_list("viewables");
for (i=0;i<g_list_length(list);i++)
{
tmpwidget = g_list_nth_data(list,i);
object = OBJ_GET(tmpwidget,"object");
if ((GBOOLEAN)DATA_GET(object,"being_viewed"))
{
if (DATA_GET(global_data,"playback_mode"))
name = DATA_GET(object,"lview_name");
else
name = DATA_GET(object,"dlog_gui_name");
defaults = g_list_append(defaults,g_strdup(name));
}
}
store_list("logviewer_defaults",defaults);
return FALSE;
}
示例15: set_default_lview_choices_state
/*!
\brief set_default_lview_choices_state() sets the default logviewer values
*/
G_MODULE_EXPORT void set_default_lview_choices_state(void)
{
GList *defaults = NULL;
GList *list = NULL;
GtkWidget * widget = NULL;
gint i = 0;
gint j = 0;
gchar * name;
gchar * potential;
gconstpointer *object;
defaults = get_list("logviewer_defaults");
list = get_list("viewables");
for (i=0;i<g_list_length(defaults);i++)
{
name = g_list_nth_data(defaults,i);
for (j=0;j<g_list_length(list);j++)
{
widget = g_list_nth_data(list,j);
object = OBJ_GET(widget,"object");
if (DATA_GET(global_data,"playback_mode"))
potential = DATA_GET(object,"lview_name");
else
potential = DATA_GET(object,"dlog_gui_name");
if (g_strcasecmp(name,potential) == 0)
set_widget_active(GTK_WIDGET(widget),GINT_TO_POINTER(TRUE));
}
}
return;
}