Exemple #1
0
void Label::set_uppercase(bool p_uppercase) {

	uppercase=p_uppercase;
	word_cache_dirty=true;
	minimum_size_changed();
	update();
}
Exemple #2
0
void TextureButton::set_normal_texture(const Ref<Texture>& p_normal) {

	normal=p_normal;
	update();
	minimum_size_changed();

}
Exemple #3
0
void GridContainer::set_columns(int p_columns) {

	columns=p_columns;
	queue_sort();
	minimum_size_changed();

}
Exemple #4
0
void Tabs::set_tab_title(int p_tab, const String &p_title) {

	ERR_FAIL_INDEX(p_tab, tabs.size());
	tabs[p_tab].text = p_title;
	update();
	minimum_size_changed();
}
Exemple #5
0
void Tabs::set_tab_right_button(int p_tab, const Ref<Texture> &p_right_button) {

	ERR_FAIL_INDEX(p_tab, tabs.size());
	tabs[p_tab].right_button = p_right_button;
	update();
	minimum_size_changed();
}
Exemple #6
0
void ButtonArray::set_button_icon(int p_button, const Ref<Texture>& p_icon) {

    ERR_FAIL_INDEX(p_button,buttons.size());
    buttons[p_button].icon=p_icon;
    update();
    minimum_size_changed();
}
Exemple #7
0
void Container::_child_minsize_changed() {

	Size2 ms = get_combined_minimum_size();
	if (ms.width > get_size().width || ms.height > get_size().height)
		minimum_size_changed();
	queue_sort();
}
Exemple #8
0
void GraphNode::set_title(const String& p_title) {

	title=p_title;
	minimum_size_changed();
	update();

}
void TextureProgress::set_over_texture(const Ref<Texture> &p_texture) {

	over = p_texture;
	update();
	if (under.is_null()) {
		minimum_size_changed();
	}
}
Exemple #10
0
void Label::set_autowrap(bool p_autowrap) {

	autowrap=p_autowrap;
	word_cache_dirty=true;
	minimum_size_changed();
	update();

}
Exemple #11
0
void Label::set_clip_text(bool p_clip) {

	if (clip==p_clip)
		return;
	clip=p_clip;
	update();
	minimum_size_changed();
}
Exemple #12
0
void ButtonArray::set_button_text(int p_button, const String& p_text) {

    ERR_FAIL_INDEX(p_button,buttons.size());
    buttons[p_button].text=p_text;
    update();
    minimum_size_changed();

}
Exemple #13
0
void TextureFrame::set_texture(const Ref<Texture>& p_tex) {

	texture=p_tex;
	update();
	if (texture.is_valid())
		texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites
	minimum_size_changed();
}
Exemple #14
0
void AcceptDialog::set_child_rect(Control *p_child) {

	ERR_FAIL_COND(p_child->get_parent()!=this);

	//p_child->set_area_as_parent_rect(get_constant("margin","Dialogs"));
	child=p_child;
	minimum_size_changed();
	_update_child_rect();
}
Exemple #15
0
void Button::set_icon(const Ref<Texture>& p_icon) {

	if (icon==p_icon)
		return;
	icon=p_icon;
	update();
	_change_notify("icon");
	minimum_size_changed();
}
Exemple #16
0
void Button::set_text(const String& p_text) {

	if (text==p_text)
		return;
	text=XL_MESSAGE(p_text);
	update();
	_change_notify("text");
	minimum_size_changed();
}
Exemple #17
0
void LineEdit::_text_changed() {

if (expand_to_text_length)
    minimum_size_changed();

emit_signal("text_changed",text);
_change_notify("text");

}
Exemple #18
0
void Patch9Frame::set_texture(const Ref<Texture>& p_tex) {

	if (texture==p_tex)
		return;
	texture=p_tex;
	update();
	//if (texture.is_valid())
	//	texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites
	minimum_size_changed();
	emit_signal("texture_changed");
}
Exemple #19
0
void Tabs::add_tab(const String &p_str, const Ref<Texture> &p_icon) {

	Tab t;
	t.text = p_str;
	t.icon = p_icon;

	tabs.push_back(t);

	update();
	minimum_size_changed();
}
Exemple #20
0
void ButtonArray::add_button(const String& p_button) {

	Button button;
	button.text=p_button;
	buttons.push_back(button);
	update();

	if (selected==-1)
		selected=0;

	minimum_size_changed();
}
Exemple #21
0
void UI_CheckBox::_notification(int p_what) {
	if (!checkbox_draw_)return;
	if (p_what == NOTIFICATION_MOUSE_ENTER && index_ != 1) {
		if (clipY_ > 1) {
			index_ = 2;
		}
		update();
	}
	else if (p_what == NOTIFICATION_MOUSE_EXIT && index_ != 1) {
		if (clipY_ > 1) {
			index_ = 0;
		}
		update();
	}
	else if (p_what == NOTIFICATION_DRAW) {

		RID ci = get_canvas_item();
		Size2 size = get_size();
		int w = 0;
		int h = 0;
		if (!texture_.is_null()) {
			w = texture_->get_width() / clipX_;
			h = texture_->get_height() / clipY_;
			int y = index_ / clipX_;
			int x = index_ % clipX_;

			Rect2 rect = Rect2(Point2(0, (size.height-w)), Point2(w,h));
			if (index_ < 0) {
				index_ = 0;

			}
			else if (index_ >= clipX_ * clipY_)
			{
				index_ = 0;
			}
			texture_->draw_rect_region(ci, rect, Rect2(x * w, y * h,w,h));
		}
		if (text_ != "") {
			Color color;
			Ref<Font> font = get_font("font");
			Point2 text_ofs = font->get_string_size(text_);
			int text_clip = text_ofs.width;
			text_ofs.x = (w + 2);
			text_ofs.y = size.height - text_ofs.height + font->get_ascent();
			font->draw(ci, text_ofs.floor(), text_, color, text_clip);
			minsize_.width = text_ofs.x + text_clip;
			minsize_.height = text_ofs.height > h ? text_ofs.height : h;
			if (minsize_.width > size.width || minsize_.height > size.height)minimum_size_changed();
		}
	}
}
Exemple #22
0
void Label::set_text(const String& p_string) {
	
	String str = XL_MESSAGE(p_string);

	if (text==str)
		return;
	
	text=str;
	word_cache_dirty=true;
	update();
	if (!autowrap)
		minimum_size_changed();
	
}
Exemple #23
0
void NinePatchRect::set_texture(const Ref<Texture> &p_tex) {

	if (texture == p_tex)
		return;
	texture = p_tex;
	update();
	/*
	if (texture.is_valid())
		texture->set_flags(texture->get_flags()&(~Texture::FLAG_REPEAT)); //remove repeat from texture, it looks bad in sprites
	*/
	minimum_size_changed();
	emit_signal("texture_changed");
	_change_notify("texture");
}
Exemple #24
0
void Tabs::add_tab(const String &p_str, const Ref<Texture> &p_icon) {

	Tab t;
	t.text = p_str;
	t.icon = p_icon;
	t.disabled = false;
	t.ofs_cache = 0;
	t.size_cache = 0;

	tabs.push_back(t);
	_update_cache();
	update();
	minimum_size_changed();
}
Exemple #25
0
void VideoPlayer::_notification(int p_notification) {

	switch (p_notification) {

		case NOTIFICATION_ENTER_SCENE: {

			//set_idle_process(false); //don't annoy
			if (stream.is_valid() && autoplay && !get_scene()->is_editor_hint())
				play();
		} break;

		case NOTIFICATION_PROCESS: {

			if (stream.is_null())
				return;
			if (paused)
				return;

			while (stream->get_pending_frame_count()) {

				Image img = stream->pop_frame();
				if (texture->get_width() == 0) {
					texture->create(img.get_width(),img.get_height(),img.get_format(),Texture::FLAG_VIDEO_SURFACE|Texture::FLAG_FILTER);
					update();
					minimum_size_changed();
				} else {

					if (stream->get_pending_frame_count() == 0)
						texture->set_data(img);
				};
			};

		} break;

		case NOTIFICATION_DRAW: {

			if (texture.is_null())
				return;
			if (texture->get_width() == 0)
				return;

			Size2 s=expand?get_size():texture->get_size();
			RID ci = get_canvas_item();
			printf("drawing with size %f, %f\n", s.x, s.y);
			draw_texture_rect(texture,Rect2(Point2(),s),false);

		} break;
	};

};
Exemple #26
0
void ButtonArray::add_button(const String &p_text, const String &p_tooltip) {

	Button button;
	button.text = p_text;
	button.xl_text = XL_MESSAGE(p_text);
	button.tooltip = p_tooltip;
	buttons.push_back(button);
	update();

	if (selected == -1)
		selected = 0;

	minimum_size_changed();
}
Exemple #27
0
void Label::set_text(const String& p_string) {

	String str = XL_MESSAGE(p_string);

	if (text==str)
		return;

	text=str;
	word_cache_dirty=true;
	if (percent_visible<1)
		visible_chars=get_total_character_count()*percent_visible;
	update();
	minimum_size_changed();

}
Exemple #28
0
void Tabs::remove_tab(int p_idx) {

	ERR_FAIL_INDEX(p_idx, tabs.size());
	tabs.remove(p_idx);
	if (current >= p_idx)
		current--;
	update();
	minimum_size_changed();

	if (current < 0)
		current = 0;
	if (current >= tabs.size())
		current = tabs.size() - 1;

	_ensure_no_over_offset();
}
Exemple #29
0
bool ButtonArray::_set(const StringName& p_name, const Variant& p_value) {

    String n=String(p_name);
    if (n.begins_with("button/")) {

        String what = n.get_slicec('/',1);
        if (what=="count") {
            int new_size=p_value;
            if (new_size>0 && buttons.size()==0) {
                selected=0;
            }

            if (new_size < buttons.size()) {
                if (selected>=new_size)
                    selected=new_size-1;
            }
            buttons.resize(new_size);
            _change_notify();
            minimum_size_changed();
        } else if (what=="align") {
            set_align(Align(p_value.operator int()));
        } else if (what=="selected") {
            set_selected(p_value);
        } else if (what == "min_button_size") {
            min_button_size = p_value;
        } else {
            int idx=what.to_int();
            ERR_FAIL_INDEX_V(idx,buttons.size(),false);
            String f = n.get_slicec('/',2);
            if (f=="text")
                buttons[idx].text=p_value;
            else if (f=="tooltip")
                buttons[idx].tooltip=p_value;
            else if (f=="icon")
                buttons[idx].icon=p_value;
            else
                return false;

        }

        update();
        return true;
    }

    return false;

}
void EditorAssetLibraryItemDescription::_preview_click(int p_id) {
	for (int i = 0; i < preview_images.size(); i++) {
		if (preview_images[i].id == p_id) {
			preview_images[i].button->set_pressed(true);
			if (!preview_images[i].is_video) {
				if (preview_images[i].image.is_valid()) {
					preview->set_texture(preview_images[i].image);
					minimum_size_changed();
				}
			} else {
				_link_click(preview_images[i].video_link);
			}
		} else {
			preview_images[i].button->set_pressed(false);
		}
	}
}