示例#1
0
文件: style.c 项目: Guff/lualock
int lualock_lua_style_set(lua_State *L) {
    gdouble r, g, b, a;
    lua_getfield(L, 1, "color");
    parse_color(luaL_optstring(L, 2, "#000000"), &r, &g, &b, &a);
    lua_pop(L, 1);
    lua_getfield(L, 1, "font");
    lua_getfield(L, 1, "x");
    lua_getfield(L, 1, "y");
    lua_getfield(L, 1, "off_x");
    lua_getfield(L, 1, "off_y");
    lua_getfield(L, 1, "width");
    lua_getfield(L, 1, "height");
    lua_getfield(L, 1, "bg_color");
    lua_getfield(L, 1, "border_color");
    lua_getfield(L, 1, "border_width");
    
    style_set(luaL_optstring(L, 2, DEFAULT_FONT),
              luaL_optnumber(L, 3, lualock.style.x),
              luaL_optnumber(L, 4, lualock.style.y),
              luaL_optnumber(L, 5, lualock.style.off_x),
              luaL_optnumber(L, 6, lualock.style.off_y),
              luaL_optnumber(L, 7, lualock.style.width),
              luaL_optnumber(L, 8, lualock.style.height),
              r, g, b, a,
              lua_tostring(L, 9),
              lua_tostring(L, 10),
              luaL_optnumber(L, 11, lualock.style.border_width));
    return 0;
}
static void
terminal_tab_label_style_set (GtkWidget *widget,
                              GtkStyle *previous_style)
{
  TerminalTabLabel *tab_label = TERMINAL_TAB_LABEL (widget);
  TerminalTabLabelPrivate *priv = tab_label->priv;
  void (* style_set) (GtkWidget *, GtkStyle *) = GTK_WIDGET_CLASS (terminal_tab_label_parent_class)->style_set;
  int h, w;

  if (style_set)
    style_set (widget, previous_style);

  gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (widget),
                                     GTK_ICON_SIZE_MENU, &w, &h);
  gtk_widget_set_size_request (priv->close_button, w + 2, h + 2);
}