GrafX2 2.9.3227
The ultimate 256-color painting program
readline.h File Reference

Text input functions. More...

+ This graph shows which files directly or indirectly include this file:

Enumerations

enum  INPUT_TYPE {
  INPUT_TYPE_STRING =0 , INPUT_TYPE_INTEGER =1 , INPUT_TYPE_FILENAME =2 , INPUT_TYPE_DECIMAL =3 ,
  INPUT_TYPE_HEXA =4
}
 

Functions

byte Readline (word x_pos, word y_pos, char *str, byte visible_size, enum INPUT_TYPE input_type)
 Lets the user input a line of text, exit by Esc or Return. More...
 
byte Readline_ex (word x_pos, word y_pos, char *str, byte visible_size, byte max_size, enum INPUT_TYPE input_type, byte decimal_places)
 Lets the user input a line of text, exit by Esc or Return. More...
 
byte Readline_ex_unicode (word x_pos, word y_pos, char *str, word *unicode_str, byte visible_size, byte max_size, enum INPUT_TYPE input_type, byte decimal_places)
 Lets the user input a line of text, exit by Esc or Return. More...
 
void Sprint_double (char *str, double value, byte decimal_places, byte min_positions)
 Converts a double to string. More...
 

Detailed Description

Text input functions.

Enumeration Type Documentation

◆ INPUT_TYPE

enum INPUT_TYPE
Enumerator
INPUT_TYPE_STRING 

Any string.

INPUT_TYPE_INTEGER 

Decimal integer.

INPUT_TYPE_FILENAME 

Filename.

INPUT_TYPE_DECIMAL 

Decimal value.

INPUT_TYPE_HEXA 

Hexadecimal integer.

Function Documentation

◆ Readline()

byte Readline ( word  x_pos,
word  y_pos,
char *  str,
byte  visible_size,
enum INPUT_TYPE  input_type 
)

Lets the user input a line of text, exit by Esc or Return.

Parameters
x_posCoordinates of input, in window coordinates before scaling.
y_posCoordinates of input, in window coordinates before scaling.
strThe original string value (will be modified, unless user cancels.
visible_sizeNumber of characters visible and editable.
input_typeone of enum INPUT_TYPE
Returns
0 if user cancelled (esc), 1 if accepted (return)

References INPUT_TYPE_FILENAME, and Readline_ex().

Referenced by Button_Airbrush_menu(), Button_Anim_time(), Button_Colorize_menu(), Button_Grid_menu(), Button_Load_or_Save(), Button_Palette(), Button_Quick_shade_menu(), Button_Resolution(), Button_Settings(), Button_Smooth_menu(), Button_Text(), Button_Tiling_menu(), Button_Transform_menu(), Load_SCR(), Menu_shade(), and Requester_window().

◆ Readline_ex()

byte Readline_ex ( word  x_pos,
word  y_pos,
char *  str,
byte  visible_size,
byte  max_size,
enum INPUT_TYPE  input_type,
byte  decimal_places 
)

Lets the user input a line of text, exit by Esc or Return.

Parameters
x_posCoordinates of input, in window coordinates before scaling.
y_posCoordinates of input, in window coordinates before scaling.
strThe original string value (will be modified, unless user cancels.
visible_sizeNumber of characters visible.
max_sizeNumber of characters editable.
input_typeone of enum INPUT_TYPE
decimal_placesNumber of decimal places (used only with decimal type)
Returns
0 if user cancelled (esc), 1 if accepted (return)

References NULL, and Readline_ex_unicode().

Referenced by Button_Load_or_Save(), Button_Text(), and Readline().

◆ Readline_ex_unicode()

byte Readline_ex_unicode ( word  x_pos,
word  y_pos,
char *  str,
word unicode_str,
byte  visible_size,
byte  max_size,
enum INPUT_TYPE  input_type,
byte  decimal_places 
)

Lets the user input a line of text, exit by Esc or Return.

Parameters
x_pos,y_posCoordinates of input, in window coordinates before scaling.
strThe original string value. Will be modified, unless user cancels or unicode_str is not NULL.
unicode_strThe original unicode string value or NULL for ANSI editing. Will be modified if not NULL, unless user cancels.
visible_sizeNumber of characters visible.
max_sizeNumber of characters editable.
input_typeone of enum INPUT_TYPE
decimal_placesNumber of decimal places (used only with decimal type)
Returns
0 : user cancelled (esc)
1 : user accepted (return)

References BACKGROUND_COLOR, Cleanup_string(), Cleanup_string_unicode(), Close_popup(), Config, Display_cursor(), Display_whole_string(), Display_whole_string_unicode(), Flush_update(), Fround(), Get_input(), GFX2_GetTextClipboard(), GFX2_INFO, GFX2_Log(), GFX2_WARNING, Hide_cursor, Init_virtual_keyboard(), Input_sticky_control, INPUT_TYPE_DECIMAL, INPUT_TYPE_FILENAME, INPUT_TYPE_HEXA, INPUT_TYPE_INTEGER, INPUT_TYPE_STRING, Insert_character(), Insert_character_unicode(), Key, Key_ANSI, KEY_BACKSPACE, KEY_CAPSLOCK, KEY_CLEAR, KEY_DELETE, KEY_END, KEY_ESC, KEY_HOME, KEY_LEFT, KEY_NONE, KEY_RETURN, KEY_RIGHT, Key_UNICODE, Keyboard_click_allowed, label, LEFT_SIDE, LEFT_TRIANGLE_CHARACTER, MC_Black, MC_Light, Menu_factor_X, Menu_factor_Y, Mouse_K, Mouse_X, NULL, Pixel_height, Pixel_width, Prepend_string(), Prepend_string_unicode(), Print_in_window(), Print_in_window_limited(), Remove_character(), Remove_character_unicode(), RIGHT_SIDE, RIGHT_TRIANGLE_CHARACTER, Screen_FillRect(), SHORTCUT_PASTE, Sprint_double(), TEXT_COLOR, Unicode_char_strlcat(), Unicode_char_strlcpy(), Unicode_strlcpy(), Unicode_strlen(), Update_rect(), Update_window_area, T_Config::Use_virtual_keyboard, Valid_character(), VIRT_KEY_DEFAULT_ON, Wait_end_of_click(), Window_clicked_button(), Window_display_frame_in(), Window_height, Window_pos_X, Window_pos_Y, Window_set_normal_button(), and Window_width.

Referenced by Button_Load_or_Save(), and Readline_ex().

◆ Sprint_double()

void Sprint_double ( char *  str,
double  value,
byte  decimal_places,
byte  min_positions 
)

Converts a double to string.

Parameters
strTarget string, should be pre-allocated and at least 40 characters, to be safe.
valueThe number to convert
decimal_placesNumber of decimal places to keep. 15 seems the maximum.
min_positionsMinimum number of characters: Will pad spaces on the left to meet this minimum.

Referenced by Readline_ex_unicode().