Exemplo n.º 1
0
static void mk_text_input_line(QSP_ARG_DECL  int so_code)
{
	Screen_Obj *to;
	const char *s;

	to = get_parts("text");		// sets name and action

	s = nameof("default value");

	if( to == NULL ) return;

	SET_SOB_CONTENT(to, save_possibly_empty_str(s));
	SET_SOB_TYPE(to, so_code);

#ifdef BUILD_FOR_IOS
	get_device_dims(to);	// sets width, height, and font size
#else
	SET_SOB_WIDTH(to, PO_WIDTH(curr_panel)-2*SIDE_GAP );
#endif // BUILD_FOR_IOS

	// height is set for console output...
	SET_SOB_HEIGHT(to, MESSAGE_HEIGHT);

	/*
	 * OLD COMMENT:
	 * we used to put this after addition to panel list,
	 * because setting initial value causes a callback
	 * (true for motif!!)
	 *
	 * Why did we stop doing that???
	 * We put it back for now, to prevent the warning...
	 *
	 * Note that most of the other functions add it to the
	 * panel list after the widget proper has been created...
	 *
	 * for iOS, add_to_panel must follow the widget creation,
	 * because that is where addSubview is called...
	 */
#ifdef BUILD_FOR_OBJC
	make_text_field(QSP_ARG  to);
//fprintf(stderr,"adding text field to panel...\n");
	add_to_panel(curr_panel,to);
#else // ! BUILD_FOR_OBJC
	// the callback that occurs is a "value changed" callback...
	// Is that because the widget creation routine
	// sets an initial value?
	add_to_panel(curr_panel,to);
	make_text_field(QSP_ARG  to);
#endif // ! BUILD_FOR_OBJC

#ifdef BUILD_FOR_IOS
	install_initial_text(to);	// set the placeholder value here...
#endif /* BUILD_FOR_IOS */

#ifdef BUILD_FOR_MACOS
	INC_PO_CURR_Y(curr_panel, SOB_HEIGHT(to) + GAP_HEIGHT );
#else // ! BUILD_FOR_MACOS
	// Why add an extra 10???  BUG?
	INC_PO_CURR_Y(curr_panel, MESSAGE_HEIGHT + GAP_HEIGHT + 10 );
#endif // ! BUILD_FOR_MACOS

} // mk_text_input_line
Exemplo n.º 2
0
Arquivo: motif.c Projeto: E-LLP/QuIP
void get_device_dims(Screen_Obj *sop)
{
	SET_SOB_WIDTH(sop,300);
	SET_SOB_HEIGHT(sop,50);
	SET_SOB_FONT_SIZE(sop, 15);
}