示例#1
0
int jiveL_slider_skin(lua_State *L) {
	SliderWidget *peer;
	JiveTile *bg, *tile;
	JiveSurface *pill_img;
	/* stack is:
	 * 1: widget
	 */

	lua_pushcfunction(L, jiveL_style_path);
	lua_pushvalue(L, -2);
	lua_call(L, 1, 0);

	peer = jive_getpeer(L, 1, &sliderPeerMeta);

	jive_widget_pack(L, 1, (JiveWidget *)peer);

	/* slider background */
	bg = jive_style_tile(L, 1, "bgImg", NULL);
	if (peer->bg != bg) {
		if (peer->bg) {
			jive_tile_free(peer->bg);
		}

		peer->bg = jive_tile_ref(bg);
	}

	/* vertial or horizontal */
	peer->horizontal = jive_style_int(L, 1, "horizontal", 1);

	/* slider bubble */
	tile = jive_style_tile(L, 1, "img", NULL);
	if (peer->tile != tile) {
		if (peer->tile) {
			jive_tile_free(peer->tile);
		}

		peer->tile = jive_tile_ref(tile);
	}

	pill_img = jive_style_image(L, 1, "pillImg", NULL);
	if (peer->pill_img != pill_img) {
		if (peer->pill_img) {
			jive_surface_free(peer->pill_img);
		}
		peer->pill_img = jive_surface_ref(pill_img);
	}

	peer->align = jive_style_align(L, 1, "align", JIVE_ALIGN_CENTER);

	return 0;
}
int jiveL_textinput_gc(lua_State *L) {
	TextinputWidget *peer;

	luaL_checkudata(L, 1, textinputPeerMeta.magic);

	peer = lua_touserdata(L, 1);

	if (peer->font) {
		jive_font_free(peer->font);
		peer->font = NULL;
	}
	if (peer->cursor_font) {
		jive_font_free(peer->cursor_font);
		peer->cursor_font = NULL;
	}
	if (peer->wheel_font) {
		jive_font_free(peer->wheel_font);
		peer->wheel_font = NULL;
	}
	if (peer->bg_tile) {
		jive_tile_free(peer->bg_tile);
		peer->bg_tile = NULL;
	}
	if (peer->wheel_tile) {
		jive_tile_free(peer->wheel_tile);
		peer->wheel_tile = NULL;
	}
	if (peer->wheel_mask_tile) {
		jive_tile_free(peer->wheel_mask_tile);
		peer->wheel_mask_tile = NULL;
	}
	if (peer->cursor_tile) {
		jive_tile_free(peer->cursor_tile);
		peer->cursor_tile = NULL;
	}
	if (peer->enter_tile) {
		jive_tile_free(peer->enter_tile);
		peer->enter_tile = NULL;
	}

	return 0;
}
示例#3
0
int jiveL_set_background(lua_State *L) {
	/* stack is:
	 * 1: framework
	 * 2: background image (tile)
	 */
	if (jive_background) {
		jive_tile_free(jive_background);
	}
	jive_background = jive_tile_ref(tolua_tousertype(L, 2, 0));
	next_jive_origin++;

	return 0;
}
示例#4
0
int jiveL_slider_gc(lua_State *L) {
	SliderWidget *peer;

	luaL_checkudata(L, 1, sliderPeerMeta.magic);

	peer = lua_touserdata(L, 1);

	if (peer->bg) {
		jive_tile_free(peer->bg);
		peer->bg = NULL;
	}
	if (peer->tile) {
		jive_tile_free(peer->tile);
		peer->tile = NULL;
	}

	if (peer->pill_img) {
		jive_surface_free(peer->pill_img);
		peer->pill_img = NULL;
	}

	return 0;
}
示例#5
0
int jiveL_set_background(lua_State *L) {
	/* stack is:
	 * 1: framework
	 * 2: background image (tile)
	 */
	if (jive_background) {
		jive_tile_free(jive_background);
	}
	if (lua_isnil(L, 2)) {
		jive_background = jive_tile_fill_color(0x000000FF);
	} else {
		jive_background = jive_tile_ref(*(JiveTile **)lua_touserdata(L, 2));
	}
	next_jive_origin++;

	return 0;
}
示例#6
0
int jiveL_textarea_skin(lua_State *L) {
	TextareaWidget *peer;
	JiveTile *bg_tile;

	/* stack is:
	 * 1: widget
	 */

	lua_pushcfunction(L, jiveL_style_path);
	lua_pushvalue(L, -2);
	lua_call(L, 1, 0);

	peer = jive_getpeer(L, 1, &textareaPeerMeta);

	jive_widget_pack(L, 1, (JiveWidget *)peer);


	peer->font = jive_font_ref(jive_style_font(L, 1, "font"));
	peer->sh = jive_style_color(L, 1, "sh", JIVE_COLOR_WHITE, &(peer->is_sh));
	peer->fg = jive_style_color(L, 1, "fg", JIVE_COLOR_BLACK, NULL);
	bg_tile = jive_style_tile(L, 1, "bgImg", NULL);

	if (bg_tile != peer->bg_tile) {
		if (peer->bg_tile) {
			jive_tile_free(peer->bg_tile);
		}
		peer->bg_tile = jive_tile_ref(bg_tile);
	}

	peer->line_height = jive_style_int(L, 1, "lineHeight", jive_font_height(peer->font));
	lua_pushinteger(L, peer->line_height);
	lua_setfield(L, 1, "lineHeight");

	peer->text_offset = jive_font_offset(peer->font);

	peer->align = jive_style_align(L, 1, "align", JIVE_ALIGN_TOP_LEFT);

	invalidate(peer);

	return 0;
}
示例#7
0
int jiveL_textarea_gc(lua_State *L) {
	TextareaWidget *peer;

	luaL_checkudata(L, 1, textareaPeerMeta.magic);

	peer = lua_touserdata(L, 1);

	if (peer->lines) {
		free(peer->lines);
		peer->lines = NULL;
	}
	if (peer->font) {
		jive_font_free(peer->font);
		peer->font = NULL;
	}
	if (peer->bg_tile) {
		jive_tile_free(peer->bg_tile);
		peer->bg_tile = NULL;
	}

	return 0;
}
int jiveL_textinput_skin(lua_State *L) {
	TextinputWidget *peer;
	JiveTile *tile;

	/* stack is:
	 * 1: widget
	 */

	lua_pushcfunction(L, jiveL_style_path);
	lua_pushvalue(L, -2);
	lua_call(L, 1, 0);

	peer = jive_getpeer(L, 1, &textinputPeerMeta);

	jive_widget_pack(L, 1, (JiveWidget *)peer);

	peer->font = jive_font_ref(jive_style_font(L, 1, "font"));
	peer->cursor_font = jive_font_ref(jive_style_font(L, 1, "cursorFont"));
	peer->wheel_font = jive_font_ref(jive_style_font(L, 1, "wheelFont"));
	peer->fg = jive_style_color(L, 1, "fg", JIVE_COLOR_BLACK, NULL);
	peer->sh = jive_style_color(L, 1, "sh", JIVE_COLOR_WHITE, &(peer->is_sh));
	peer->wh = jive_style_color(L, 1, "wh", JIVE_COLOR_WHITE, NULL);
	peer->cursor_color = jive_style_color(L, 1, "cursorColor", JIVE_COLOR_BLACK, NULL);

	tile = jive_style_tile(L, 1, "bgImg", NULL);
	if (tile != peer->bg_tile) {
		if (peer->bg_tile) {
			jive_tile_free(peer->bg_tile);
		}
		peer->bg_tile = jive_tile_ref(tile);
	}

	tile = jive_style_tile(L, 1, "wheelImg", NULL);
	if (tile != peer->wheel_tile) {
		if (peer->wheel_tile) {
			jive_tile_free(peer->wheel_tile);
		}
		peer->wheel_tile = jive_tile_ref(tile);
	}

	tile = jive_style_tile(L, 1, "wheelMask", NULL);
	if (tile != peer->wheel_mask_tile) {
		if (peer->wheel_mask_tile) {
			jive_tile_free(peer->wheel_mask_tile);
		}
		peer->wheel_mask_tile = jive_tile_ref(tile);
	}

	tile = jive_style_tile(L, 1, "cursorImg", NULL);
	if (tile != peer->cursor_tile) {
		if (peer->cursor_tile) {
			jive_tile_free(peer->cursor_tile);
		}
		peer->cursor_tile = jive_tile_ref(tile);
	}

	tile = jive_style_tile(L, 1, "enterImg", NULL);
	if (tile != peer->enter_tile) {
		if (peer->enter_tile) {
			jive_tile_free(peer->enter_tile);
		}
		peer->enter_tile = jive_tile_ref(tile);
	}

	peer->char_height = jive_style_int(L, 1, "charHeight", jive_font_height(peer->font));
	peer->wheel_char_height = jive_style_int(L, 1, "wheelCharHeight", jive_font_height(peer->font));
	peer->char_offset_y = jive_style_int(L, 1, "charOffsetY", 0);
	peer->wheel_char_offset_y = jive_style_int(L, 1, "wheelCharOffsetY", 0);

	return 0;
}