• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GTK_WIDGET_HAS_FOCUS函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_WIDGET_HAS_FOCUS函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_WIDGET_HAS_FOCUS函数的具体用法?C++ GTK_WIDGET_HAS_FOCUS怎么用?C++ GTK_WIDGET_HAS_FOCUS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_WIDGET_HAS_FOCUS函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: keypress

gboolean
keypress(GtkWidget* w, GdkEventKey *ev, Client *c) {
	guint i, focus;
	gboolean processed = FALSE;

	if(ev->type != GDK_KEY_PRESS)
		return FALSE;
	if(GTK_WIDGET_HAS_FOCUS(c->searchbar))
		focus = SearchBar;
	else if(GTK_WIDGET_HAS_FOCUS(c->uribar))
		focus = UriBar;
	else
		focus = Browser;
	updatewinid(c);
	for(i = 0; i < LENGTH(keys); i++) {
		if(focus & keys[i].focus
				&& gdk_keyval_to_lower(ev->keyval) == keys[i].keyval
				&& CLEANMASK(ev->state) == keys[i].mod
				&& keys[i].func) {
			keys[i].func(c, &(keys[i].arg));
			processed = TRUE;
		}
	}
	return processed;
}
开发者ID:qbbr,项目名称:debian,代码行数:25,代码来源:surf.c


示例2: send_focus_event

static void
send_focus_event (MateIconTextItem *iti, gboolean in)
{
    MateIconTextItemPrivate *priv;
    GtkWidget *widget;
    gboolean has_focus;
    GdkEvent fake_event;

    g_return_if_fail (in == FALSE || in == TRUE);

    priv = iti->_priv;
    if (priv->entry == NULL) {
        g_assert (!in);
        return;
    }

    widget = GTK_WIDGET (priv->entry);
    has_focus = GTK_WIDGET_HAS_FOCUS (widget);
    if (has_focus == in) {
        return;
    }

    memset (&fake_event, 0, sizeof (fake_event));
    fake_event.focus_change.type = GDK_FOCUS_CHANGE;
    fake_event.focus_change.window = widget->window;
    fake_event.focus_change.in = in;
    gtk_widget_event (widget, &fake_event);

    /* FIXME: this is failing */
#if 0
    g_return_if_fail (GTK_WIDGET_HAS_FOCUS (widget) == in);
#endif
}
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:33,代码来源:mate-icon-item.c


示例3: gimp_container_grid_view_focus

static gboolean
gimp_container_grid_view_focus (GtkWidget        *widget,
                                GtkDirectionType  direction)
{
  GimpContainerGridView *view = GIMP_CONTAINER_GRID_VIEW (widget);

  if (GTK_WIDGET_CAN_FOCUS (widget) && ! GTK_WIDGET_HAS_FOCUS (widget))
    {
      gtk_widget_grab_focus (GTK_WIDGET (widget));
      return TRUE;
    }

  switch (direction)
    {
    case GTK_DIR_UP:
      return gimp_container_grid_view_move_by (view,  0, -1);
    case GTK_DIR_DOWN:
      return gimp_container_grid_view_move_by (view,  0,  1);
    case GTK_DIR_LEFT:
      return gimp_container_grid_view_move_by (view, -1,  0);
    case GTK_DIR_RIGHT:
      return gimp_container_grid_view_move_by (view,  1,  0);

    case GTK_DIR_TAB_FORWARD:
    case GTK_DIR_TAB_BACKWARD:
      break;
    }

  return FALSE;
}
开发者ID:Amerekanets,项目名称:gimp,代码行数:30,代码来源:gimpcontainergridview.c


示例4: changed

/*
 we get here when the entry in a cell is changed (typed a digit), we
 copy it to the entry above the sheet.
 */
static void
show_entry(GtkWidget *widget, Register_Window *rw)
{
 char *text; 
 GtkSheet *sheet;
 GtkWidget * sheet_entry;
  gint row, col;

  if(widget==NULL|| rw==NULL)
  {
      printf("Warning show_entry(%x,%x)\n",(unsigned int)widget,(unsigned int)rw);
      return;
  }
  
 if(!GTK_WIDGET_HAS_FOCUS(widget)) return;

 sheet=GTK_SHEET(rw->register_sheet);
 sheet_entry = gtk_sheet_get_entry(sheet);

 row=sheet->active_cell.row; col=sheet->active_cell.col;
 if(gpsim_get_register_name(gp->pic_id,rw->type, rw->row_to_address[row]+col))
 {
     if((text=gtk_entry_get_text (GTK_ENTRY(sheet_entry))))
	 gtk_entry_set_text(GTK_ENTRY(rw->entry), text);
 }

}
开发者ID:jdelgadoalfonso,项目名称:gpsim,代码行数:31,代码来源:gui_regwin.c


示例5: gtk_ev_paint

/* Kreslicí funkce spoleèná pro gtk_ev_draw() a gtk_ev_expose(), která kreslí
 * hlavní okno widgetu */
static void gtk_ev_paint(GtkEv *ev, GdkRectangle *area)
{
    GtkWidget *widget;
    
    g_return_if_fail(ev);
    g_return_if_fail(area);

    widget = GTK_WIDGET(ev);

    if(!GTK_WIDGET_DRAWABLE(widget))
        return; /* Not visible and mapped */

    gdk_window_clear_area(widget->window, area->x, area->y, area->width,
                          area->height);
    gdk_gc_set_clip_rectangle(widget->style->black_gc, area);

    /* Èerný rámeèek kolem vnitøního okna */
    gdk_draw_rectangle(widget->window, widget->style->black_gc, FALSE,
                       ev->ev_win_rect.x-1, ev->ev_win_rect.y-1,
                       ev->ev_win_rect.width+2, ev->ev_win_rect.height+2);

    gdk_gc_set_clip_rectangle(widget->style->black_gc, NULL);

    /* Text (seznam zachycených událostí) */
    if(ev->list) {
        GdkRectangle intersect;

        if(gdk_rectangle_intersect(&ev->list_rect, area, &intersect)) {
            static const gint space = 2;
            gint line, step, first_baseline;
            GList *p;
	    GdkFont *font = gtk_style_get_font(widget->style);

            step = font->ascent + font->descent + space;
            first_baseline = ev->list_rect.y + font->ascent + space;
            line = 0;
            for(p = ev->list; p; p = g_list_next(p)) {
                gchar **pev = p->data;
                gint i;
                
                for(i = 0; pev[i]; i++) {
                    gtk_paint_string(widget->style, widget->window,
                                     widget->state, &intersect, widget,
                                     (char *) "ev", ev->list_rect.x,
                                     first_baseline + line*step, pev[i]);
                    line++;
                }
                
                if(first_baseline + line*step - 2*step >
                   intersect.y + intersect.height)
                    break;
            }
        }
    }

    /* Grafické zvýraznìní, kdy¾ má okno focus */
    if(GTK_WIDGET_HAS_FOCUS(widget))
        gtk_paint_focus(widget->style, widget->window, GTK_WIDGET_STATE(widget),
			area, widget, (char *) "ev", 0, 0, -1, -1);
}
开发者ID:tomby42,项目名称:prg-xws,代码行数:62,代码来源:gtkev.c


示例6: transparent_expose_event

static gboolean
transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
{
  GtkWidget *focus_child = NULL;
  gint border_width, x, y, width, height;
  gboolean retval = FALSE;

  gdk_window_clear_area (widget->window, event->area.x, event->area.y,
                         event->area.width, event->area.height);

  if (GTK_WIDGET_CLASS (parent_class)->expose_event)
    retval = GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);

  if (GTK_CONTAINER (widget)->focus_child)
    focus_child = GTK_CONTAINER (GTK_CONTAINER (widget)->focus_child)->focus_child;
  if (focus_child && GTK_WIDGET_HAS_FOCUS (focus_child))
    {
      border_width = GTK_CONTAINER (widget)->border_width;

      x = widget->allocation.x + border_width;
      y = widget->allocation.y + border_width;

      width  = widget->allocation.width  - 2 * border_width;
      height = widget->allocation.height - 2 * border_width;

      gtk_paint_focus (widget->style, widget->window,
                       GTK_WIDGET_STATE (widget),
                       &event->area, widget, "tray_icon",
                       x, y, width, height);
    }

  return retval;
}
开发者ID:wosigh,项目名称:messaging-plugins,代码行数:33,代码来源:eggtrayicon.c


示例7: gtk_check_item_paint

/* This should only be called when toggle_button->draw_indicator
 * is true.
 */
static void
gtk_check_item_paint (GtkWidget    *widget,
			GdkRectangle *area)
{
  GtkCheckItem *check_item;
  
  g_return_if_fail (widget != NULL);
  g_return_if_fail (GTK_IS_CHECK_ITEM (widget));
  
  check_item = GTK_CHECK_ITEM (widget);
  
  if (GTK_WIDGET_DRAWABLE (widget))
    {
      gint border_width;
	  
      gtk_check_item_draw_indicator (check_item, area);
      
      border_width = GTK_CONTAINER (widget)->border_width;
      if (GTK_WIDGET_HAS_FOCUS (widget))
	gtk_paint_focus (widget->style, widget->window,
			 NULL, widget, "checkitem",
			 border_width + widget->allocation.x,
			 border_width + widget->allocation.y,
			 widget->allocation.width - 2 * border_width - 1,
			 widget->allocation.height - 2 * border_width - 1);
    }
}
开发者ID:Onjrew,项目名称:OpenEV,代码行数:30,代码来源:gtkcheckitem.c


示例8: clearlooks_set_widget_parameters

static void
clearlooks_set_widget_parameters (GtkWidget      *widget,
                                  const GtkStyle       *style,
                                  GtkStateType          state_type,
                                  WidgetParameters     *params)
{
	params->style_functions = &(clearlooks_style_class->style_functions[CLEARLOOKS_STYLE (style)->style]);

	params->active      = (state_type == GTK_STATE_ACTIVE);
	params->prelight    = (state_type == GTK_STATE_PRELIGHT);
	params->disabled    = (state_type == GTK_STATE_INSENSITIVE);
	params->state_type  = (ClearlooksStateType)state_type;
	params->corners     = CR_CORNER_ALL;
	params->ltr         = ge_widget_is_ltr ((GtkWidget*)widget);
	params->focus       = widget && GTK_WIDGET_HAS_FOCUS (widget);
	params->is_default  = widget && GE_WIDGET_HAS_DEFAULT (widget);
	params->enable_glow = FALSE;
	params->radius      = CLEARLOOKS_STYLE (style)->radius;

	if (!params->active && widget && GE_IS_TOGGLE_BUTTON (widget))
		params->active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));

	params->xthickness = style->xthickness;
	params->ythickness = style->ythickness;

	/* This is used in GtkEntry to fake transparency. The reason to do this
	 * is that the entry has it's entire background filled with base[STATE].
	 * This is not a very good solution as it will eg. fail if one changes
	 * the background color of a notebook. */
	params->parentbg = CLEARLOOKS_STYLE (style)->colors.bg[state_type];
	clearlooks_get_parent_bg (widget, &params->parentbg);
}
开发者ID:63n,项目名称:ardour,代码行数:32,代码来源:clearlooks_style.c


示例9: columns_focus

/*
 * 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);
}
开发者ID:AshKash,项目名称:kit-sink,代码行数:63,代码来源:gtkcols.c


示例10: autouri

const char *
autouri(Client *c) {
	if(GTK_WIDGET_HAS_FOCUS(c->uribar))
		return gtk_entry_get_text(GTK_ENTRY(c->uribar));
	else if(c->linkhover)
		return c->linkhover;
	return NULL;
}
开发者ID:qbbr,项目名称:debian,代码行数:8,代码来源:surf.c


示例11: nsgtk_widget_has_focus

gboolean nsgtk_widget_has_focus(GtkWidget *widget)
{
  #if GTK_CHECK_VERSION(2,20,0)
	return gtk_widget_has_focus(widget);
  #else
	return GTK_WIDGET_HAS_FOCUS(widget);
  #endif
}
开发者ID:pcwalton,项目名称:NetSurf,代码行数:8,代码来源:compat.c


示例12: is_user_searching

static gboolean
is_user_searching (void)
{
	if (GTK_WIDGET_HAS_FOCUS(search_entry))
		return TRUE;
	
	return FALSE;
}
开发者ID:BackupTheBerlios,项目名称:gimmix,代码行数:8,代码来源:gimmix-interface.c


示例13: gva_main_search_entry_notify_cb

/**
 * gva_main_search_entry_notify_cb:
 * @entry: the search entry
 * @pspec: a #GParamSpec
 *
 * Handler for #GObject::notify signals to the search entry.
 *
 * Hides the search interface when the search entry loses input focus.
 **/
void
gva_main_search_entry_notify_cb (GtkEntry *entry,
                                 GParamSpec *pspec)
{
        if (g_str_equal (pspec->name, "has-focus"))
                if (!GTK_WIDGET_HAS_FOCUS (GTK_ENTRY (entry)))
                        gtk_widget_hide (GVA_WIDGET_MAIN_SEARCH_HBOX);
}
开发者ID:priteau,项目名称:gnome-video-arcade,代码行数:17,代码来源:gva-main.c


示例14: cl_draw_combobox_entry

void cl_draw_combobox_entry (GtkStyle *style, GdkWindow *window,
                             GtkStateType state_type, GtkShadowType shadow_type,
                             GdkRectangle *area,
                             GtkWidget *widget, const gchar *detail,
                             gint x, gint y, gint width, gint height)
{
	CLRectangle r;
	
	gboolean rtl = get_direction (widget->parent) == GTK_TEXT_DIR_RTL;
	gboolean has_focus = GTK_WIDGET_HAS_FOCUS (widget);
	
	int cl = rtl ? CL_CORNER_NONE  : CL_CORNER_ROUND,
		cr = rtl ? CL_CORNER_ROUND : CL_CORNER_NONE;
	
	GdkGC *bg_gc = cl_get_window_bg_gc(widget);
	
	if (rtl)
	{
		if (!has_focus)
		{
			x -= 1;
			width +=1;
		}
	}
	else
	{
		width += 2;
		if (has_focus) width--; /* this gives us a 2px focus line at the right side. */
	}
	
	cl_rectangle_set_entry (&r, style, state_type,
						   cl, cr, cl, cr,
						   has_focus);

	gdk_gc_set_clip_rectangle (bg_gc, area);
	gdk_draw_rectangle (window, bg_gc, FALSE, x, y, width-1, height-1);
	gdk_gc_set_clip_rectangle (bg_gc, NULL);

	/* Draw "sunken" look when border thickness is more than 2 pixels. */
	if (style->xthickness > 2 && style->ythickness > 2)
	{
		cl_draw_inset (style, window, widget, area, x, y, width, height,
		               cl, cr, cl, cr);

		y++;
		x++;
		width-=2;
		height-=2;
	}
	
	cl_rectangle_set_clip_rectangle (&r, area);

	cl_draw_rectangle (window, widget, style, x, y, width, height, &r);
	cl_draw_shadow (window, widget, style, x, y, width, height, &r); 
	
	cl_rectangle_reset_clip_rectangle (&r);
}
开发者ID:DanielAeolusLaude,项目名称:ardour,代码行数:57,代码来源:clearlooks_draw.c


示例15: cell_renderer_caption_render

static void
cell_renderer_caption_render (GtkCellRenderer *cell,
                                GdkWindow *window,
                                GtkWidget *widget,
                                GdkRectangle *background_area,
                                GdkRectangle *cell_area,
                                GdkRectangle *expose_area,
                                GtkCellRendererState flags)
{
  (* GTK_CELL_RENDERER_CLASS (cell_renderer_caption_parent_class)->render)
      (cell, window, widget, background_area, cell_area, expose_area, flags);

  if ((flags & (GTK_CELL_RENDERER_SELECTED|GTK_CELL_RENDERER_PRELIT)) != 0)
  {
    cairo_t *cr;
    int radius = 5;
    int x, y, w, h;
    GtkStateType state;
    x = background_area->x;
    y = background_area->y;
    w = background_area->width;
    h = background_area->height;

    /* sometimes width is -1 - not sure what to do here */
    if (w == -1)
      return;

    if ((flags & GTK_CELL_RENDERER_SELECTED) != 0)
    {
      if (GTK_WIDGET_HAS_FOCUS (widget))
        state = GTK_STATE_SELECTED;
      else
        state = GTK_STATE_ACTIVE;
    }
    else
      state = GTK_STATE_PRELIGHT;

    /* add rounded corners to the selection indicator */
    cr = gdk_cairo_create (GDK_DRAWABLE (window));

    gdk_cairo_set_source_color (cr, &widget->style->base[GTK_STATE_NORMAL]);

    cairo_rectangle (cr, x, y, w, h);

    cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
    cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, 0);
    cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, M_PI * 0.5);
    cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.5, M_PI);
    cairo_close_path (cr);

    cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);

    cairo_fill (cr);
    cairo_destroy (cr);
  }
}
开发者ID:nh2,项目名称:gnome-control-center,代码行数:56,代码来源:caption-cellrenderer.c


示例16: mouse_capplet_check_button_button_press

static gboolean
mouse_capplet_check_button_button_press (GtkWidget *widget, GdkEventButton *event)
{
	if (event->type == GDK_BUTTON_PRESS) {
		if (!GTK_WIDGET_HAS_FOCUS (widget))
			gtk_widget_grab_focus (widget);
		gtk_button_pressed (GTK_BUTTON (widget));
	}
	return TRUE;
}
开发者ID:federicomenaquintero,项目名称:gnome-control-center,代码行数:10,代码来源:gnome-mouse-properties.c


示例17: tile_leave

static void
tile_leave (GtkButton * widget)
{
	if (GTK_WIDGET_HAS_FOCUS (widget))
		gtk_widget_set_state (GTK_WIDGET (widget), TILE_STATE_FOCUSED);
	else
		gtk_widget_set_state (GTK_WIDGET (widget), GTK_STATE_NORMAL);

	TILE (widget)->entered = FALSE;
}
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:10,代码来源:tile.c


示例18: clip_GTK_WIDGETHASFOCUS

/* Returns .T. if widget has a focus */
int
clip_GTK_WIDGETHASFOCUS(ClipMachine * cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	CHECKCWID(cwid,GTK_IS_WIDGET);
	_clip_retl(cm, GTK_WIDGET_HAS_FOCUS(cwid->widget));
	return 0;
err:
	return 1;
}
开发者ID:amery,项目名称:clip-itk,代码行数:11,代码来源:widget.c


示例19: quick_search_clear_entry

void quick_search_clear_entry(QuickSearch *qsearch)
{
	qsearch->entry_entered = FALSE;
	if (GTK_WIDGET_HAS_FOCUS(qsearch->entry))
		entry_focus_in(qsearch->entry, NULL, qsearch);
	else
		entry_focus_out(qsearch->entry, NULL, qsearch);

	gtk_label_set_text(GTK_LABEL(qsearch->status_label), "");
	gtk_widget_hide(qsearch->clear_btn);
}
开发者ID:katakk,项目名称:sylpheed,代码行数:11,代码来源:quick_search.c


示例20: bar_pane_gps_event

static gint bar_pane_gps_event(GtkWidget *bar, GdkEvent *event)
{
	PaneGPSData *pgd;

	pgd = g_object_get_data(G_OBJECT(bar), "pane_data");
	if (!pgd) return FALSE;

	if (GTK_WIDGET_HAS_FOCUS(pgd->widget)) return gtk_widget_event(GTK_WIDGET(pgd->widget), event);

	return FALSE;
}
开发者ID:GroupO,项目名称:geeqie_zas,代码行数:11,代码来源:bar_gps.c



注:本文中的GTK_WIDGET_HAS_FOCUS函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_WIDGET_MAPPED函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_WIDGET_DRAWABLE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap