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

Utility functions for the Fileselector window. More...

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

Functions

T_Fileselector_itemAdd_element_to_list (T_Fileselector *list, const char *full_name, const char *short_name, enum FSOBJECT_TYPE type, enum ICON_TYPES icon)
 Add an item to the file selector linked list. More...
 
char * Format_filename (const char *fname, word max_length, int type)
 Formats a display name for a file, directory, or similar name (drive, volume). More...
 
wordFormat_filename_unicode (const word *fname, word max_length, int type)
 Formats a display name for a file, directory, or similar name (drive, volume). More...
 

Detailed Description

Utility functions for the Fileselector window.

Function Documentation

◆ Add_element_to_list()

T_Fileselector_item * Add_element_to_list ( T_Fileselector list,
const char *  full_name,
const char *  short_name,
enum FSOBJECT_TYPE  type,
enum ICON_TYPES  icon 
)

Add an item to the file selector linked list.

Parameters
listthe linked list
full_namethe file name
short_namethe file name truncated to display in the file selector
typethe type of the item : 0 = File, 1 = Directory, 2 = Drive
iconthe icon for the item
Returns
a pointer to the newly added item
NULL in case of error

References T_Fileselector::First, T_Fileselector_item::Full_name, T_Fileselector_item::Icon, icon, T_Fileselector_item::Next, NULL, T_Fileselector_item::Previous, T_Fileselector_item::Short_name, and T_Fileselector_item::Type.

Referenced by Add_font_or_skin(), Read_dir_callback(), Read_list_of_drives(), and Read_list_of_files().

◆ Format_filename()

char * Format_filename ( const char *  fname,
word  max_length,
int  type 
)

Formats a display name for a file, directory, or similar name (drive, volume).

Parameters
fnamefull file name from the file system
max_lengthnumbers of characters to display
type0 for file, 1 for directory, 2 for drive
Returns
a pointer to a single static buffer of maximum 40 characters including the '\0'.

References ELLIPSIS_CHARACTER, NULL, PARENT_DIR, and Position_last_dot().

Referenced by Add_font_or_skin(), Read_dir_callback(), Read_list_of_drives(), and Read_list_of_files().

◆ Format_filename_unicode()

word * Format_filename_unicode ( const word fname,
word  max_length,
int  type 
)

Formats a display name for a file, directory, or similar name (drive, volume).

Parameters
fnamefull file name from the file system
max_lengthnumbers of characters to display
type0 for file, 1 for directory, 2 for drive
Returns
a pointer to a single static buffer of maximum 40 wide characters including the '\0'.

References ELLIPSIS_CHARACTER, PARENT_DIR, Position_last_dot_unicode(), Unicode_char_strcmp(), and Unicode_char_strlcpy().

Referenced by Read_dir_callback().