Example #1
0
void Popup::popup_centered_ratio(float p_screen_ratio) {
	
	
	Control *window = get_window();
	ERR_FAIL_COND(!window);
	
	emit_signal("about_to_show");

	Rect2 rect;
	Point2 window_size = window==this ? get_parent_area_size()  :window->get_size();
	rect.size = (window_size * p_screen_ratio).floor();
	rect.pos = ((window_size-rect.size)/2.0).floor();
	set_pos( rect.pos );
	set_size( rect.size );
	
	show_modal(exclusive);
	_fix_size();

	Control *focusable = find_next_valid_focus();
	if (focusable)
		focusable->grab_focus();

	_post_popup();
	notification(NOTIFICATION_POST_POPUP);

}
Example #2
0
void Popup::popup() {

	emit_signal("about_to_show");
	show_modal(exclusive);


	_fix_size();

	Control *focusable = find_next_valid_focus();

	if (focusable)
		focusable->grab_focus();

	_post_popup();
	notification(NOTIFICATION_POST_POPUP);
}
Example #3
0
void Popup::popup(const Rect2 &bounds) {

	emit_signal("about_to_show");
	show_modal(exclusive);

	// Fit the popup into the optionally provided bounds.
	if (!bounds.has_no_area()) {
		set_position(bounds.position);
		set_size(bounds.size);
	}
	_fix_size();

	Control *focusable = find_next_valid_focus();

	if (focusable)
		focusable->grab_focus();

	_post_popup();
	notification(NOTIFICATION_POST_POPUP);
	popped_up = true;
}
Example #4
0
void Popup::popup_centered_ratio(float p_screen_ratio) {

	emit_signal("about_to_show");

	Rect2 rect;
	Point2 window_size = get_viewport_rect().size;
	rect.size = (window_size * p_screen_ratio).floor();
	rect.position = ((window_size - rect.size) / 2.0).floor();
	set_position(rect.position);
	set_size(rect.size);

	show_modal(exclusive);
	_fix_size();

	Control *focusable = find_next_valid_focus();
	if (focusable)
		focusable->grab_focus();

	_post_popup();
	notification(NOTIFICATION_POST_POPUP);
	popped_up = true;
}
Example #5
0
int f_saveas() {
	/* register callbacks */
	add_callback(K_NEWLINE, f_saveas_finish);
	add_callback(K_LEFT, 	f_saveas_nav);
	add_callback(K_RIGHT, 	f_saveas_nav);
	add_callback(K_UP, 		f_saveas_nav);
	add_callback(K_DOWN, 	f_saveas_nav);

	modal_t modal;
	char header[] = "Save as";
	modal.header = malloc(sizeof(char) * (strlen(header) + 1));
	strcpy(modal.header, header);

	char body[] = "- Enter the file name:";
	modal.body = malloc(sizeof(char**));
	modal.body[0] = malloc(sizeof(char*) * (strlen(body) + 1));
	strcpy(modal.body[0], body);
	modal.bodysize = 1;

	modal.footer = NULL;
	modal.type = MOD_TEXTBOX;
	show_modal(curfile, modal);
	return 0;
}
Example #6
0
TModalLayout::~TModalLayout()
{
     if(!m_released) mModalResult = show_modal();
}