Beispiel #1
0
static void
gtk_ellipsis_state_changed (GtkWidget    *widget,
			    GtkStateType  previous_state)
{
  GtkEllipsis *ellipsis = GTK_ELLIPSIS (widget);
  GtkEllipsisPrivate *priv = ellipsis->priv;

  if (!GTK_WIDGET_IS_SENSITIVE (widget))
    priv->button_down = FALSE;

  if (GTK_WIDGET_REALIZED (widget))
    {
      GdkCursor *cursor;

      if (GTK_WIDGET_IS_SENSITIVE (widget))
        cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
                                             GTK_ELLIPSIS_CURSOR);
      else
        cursor = NULL;

      gdk_window_set_cursor (priv->event_window, cursor);
      if (cursor)
        gdk_cursor_unref (cursor);
    }
}
static void
domain_entry_activate (GtkWidget *widget, GtkWidget *dialog)
{
	MatePasswordDialog *password_dialog = MATE_PASSWORD_DIALOG (dialog);
	MatePasswordDialogDetails *priv = password_dialog->details;
	
	if (GTK_WIDGET_VISIBLE (priv->password_entry) &&
	    GTK_WIDGET_IS_SENSITIVE (priv->password_entry))
		gtk_widget_grab_focus (priv->password_entry);
	else if (priv->show_new_password &&
		 GTK_WIDGET_IS_SENSITIVE (priv->new_password_entry))
		gtk_widget_grab_focus (priv->new_password_entry);
}
Beispiel #3
0
/*! \brief Callback function for the changed signal of the filter entry.
 *  \par Function Description
 *  This function monitors changes in the entry filter of the dialog.
 *
 *  It specifically manages the sensitivity of the clear button of the
 *  entry depending on its contents. It also requests an update of the
 *  footprint list by re-evaluating filter at every changes.
 *
 *  \param [in] editable  The filter text entry.
 *  \param [in] user_data The library dialog.
 */
static void
library_window_callback_filter_entry_changed (GtkEditable * editable,
					      gpointer user_data)
{
  GhidLibraryWindow *library_window = GHID_LIBRARY_WINDOW (user_data);
  GtkWidget *button;
  gboolean sensitive;

  /* turns button off if filter entry is empty */
  /* turns it on otherwise */
  button = GTK_WIDGET (library_window->button_clear);
  sensitive =
    (g_ascii_strcasecmp (gtk_entry_get_text (library_window->entry_filter),
			 "") != 0);
  if (GTK_WIDGET_IS_SENSITIVE (button) != sensitive)
    {
      gtk_widget_set_sensitive (button, sensitive);
    }

  /* Cancel any pending update of the footprint list filter */
  if (library_window->filter_timeout != 0)
    g_source_remove (library_window->filter_timeout);

  /* Schedule an update of the footprint list filter in
   * LIBRARY_FILTER_INTERVAL milliseconds */
  library_window->filter_timeout = g_timeout_add (LIBRARY_FILTER_INTERVAL,
						  library_window_filter_timeout,
						  library_window);

}
Beispiel #4
0
/*!
 \brief sets the current points to empty array
 \param curve (MtxCurve *) pointer to curve
 \param num_points (gint) size of array to create
 */
gboolean mtx_curve_set_empty_array (MtxCurve *curve, gint num_points)
{
	gint i = 0;
	MtxCurvePrivate *priv = MTX_CURVE_GET_PRIVATE(curve);
	g_return_val_if_fail (MTX_IS_CURVE (curve),FALSE);
	g_object_freeze_notify (G_OBJECT (curve));
	if (priv->coords)
		g_free(priv->coords);
	priv->coords = g_new0(MtxCurveCoord,num_points);
	priv->num_points = num_points;
	priv->highest_x = 0;
	priv->highest_y = 0;
	priv->lowest_x = 0;
	priv->lowest_y = 0;
	for (i=0;i<num_points;i++)
	{
		priv->coords[i].x = 0;
		priv->coords[i].y = 0;
	}
	g_object_thaw_notify (G_OBJECT (curve));
#if GTK_MINOR_VERSION >= 18
	if (!gtk_widget_is_sensitive(GTK_WIDGET(curve)))
		return TRUE;
#else
	if (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(curve)))
		return TRUE;
#endif
	if (priv->auto_rescale_id == 0)
		priv->auto_rescale_id = g_timeout_add(1000,(GSourceFunc)auto_rescale,priv);
	return TRUE;
}
Beispiel #5
0
/*!
 \brief sets the current points 
 \param curve (MtxCurve *) pointer to curve
 \param num_points (gint) new value
 \param array (MtxCurveCoord*) Array of points
 */
gboolean mtx_curve_set_coords (MtxCurve *curve, gint num_points, MtxCurveCoord *array)
{
/*	gint i = 0; */
	MtxCurvePrivate *priv = MTX_CURVE_GET_PRIVATE(curve);
	g_return_val_if_fail (MTX_IS_CURVE (curve),FALSE);
	g_object_freeze_notify (G_OBJECT (curve));
	if (priv->coords)
		g_free(priv->coords);
	priv->coords = g_memdup(array,(num_points*sizeof(MtxCurveCoord)));
	priv->num_points = num_points;
	recalc_extremes(priv);
	/*
 	for (i=0;i<num_points;i++)
		printf("new coord %f,%f\n",priv->coords[i].x,priv->coords[i].y);
	*/
	g_object_thaw_notify (G_OBJECT (curve));
#if GTK_MINOR_VERSION >= 18
	if (!gtk_widget_is_sensitive(GTK_WIDGET(curve)))
		return TRUE;
#else
	if (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(curve)))
		return TRUE;
#endif
	if (priv->auto_rescale_id == 0)
		priv->auto_rescale_id = g_timeout_add(1000,(GSourceFunc)auto_rescale,priv);
	return TRUE;
}
Beispiel #6
0
gboolean
on_main_window_key_press_event (GtkWidget * widget,
				GdkEventKey * event, gpointer user_data)
{
  int i;
  switch (event->keyval)
    {
    case GDK_r:
    case GDK_R:
      if (GTK_WIDGET_IS_SENSITIVE(lookup_widget(main_window,"record_toolbutton")))
         Undo::store();
      break;
    case GDK_a:
      printf ("a pr/rel\n");
      break;
    case GDK_A:
      printf ("A pr/rel\n");
      break;
    case GDK_Delete:
//    case GDK_d:
	  Editor::instance ()->freeSelectedNode();
      break;
    }

/*
  i = event->keyval;
  // printf ("code: %d\n",i);

  for (int i = 0; i < 32; i++)
    printf ("%d%s", !!(event->state & (1 << i)), i == 31 ? "\n" : "");
*/

  return FALSE;
}
Beispiel #7
0
/****************************************************************************************************
* paint the widget
* derived from gtk_color_sel.c
****************************************************************************************************/
static gboolean expose_cb (GtkWidget * area, GdkEventExpose *event)
{
    gboolean sensitive = GTK_WIDGET_IS_SENSITIVE(area);
    ColourArea * cb = VEX_COLOUR_AREA(area);
    gint x, y, wid, heig, goff;
    cairo_t *cr;
    goff = 0;
    int CHECK_SIZE = 5;
    cr = gdk_cairo_create (area->window);
    wid = area->allocation.width;
    heig = area->allocation.height;

    cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
    cairo_rectangle (cr, 0, 0, wid, heig);
    cairo_fill (cr);

    cairo_set_source_rgb (cr, 0.75, 0.75, 0.75);
    for (x = goff & -CHECK_SIZE; x < goff + wid; x += CHECK_SIZE)
        for (y = 0; y < heig; y += CHECK_SIZE)
            if ((x / CHECK_SIZE + y / CHECK_SIZE) % 2 == 0)
                cairo_rectangle (cr, x - goff, y, CHECK_SIZE, CHECK_SIZE);
    cairo_fill (cr);

    cairo_set_source_rgba (cr, cb -> r, cb -> g, cb -> b, cb -> a);
    cairo_rectangle (cr, 0, 0, wid, heig);
    cairo_fill (cr);
    if (!sensitive) {
        cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.5);
        cairo_rectangle (cr, 0, 0, wid, heig);
        cairo_fill (cr);
    }
    cairo_destroy (cr);

    return FALSE;
}
Beispiel #8
0
/*!
  \brief hte TTM expose event which handles redraw after being unobscured
  \param widget is hte pointer to the TTM drawingarea
  \param event is the pointers to the GdkEventExpose structure
  \param data is unused
  \returns TRUE
  */
G_MODULE_EXPORT gboolean logger_display_expose_event(GtkWidget * widget, GdkEventExpose *event , gpointer data)
{
	cairo_t *cr = NULL;
	GtkAllocation allocation;
	GdkWindow *window = gtk_widget_get_window(widget);
	gtk_widget_get_allocation(widget,&allocation);

	ENTER();
#if GTK_MINOR_VERSION >= 18
	if (gtk_widget_is_sensitive(GTK_WIDGET(widget)))
#else
	if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(widget)))
#endif
	{
		cr = gdk_cairo_create(window);
		gdk_cairo_set_source_pixmap(cr,ttm_data->pixmap,0,0);
		cairo_rectangle(cr,event->area.x,event->area.y,event->area.width, event->area.height);
		cairo_fill(cr);
		cairo_destroy(cr);
	}
	else	/* INSENSITIVE display so grey it */
	{
		cr = gdk_cairo_create(window);
		gdk_cairo_set_source_pixmap(cr,ttm_data->pixmap,0,0);
		cairo_rectangle(cr,event->area.x,event->area.y,event->area.width, event->area.height);
		cairo_fill(cr);
		cairo_set_source_rgba (cr, 0.3,0.3,0.3,0.5);
		cairo_rectangle(cr,0,0,allocation.width, allocation.height);
		cairo_fill(cr);
		cairo_destroy(cr);
	}
	EXIT();
	return TRUE;
}
Beispiel #9
0
static gboolean
gail_expander_do_action (AtkAction *action,
                         gint      i)
{
  GtkWidget *widget;
  GailExpander *expander;
  gboolean return_value = TRUE;

  widget = GTK_ACCESSIBLE (action)->widget;
  if (widget == NULL)
    /*
     * State is defunct
     */
    return FALSE;

  if (!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
    return FALSE;

  expander = GAIL_EXPANDER (action);
  switch (i)
    {
    case 0:
      if (expander->action_idle_handler)
        return_value = FALSE;
      else
	expander->action_idle_handler = gdk_threads_add_idle (idle_do_action, expander);
      break;
    default:
      return_value = FALSE;
      break;
    }
  return return_value; 
}
Beispiel #10
0
static gboolean
idle_do_action (gpointer data)
{
  GtkWidget *widget;
  GailExpander *gail_expander;

  GDK_THREADS_ENTER ();

  gail_expander = GAIL_EXPANDER (data);
  gail_expander->action_idle_handler = 0;

  widget = GTK_ACCESSIBLE (gail_expander)->widget;
  if (widget == NULL /* State is defunct */ ||
      !GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
    {
      GDK_THREADS_LEAVE ();
      return FALSE;
    }

  gtk_widget_activate (widget);

  GDK_THREADS_LEAVE ();

  return FALSE; 
}
Beispiel #11
0
/*!
 \brief handles exposure events when the screen is covered and then 
 exposed. Works by copying from a backing pixmap to screen,
 \param widget (GtkWidget *) pointer to the chart object
 \param event (GdkEventExpose *) pointer to GDK event datastructure that
 encodes important info like window dimensions and depth.
 */
gboolean mtx_stripchart_expose (GtkWidget *widget, GdkEventExpose *event)
{
	MtxStripChart * chart = MTX_STRIPCHART(widget);
	MtxStripChartPrivate *priv = MTX_STRIPCHART_GET_PRIVATE(chart);
	cairo_t *cr = NULL;

#if GTK_MINOR_VERSION >= 18
	if (gtk_widget_is_sensitive(GTK_WIDGET(widget)))
#else
		if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(widget)))
#endif
		{
			cr = gdk_cairo_create(widget->window);
			gdk_cairo_set_source_pixmap(cr,priv->bg_pixmap,0,0);
			cairo_rectangle(cr,event->area.x, event->area.y,event->area.width, event->area.height);
			cairo_fill(cr);
			cairo_destroy(cr);
		}
		else
		{
			cr = gdk_cairo_create(widget->window);
			gdk_cairo_set_source_pixmap(cr,priv->bg_pixmap,0,0);
			cairo_rectangle(cr,event->area.x, event->area.y,event->area.width, event->area.height);
			cairo_fill(cr);
			cairo_set_source_rgba (cr, 0.3,0.3,0.3,0.5);
			cairo_paint(cr);
			/*
			   cairo_rectangle (cr,
			   0,0,priv->w,priv->h);
			   cairo_fill(cr);
			 */
			cairo_destroy(cr);
		}
	return FALSE;
}
Beispiel #12
0
/*
 * Override GtkContainer's focus movement so the user can
 * explicitly specify the tab order.
 */
static gint columns_focus(GtkContainer *container, GtkDirectionType dir)
{
    Columns *cols;
    GList *pos;
    GtkWidget *focuschild;

    g_return_val_if_fail(container != NULL, FALSE);
    g_return_val_if_fail(IS_COLUMNS(container), FALSE);

    cols = COLUMNS(container);

    if (!GTK_WIDGET_DRAWABLE(cols) ||
	!GTK_WIDGET_IS_SENSITIVE(cols))
	return FALSE;

    if (!GTK_WIDGET_CAN_FOCUS(container) &&
	(dir == GTK_DIR_TAB_FORWARD || dir == GTK_DIR_TAB_BACKWARD)) {

	focuschild = container->focus_child;
	gtk_container_set_focus_child(container, NULL);

	if (dir == GTK_DIR_TAB_FORWARD)
	    pos = cols->taborder;
	else
	    pos = g_list_last(cols->taborder);

	while (pos) {
	    GtkWidget *child = pos->data;

	    if (focuschild) {
		if (focuschild == child) {
		    focuschild = NULL; /* now we can start looking in here */
		    if (GTK_WIDGET_DRAWABLE(child) &&
			GTK_IS_CONTAINER(child) &&
			!GTK_WIDGET_HAS_FOCUS(child)) {
			if (gtk_container_focus(GTK_CONTAINER(child), dir))
			    return TRUE;
		    }
		}
	    } else if (GTK_WIDGET_DRAWABLE(child)) {
		if (GTK_IS_CONTAINER(child)) {
		    if (gtk_container_focus(GTK_CONTAINER(child), dir))
			return TRUE;
		} else if (GTK_WIDGET_CAN_FOCUS(child)) {
		    gtk_widget_grab_focus(child);
		    return TRUE;
		}
	    }

	    if (dir == GTK_DIR_TAB_FORWARD)
		pos = pos->next;
	    else
		pos = pos->prev;
	}

	return FALSE;
    } else
	return columns_inherited_focus(container, dir);
}
Beispiel #13
0
/* Override the default GTK2.4 handler, which would make menu
   bindings not work when the menu-bar is hidden. */
static gboolean menu_canacaccel(GtkWidget *widget, guint signal_id, gpointer user_data) {
	/* GTK2.2 behaviour */
#if GTK_CHECK_VERSION(2,20,0)
	return gtk_widget_is_sensitive(widget);
#else
	return GTK_WIDGET_IS_SENSITIVE(widget);
#endif
}
Beispiel #14
0
static void
chatrooms_window_row_activated_cb (GtkTreeView           *tree_view,
				   GtkTreePath           *path,
				   GtkTreeViewColumn     *column,
				   EmpathyChatroomsWindow *window)
{
	if (GTK_WIDGET_IS_SENSITIVE (window->button_edit)) {
		chatrooms_window_model_action_selected (window);
	}
}
Beispiel #15
0
gboolean
bst_choice_selectable (GtkWidget *widget)
{
  gboolean selectable = FALSE;
  
  g_return_val_if_fail (GTK_IS_CONTAINER (widget), FALSE);
  
  if (GTK_IS_MENU (widget))
    {
      GList *list, *children = gtk_container_children (GTK_CONTAINER (widget));
      
      for (list = children; list; list = list->next)
	{
	  GtkBin *bin = list->data;
	  
	  if (GTK_WIDGET_IS_SENSITIVE (bin) && GTK_WIDGET_VISIBLE (bin) && bin->child)
	    {
	      selectable = TRUE;
	      break;
	    }
	}
      g_list_free (children);
    }
  else if (GXK_IS_DIALOG (widget))
    {
      GList *list, *children = gtk_container_children (GTK_CONTAINER (GXK_DIALOG (widget)->hbox));
      
      for (list = children; list; list = list->next)
	{
	  GtkBin *bin = list->data;
	  
	  if (GTK_IS_BUTTON (bin) && GTK_WIDGET_IS_SENSITIVE (bin) && GTK_WIDGET_VISIBLE (bin))
	    {
	      selectable = TRUE;
	      break;
	    }
	}
      g_list_free (children);
    }
  
  return selectable;
}
static void
set_highest_possible (GtkWidget **radiobutton, guint number)
{
    guint i;

    for(i = number - 1; i >= 0; i--) {
	if(GTK_WIDGET_IS_SENSITIVE(radiobutton[i])) {
	    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobutton[i]), TRUE);
	    break;
	}
    }
}
static int
wireless_applet_timeout_handler (WirelessApplet *applet)
{
	if (!GTK_WIDGET_IS_SENSITIVE (applet->ap_view))
		gtk_widget_set_sensitive (GTK_WIDGET (applet->ap_view), TRUE);
	
	wireless_applet_read_device_state (applet);
	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (applet->button)))
			wireless_applet_scan (applet);

	return TRUE;
}
Beispiel #18
0
gboolean IsGrayPrint(UIMainDialog* main_window)
{
	GtkWidget* window = UI_DIALOG(main_window)->window;
	GtkWidget* bw_button1 = LookupWidget(window, "print_bw_button1");
	GtkWidget* bw_button2 = LookupWidget(window, "print_bw_button2");

	gboolean enable_bw
		 = ((GTK_WIDGET_IS_SENSITIVE(bw_button1))?
			GTK_TOGGLE_BUTTON(bw_button1)->active : TRUE)
		 || GTK_TOGGLE_BUTTON(bw_button2)->active;

	return enable_bw;
}
/* GtkDialog callbacks */
static void
mate_password_dialog_show (GtkWidget *widget)
{
	MatePasswordDialog *password_dialog = MATE_PASSWORD_DIALOG (widget);
	MatePasswordDialogDetails *priv = password_dialog->details;
	GtkWidget *focus = NULL;
	const gchar *text;

	GTK_WIDGET_CLASS (mate_password_dialog_parent_class)->show (widget);

	if (GTK_WIDGET_VISIBLE (priv->password_entry) &&
	    GTK_WIDGET_IS_SENSITIVE (priv->password_entry) &&
	    priv->show_password)
		/* Password is the default place to focus */
		focus = priv->password_entry;

	if (GTK_WIDGET_VISIBLE (priv->domain_entry) &&
	    GTK_WIDGET_IS_SENSITIVE (priv->domain_entry) &&
	    priv->show_domain) {
		/* Empty domain entry gets focus */
		text = gtk_entry_get_text (GTK_ENTRY (priv->domain_entry));
		if (!focus || !text || !text[0])
			focus = priv->domain_entry;
	}

	if (GTK_WIDGET_VISIBLE (priv->username_entry) &&
	    GTK_WIDGET_IS_SENSITIVE (priv->username_entry) &&
	    priv->show_username) {
		/* Empty username entry gets focus */
		text = gtk_entry_get_text (GTK_ENTRY (priv->username_entry));
		if (!focus || !text || !text[0])
			focus = priv->username_entry;
	}

	if (focus) {
		gtk_widget_grab_focus (focus);
	}
}
int
on_screen_scroll(GtkAdjustment * adjustment, gpointer user_data)
{
    GtkAdjustment *adj = NULL;
    GtkWidget *w = NULL;
    AppData *app_data = get_app_data();
    ui_hide_arrows_if_exists(app_data->app_ui_data, FALSE);
    pdf_viewer_scroller_changed((PDFScroll) GPOINTER_TO_UINT(user_data));
   if ( display_mode ==1){
   	adj = gtk_layout_get_vadjustment(GTK_LAYOUT(app_data->app_ui_data->layout));
	if ( !adj) {
	/* Ignore when no document loaded */
	     if ( app_data->state == PDF_VIEWER_STATE_EMPTY ) {
		  ui_show_banner(GTK_WIDGET(app_data->app_ui_data->app_view),
						_("pdfv_ib_menu_not_available") );
            	  return TRUE;
             }
	     adj = gtk_layout_get_hadjustment(GTK_LAYOUT(app_data->app_ui_data->layout));
         }
/* If scroll is far left/top or page fits to screen then try to move to previous page */
	 //g_print("adj->value %f",adj->value);
         if ( adj->upper <= adj->page_size || adj->value < 0.0001 ) {
              w = gtk_ui_manager_get_widget(app_data->app_ui_data->ui_manager,
					"/ToolBar/pdfv_me_menu_page_previous");
	      if ( (w != NULL) && (GTK_WIDGET_IS_SENSITIVE(w))) {	
		   pdf_viewer_navigate_page(pdf_viewer_get_current_page()-1);
                   ui_update_current_page(app_data->app_ui_data);
		   adj = gtk_layout_get_vadjustment(GTK_LAYOUT(app_data->app_ui_data->layout));	
		   gtk_adjustment_set_value(adj,adj->value + adj->upper - adj->page_size -0.0001);
	      } else {
			if ( pdf_viewer_get_current_page() == 1) {
                             ui_show_banner(GTK_WIDGET(app_data->app_ui_data->app_view),
                                           _("pdfv_ib_first_page_reached"));
                    	}
                 }
          return TRUE;
           }                   	
	 if ( adj->page_size < adj->upper &&adj->value < ( adj->upper - adj->page_size ) ) {
	      return TRUE;	       
	 } else {
		if ( pdf_viewer_get_num_pages() != pdf_viewer_get_current_page() ) {
	           pdf_viewer_navigate_page(pdf_viewer_get_current_page()+1);
                   ui_update_current_page(app_data->app_ui_data);
		   adj = gtk_layout_get_vadjustment(GTK_LAYOUT(app_data->app_ui_data->layout));	
		   gtk_adjustment_set_value(adj,adj->value + 0.0001);
		}
	   }	
         return TRUE;     
   }        
}
Beispiel #21
0
G_MODULE_EXPORT gboolean
on_window_contract_delete_event        (GtkWidget       *widget,
                                        GdkEvent        *event,
                                        gpointer         user_data)
{
#ifdef DEBUG
    printf("on_window_contract_delete_event\n");
#endif


    if(GTK_WIDGET_IS_SENSITIVE(lookup_widget(window.contract, "button_contract_cancel")))
	window_destroy(&window.contract);    

    return TRUE;
}
Beispiel #22
0
static void
gimp_color_area_render (GimpColorArea *area)
{
  if (! area->buf)
    return;

  _gimp_color_area_render_buf (GTK_WIDGET (area),
                               ! GTK_WIDGET_IS_SENSITIVE (area),
                               area->type,
                               area->buf,
                               area->width, area->height, area->rowstride,
                               &area->color);

  area->needs_render = FALSE;
}
Beispiel #23
0
/*!
 \brief sets the show_y_marker param
 \param curve (MtxCurve *) pointer to curve
 */
gboolean mtx_curve_set_show_y_marker (MtxCurve *curve, gboolean value)
{
	MtxCurvePrivate *priv = MTX_CURVE_GET_PRIVATE(curve);
	g_return_val_if_fail (MTX_IS_CURVE (curve),FALSE);
	g_object_freeze_notify (G_OBJECT (curve));
	priv->show_y_marker = value;
	g_object_thaw_notify (G_OBJECT (curve));
#if GTK_MINOR_VERSION >= 18
	if (!gtk_widget_is_sensitive(GTK_WIDGET(curve)))
		return TRUE;
#else
	if (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(curve)))
		return TRUE;
#endif
	mtx_curve_redraw(curve,FALSE);
	return TRUE;
}
JNIEXPORT jboolean JNICALL 
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled 
  (JNIEnv *env, jobject obj)
{
  void *ptr;
  jboolean ret_val;
  
  gdk_threads_enter ();

  ptr = gtkpeer_get_widget (env, obj);

  ret_val = GTK_WIDGET_IS_SENSITIVE (get_widget(GTK_WIDGET (ptr)));

  gdk_threads_leave ();

  return ret_val;
}
Beispiel #25
0
void move_position(gint multipler)
{
	gint new_pos = (gint)gtk_range_get_value(GTK_RANGE (position_hscale));
	GtkAdjustment *range_adjust = gtk_range_get_adjustment(
					GTK_RANGE (position_hscale));

	if (!GTK_WIDGET_IS_SENSITIVE(position_hscale))
		return;

	new_pos += 10*multipler;

	if (new_pos < 0)
		new_pos = 0;
	if (new_pos > (gint)range_adjust->upper)
		new_pos = (gint)range_adjust->upper;

	gtk_range_set_value (GTK_RANGE (position_hscale), new_pos);
}
Beispiel #26
0
/*!
 \brief sets the Y axis label
 \param curve (MtxCurve *) pointer to curve
 \param text (gchar *) label string
 \returns TRUE on succes
 */
gboolean mtx_curve_set_y_axis_label(MtxCurve *curve, const gchar *text)
{
	MtxCurvePrivate *priv = MTX_CURVE_GET_PRIVATE(curve);
	g_return_val_if_fail (MTX_IS_CURVE (curve),FALSE);
	g_object_freeze_notify (G_OBJECT (curve));
	if (priv->y_axis_label)
		g_free(priv->y_axis_label);
	priv->y_axis_label = g_strdup(text);
	g_object_thaw_notify (G_OBJECT (curve));
#if GTK_MINOR_VERSION >= 18
	if (!gtk_widget_is_sensitive(GTK_WIDGET(curve)))
		return TRUE;
#else
	if (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(curve)))
		return TRUE;
#endif
	mtx_curve_redraw(curve,TRUE);
	return TRUE;
}
static gboolean process_tab( GtkWidget* widget, int direction )
{
    gboolean handled = FALSE;
    GtkWidget* parent = gtk_widget_get_parent(widget);
    GtkWidget* gp = parent ? gtk_widget_get_parent(parent) : 0;
    GtkWidget* ggp = gp ? gtk_widget_get_parent(gp) : 0;

    if ( ggp && GTK_IS_TOOLBAR(ggp) ) {
        GList* kids = gtk_container_get_children( GTK_CONTAINER(ggp) );
        if ( kids ) {
            GtkWidget* curr = widget;
            while ( curr && (gtk_widget_get_parent(curr) != ggp) ) {
                curr = gtk_widget_get_parent( curr );
            }
            if ( curr ) {
                GList* mid = g_list_find( kids, curr );
                while ( mid ) {
                    mid = ( direction < 0 ) ? g_list_previous(mid) : g_list_next(mid);
                    if ( mid && GTK_IS_TOOL_ITEM(mid->data) ) {
                        /* potential target */
                        GtkWidget* child = gtk_bin_get_child( GTK_BIN(mid->data) );
                        if ( child && GTK_IS_HBOX(child) ) { /* could be ours */
                            GList* subChildren = gtk_container_get_children( GTK_CONTAINER(child) );
                            if ( subChildren ) {
                                GList* last = g_list_last(subChildren);
                                if ( last && GTK_IS_SPIN_BUTTON(last->data) && GTK_WIDGET_IS_SENSITIVE( GTK_WIDGET(last->data) ) ) {
                                    gtk_widget_grab_focus( GTK_WIDGET(last->data) );
                                    handled = TRUE;
                                    mid = 0; /* to stop loop */
                                }

                                g_list_free(subChildren);
                            }
                        }
                    }
                }
            }
            g_list_free( kids );
        }
    }

    return handled;
}
Beispiel #28
0
/*!
 \brief sets the color for the passed index
 \param curve (MtxCurve *) pointer to curve
 \param value (gfloat) new value
 */
gboolean mtx_curve_set_color (MtxCurve *curve, CurveColorIndex index, GdkColor color)
{
	MtxCurvePrivate *priv = MTX_CURVE_GET_PRIVATE(curve);
	g_return_val_if_fail (MTX_IS_CURVE (curve),FALSE);
	g_return_val_if_fail (index < CURVE_NUM_COLORS,FALSE);
	g_object_freeze_notify (G_OBJECT (curve));
	priv->colors[index].red = color.red;
        priv->colors[index].green = color.green;
        priv->colors[index].blue = color.blue;
        priv->colors[index].pixel = color.pixel;
	g_object_thaw_notify (G_OBJECT (curve));
#if GTK_MINOR_VERSION >= 18
	if (!gtk_widget_is_sensitive(GTK_WIDGET(curve)))
		return TRUE;
#else
	if (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(curve)))
		return TRUE;
#endif
	mtx_curve_redraw(curve,TRUE);
	return TRUE;
}
Beispiel #29
0
/*!
 \brief sets the value of one point
 \param curve (MtxCurve *) pointer to curve
 \param index (gfloat) index of point
 \param point (gfloat) new point coords
 */
gboolean mtx_curve_set_coords_at_index (MtxCurve *curve, gint index, MtxCurveCoord point)
{
	MtxCurvePrivate *priv = MTX_CURVE_GET_PRIVATE(curve);
	g_return_val_if_fail (MTX_IS_CURVE (curve),FALSE);
	g_return_val_if_fail (priv->num_points > index,FALSE);
	g_return_val_if_fail (index >= 0,FALSE);
	g_object_freeze_notify (G_OBJECT (curve));
	priv->coords[index].x = point.x;
	priv->coords[index].y = point.y;
	/*printf("set_coords_at_index at index %i changed to %.2f,%.2f\n",index,priv->coords[index].x,priv->coords[index].y);*/
	g_object_thaw_notify (G_OBJECT (curve));
#if GTK_MINOR_VERSION >= 18
	if (!gtk_widget_is_sensitive(GTK_WIDGET(curve)))
		return TRUE;
#else
	if (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(curve)))
		return TRUE;
#endif
	if (priv->auto_rescale_id == 0)
		priv->auto_rescale_id = g_timeout_add(1000,(GSourceFunc)auto_rescale,priv);
	return TRUE;
}
Beispiel #30
0
static gboolean
gail_scale_button_do_action(AtkAction *action,
                            gint       i)
{
  GtkWidget *widget;

  widget = GTK_ACCESSIBLE (action)->widget;
  if (widget == NULL)
    return FALSE;

  if (!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
    return FALSE;

  switch (i) {
    case 0:
      g_signal_emit_by_name (widget, "popup");
      return TRUE;
    case 1:
      g_signal_emit_by_name (widget, "podown");
      return TRUE;
    default:
      return FALSE;
  }
}