Ejemplo n.º 1
0
int label::set_size(int size)
{
	size_ = size;
	update_label_size();
	set_dirty();
	return size_;
}
Ejemplo n.º 2
0
label::label(CVideo& video, const std::string& text, int size, const SDL_Color& color, const bool auto_join) : widget(video, auto_join), text_(text), size_(size), color_(color)
{
#ifdef SDL_GPU
	render_text();
#else
	update_label_size();
#endif
}
Ejemplo n.º 3
0
void NotifyBox::resize_all(void) {
	update_label_size();

	// center box
	int x_pos = (area_w/2) - (lwidth/2);
	resize(x_pos, 0, lwidth, lheight);
	txt_box->resize(0, 0, w(), h());
}
Ejemplo n.º 4
0
void Icon::update_label(const char* ll)
{
	assert(ll != NULL);

	copy_label(ll);
	update_label_size();
	redraw();
}
Ejemplo n.º 5
0
const std::string& label::set_text(const std::string& text)
{
	if (text_ == text)
		return text_;

	text_ = text;
	update_label_size();
	set_dirty();
	return text_;
}
Ejemplo n.º 6
0
void DesktopIcon::rename(const char* str) {
	if(!str ||(str[0] == '\0'))
		return;

	if(settings->name == str)
		return;

	settings->name = str;
	label(settings->name.c_str());
	update_label_size();
	redraw();
}
Ejemplo n.º 7
0
DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) : 
	Fl_Widget(is->x, is->y, ICON_SIZE_MIN_W, ICON_SIZE_MIN_H) {

	E_ASSERT(gs != NULL);

	lwidth = lheight = 0;
	focus = false;
	micon = NULL;
	darker_img = NULL;

	/*
	 * GlobalIconSettings is shared from desktop so we only
	 * reference it. On other hand IconSettings is not shared
	 * and we must construct a copy from given parameter
	 */
	globals = gs;

	settings = new IconSettings;
	settings->name = is->name;
	settings->cmd  = is->cmd;
	settings->icon = is->icon;
	settings->icon2 = is->icon2;
	settings->type = is->type;
	settings->key_name= is->key_name;
	settings->full_path = is->full_path;

	// x,y are not needed since x(), y() are filled with it
	
	// setting fonts is TODO :P
#if 0	
	Fl::set_font((Fl_Font)20, "-windows-*-medium-r-*-*-14-*-*-*-*-*-*-*");
	labelfont((Fl_Font)20);
#endif

	label(settings->name.c_str());

	imenu = new Fl_Menu_Button(0, 0, 0, 0);
	if(settings->type == ICON_TRASH)
		imenu->menu(icon_trash_menu);
	else
		imenu->menu(icon_menu);

	load_icon(ICON_FACE_ONE);
	fix_position(x(), y());

	//Use desktop color as color for icon background
	color(bg);

	align(FL_ALIGN_WRAP);
	update_label_size();
}
Ejemplo n.º 8
0
const std::string& label::set_text(const std::string& text)
{
	if (text_ == text)
		return text_;

	text_ = text;
#ifdef SDL_GPU
	render_text();
#else
	update_label_size();
#endif
	set_dirty();
	return text_;
}
Ejemplo n.º 9
0
DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) : 
	Fl_Widget(is->x, is->y, ICON_SIZE_MIN_W, ICON_SIZE_MIN_H) {

	E_ASSERT(gs != NULL);

	lwidth = lheight = 0;
	focus = false;
	micon = NULL;
	darker_img = NULL;

	gsettings = gs;
	settings = is;

	/* setting fonts is TODO :P */
#if 0	
	Fl::set_font((Fl_Font)20, "-windows-*-medium-r-*-*-14-*-*-*-*-*-*-*");
	labelfont((Fl_Font)20);
#endif

	label(settings->name.c_str());

	imenu = new MenuButton(0, 0, 0, 0);
	if(settings->type == ICON_TRASH)
		imenu->menu(icon_trash_menu);
	else {
		icon_menu[2].image(IconLoader::get("edit-delete", ICON_SIZE_TINY));
		imenu->menu(icon_menu);
	}

	load_icon(ICON_FACE_ONE);
	fix_position(x(), y());

	/* use desktop color as color for icon background */
	color(bg);

	align(FL_ALIGN_WRAP);
	update_label_size();
}
Ejemplo n.º 10
0
label::label(CVideo& video, const std::string& text, int size, const color_t& color, const bool auto_join) : widget(video, auto_join), text_(text), size_(size), color_(color)
{
	update_label_size();
}
Ejemplo n.º 11
0
Icon::Icon(const GlobalIconSettings* gs, IconSettings* s) : Fl_Widget(s->x, s->y, ICONSIZE, ICONSIZE, "")
{
	assert(gs != NULL);
	assert(s != NULL);

	/* GlobalIconSettings and IconSettings are shared
	 * via single object who is changed from eiconman.
	 * Since IconSettings are used more, we allocate for it.
	 */
	globals = gs;

	settings = new IconSettings;
	settings->name = s->name;
	settings->cmd  = s->cmd;
	settings->icon_path = s->icon_path;

	/* settings->x and settings->y are not needed
	 * since x() and y() have it.
	 */

	lwidth = lheight = 0;
	infocus = false;
	micon = NULL;

	popup = new Fl_Menu_Button(0, 0, 0, 0);
	// ?@?
	if(popup->parent())
		popup->parent()->remove(popup);
	popup->parent(0);
	popup->type(Fl_Menu_Button::POPUP3);
	popup->begin();

	const int off = 12;
	Fl_Item* openit = new Fl_Item(_("&Open"));
	openit->x_offset(off);

	Fl_Item* renameit = new Fl_Item(_("&Rename"));
	renameit->x_offset(off);
	renameit->callback(rename_cb, this);

	Fl_Item* deleteit = new Fl_Item(_("&Delete"));
	deleteit->x_offset(off);
	deleteit->callback(delete_cb, this);

	new Fl_Divider();

	Fl_Item* propit = new Fl_Item(_("&Properties"));
	propit->x_offset(off);
	propit->callback(prop_cb, this);

	popup->end();

	box(FL_NO_BOX);

	//tooltip(tt);

	copy_label(settings->name);
	label_color(globals->label_foreground);
	label_size(globals->label_fontsize);
	align(FL_ALIGN_CENTER|FL_ALIGN_WRAP);
	update_label_size();

	icon_img = Fl_Image::read(settings->icon_path, 0);
}