Esempio n. 1
0
static gint
luaH_notebook_index(lua_State *L, widget_t *w, luakit_token_t token)
{
    /* handle numerical index lookups */
    if (token == L_TK_UNKNOWN && lua_isnumber(L, 2))
        return luaH_notebook_atindex(L, w, (gint)luaL_checknumber(L, 2));

    switch(token)
    {
      LUAKIT_WIDGET_INDEX_COMMON(w)

      /* push class methods */
      PF_CASE(COUNT,        luaH_notebook_count)
      PF_CASE(CURRENT,      luaH_notebook_current)
      PF_CASE(GET_TITLE,    luaH_notebook_get_title)
      PF_CASE(INDEXOF,      luaH_notebook_indexof)
      PF_CASE(INSERT,       luaH_notebook_insert)
      PF_CASE(REMOVE,       luaH_notebook_remove)
      PF_CASE(SET_TITLE,    luaH_notebook_set_title)
      PF_CASE(SWITCH,       luaH_notebook_switch)
      PF_CASE(REORDER,      luaH_notebook_reorder)

      case L_TK_CHILDREN:
        return luaH_widget_get_children(L, w);

      /* push boolean properties */
      PB_CASE(SHOW_TABS,    gtk_notebook_get_show_tabs(GTK_NOTEBOOK(w->widget)))
      PB_CASE(SHOW_BORDER,  gtk_notebook_get_show_border(GTK_NOTEBOOK(w->widget)))

      default:
        break;
    }
    return 0;
}
Esempio n. 2
0
void
aurora_get_parent_bg (const GtkWidget *widget, AuroraRGB *color)
{
	GtkStateType state_type;
	const GtkWidget *parent;
	GdkColor *gcolor;
	gboolean stop;
	GtkShadowType shadow = GTK_SHADOW_NONE;
	
	if (widget == NULL)
		return;
	
	parent = widget->parent;
	stop = FALSE;
	
	while (parent && !stop)
	{
		stop = FALSE;

		stop |= !GTK_WIDGET_NO_WINDOW (parent);
		stop |= GTK_IS_NOTEBOOK (parent) &&
		        gtk_notebook_get_show_tabs (GTK_NOTEBOOK (parent)) &&
		        gtk_notebook_get_show_border (GTK_NOTEBOOK (parent));

		if (GTK_IS_FRAME(parent))
		{
			shadow = gtk_frame_get_shadow_type(GTK_FRAME(parent));
			stop |= (shadow != GTK_SHADOW_NONE);
		}
		else if (GTK_IS_TOOLBAR (parent))
		{
			gtk_widget_style_get (GTK_WIDGET (parent), "shadow-type", &shadow, NULL);
			
			stop |= (shadow != GTK_SHADOW_NONE);
		}

		if (!stop)
			parent = parent->parent;
	}

	if (parent == NULL)
		return;
	
	state_type = GTK_WIDGET_STATE (parent);
	
	gcolor = &parent->style->bg[state_type];
	
	aurora_gdk_color_to_rgb (gcolor, &color->r, &color->g, &color->b);
    
    if (GTK_IS_FRAME (parent) && shadow != GTK_SHADOW_NONE) {
         if (shadow == (GTK_SHADOW_IN || GTK_SHADOW_ETCHED_IN))
         	aurora_shade (color, color, 0.97);
         else
            aurora_shade (color, color, 1.04);
    }
}
Esempio n. 3
0
int
clip_GTK_NOTEBOOKGETSHOWBORDER(ClipMachine * cm)
{
	C_widget     *cntb = _fetch_cw_arg(cm);

	CHECKCWID(cntb,GTK_IS_NOTEBOOK);
	_clip_retl(cm, gtk_notebook_get_show_border(GTK_NOTEBOOK(cntb->widget)));
	return 0;
err:
	return 1;
}
Esempio n. 4
0
static gint
luaH_notebook_index(lua_State *L, luakit_token_t token)
{
    widget_t *w = luaH_checkudata(L, 1, &widget_class);

    switch(token)
    {
      case L_TK_DESTROY:
        lua_pushcfunction(L, luaH_widget_destroy);
        return 1;

      case L_TK_COUNT:
        lua_pushcfunction(L, luaH_notebook_count);
        return 1;

      case L_TK_INSERT:
        lua_pushcfunction(L, luaH_notebook_insert);
        return 1;

      case L_TK_APPEND:
        lua_pushcfunction(L, luaH_notebook_append);
        return 1;

      case L_TK_CURRENT:
        lua_pushcfunction(L, luaH_notebook_current);
        return 1;

      case L_TK_REMOVE:
        lua_pushcfunction(L, luaH_notebook_remove);
        return 1;

      case L_TK_INDEXOF:
        lua_pushcfunction(L, luaH_notebook_indexof);
        return 1;

      case L_TK_ATINDEX:
        lua_pushcfunction(L, luaH_notebook_atindex);
        return 1;

      case L_TK_SWITCH:
        lua_pushcfunction(L, luaH_notebook_switch);
        return 1;

      case L_TK_SET_TITLE:
        lua_pushcfunction(L, luaH_notebook_set_title);
        return 1;

      case L_TK_GET_TITLE:
        lua_pushcfunction(L, luaH_notebook_get_title);
        return 1;

      case L_TK_SHOW_TABS:
        lua_pushboolean(L, gtk_notebook_get_show_tabs(
            GTK_NOTEBOOK(w->widget)));
        return 1;

      case L_TK_SHOW_BORDER:
        lua_pushboolean(L, gtk_notebook_get_show_border(
            GTK_NOTEBOOK(w->widget)));
        return 1;

      case L_TK_SHOW:
        lua_pushcfunction(L, luaH_widget_show);
        return 1;

      case L_TK_HIDE:
        lua_pushcfunction(L, luaH_widget_hide);
        return 1;

      case L_TK_FOCUS:
        lua_pushcfunction(L, luaH_widget_focus);
        return 1;

      default:
        break;
    }
    return 0;
}