GrafX2 2.9.3227
The ultimate 256-color painting program
mockui.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include "../struct.h"
#include "../global.h"
#include "../readline.h"
+ Include dependency graph for mockui.c:

Functions

void Warning_message (const char *message)
 Window that shows a warning message and wait for a click on the OK button. More...
 
void Warning_with_format (const char *template,...)
 Window that shows a warning message and waits for a click on the OK button. More...
 
void Error_function (int error_code, const char *filename, int line_number, const char *function_name)
 Helper function used by the macro Error. More...
 
void Warning_function (const char *message, const char *filename, int line_number, const char *function_name)
 
void Window_help (int section, const char *sub_section)
 Displays and runs the "Help / About..." window. More...
 
void Open_window (word width, word height, const char *title)
 Open a GUI window. More...
 
void Close_window ()
 Close a window previously open with Open_window() More...
 
void Print_in_window (short x, short y, const char *str, byte text_color, byte background_color)
 Draws a string in a window. More...
 
void Window_dropdown_add_item (T_Dropdown_button *dropdown, word btn_number, const char *label)
 Adds an item to a dropdown menu. More...
 
void Window_dropdown_clear_items (T_Dropdown_button *dropdown)
 
T_Dropdown_buttonWindow_set_dropdown_button (word x_pos, word y_pos, word width, word height, word dropdown_width, const char *label, byte display_choice, byte display_centered, byte display_arrow, byte active_button, byte bottom_up)
 
T_Normal_buttonWindow_set_normal_button (word x_pos, word y_pos, word width, word height, const char *title, byte undersc_letter, byte clickable, word shortcut)
 
short Window_clicked_button (void)
 
int Is_shortcut (word key, word function)
 Returns true if the keycode has been set as a keyboard shortcut for the function. More...
 
void Update_rect (short x, short y, unsigned short width, unsigned short height)
 
void Display_cursor (void)
 
void Hide_cursor (void)
 Boolean: Need to hide/unhide cursor during this step. More...
 
word Count_used_colors (dword *usage)
 Count used palette indexes in the whole picture Return the total number of different colors Fill in "usage" with the count for each color. More...
 
word Count_used_colors_area (dword *usage, word start_x, word start_y, word width, word height)
 Same as Count_used_colors, but for a given rectangle in the picture only. More...
 
void Window_input_content (T_Special_button *button, const char *content)
 
T_Special_buttonWindow_set_input_button (word x_pos, word y_pos, word width_in_characters)
 
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...
 

Function Documentation

◆ Error_function()

◆ Warning_function()

void Warning_function ( const char *  message,
const char *  filename,
int  line_number,
const char *  function_name 
)

◆ Window_help()

void Window_help ( int  section,
const char *  sub_section 
)

Displays and runs the "Help / About..." window.

Parameters
sectionNumber of the help section page to display (equals the button number the mouse was hovering for the contextual help), -1 for the main help page.
sub_sectionHelp sub-section title (the page will be scrolled so this title is at the top).

◆ Open_window()

void Open_window ( word  width,
word  height,
const char *  title 
)

Open a GUI window.

Parameters
widthwindow width (max 320)
heightwindow height (max 200)
titlewindow title

The mouse must be shown before calling this function. The mouse is hidden when the function returns.

The function Close_window() must be called afterward.

References Windows_open.

◆ Close_window()

void Close_window ( void  )

Close a window previously open with Open_window()

The mouse must be shown when this functions is called. It is hidden when the function returns.

References Windows_open.

◆ Print_in_window()

void Print_in_window ( short  x,
short  y,
const char *  str,
byte  text_color,
byte  background_color 
)

Draws a string in a window.

◆ Window_dropdown_add_item()

void Window_dropdown_add_item ( T_Dropdown_button dropdown,
word  btn_number,
const char *  label 
)

Adds an item to a dropdown menu.

References label.

◆ Window_dropdown_clear_items()

void Window_dropdown_clear_items ( T_Dropdown_button dropdown)

◆ Window_set_dropdown_button()

T_Dropdown_button * Window_set_dropdown_button ( word  x_pos,
word  y_pos,
word  width,
word  height,
word  dropdown_width,
const char *  label,
byte  display_choice,
byte  display_centered,
byte  display_arrow,
byte  active_button,
byte  bottom_up 
)

References NULL.

◆ Window_set_normal_button()

T_Normal_button * Window_set_normal_button ( word  x_pos,
word  y_pos,
word  width,
word  height,
const char *  title,
byte  undersc_letter,
byte  clickable,
word  shortcut 
)

References NULL.

◆ Window_clicked_button()

short Window_clicked_button ( void  )

◆ Is_shortcut()

int Is_shortcut ( word  key,
word  function 
)

Returns true if the keycode has been set as a keyboard shortcut for the function.

◆ Update_rect()

void Update_rect ( short  x,
short  y,
unsigned short  width,
unsigned short  height 
)

References Max_X, Max_Y, Min_X, Min_Y, Pixel_height, Pixel_width, and Screen_SDL.

Referenced by Button_Magnify(), Button_Magnify_menu(), Button_Palette(), Button_Sieve_menu(), Clear_brush_double(), Clear_brush_quad(), Clear_brush_scaled_double(), Clear_brush_scaled_quad(), Clear_brush_scaled_simple(), Clear_brush_scaled_tall(), Clear_brush_scaled_tall2(), Clear_brush_scaled_tall3(), Clear_brush_scaled_triple(), Clear_brush_scaled_wide(), Clear_brush_scaled_wide2(), Clear_brush_simple(), Clear_brush_tall(), Clear_brush_tall2(), Clear_brush_tall3(), Clear_brush_triple(), Clear_brush_wide(), Clear_brush_wide2(), Display_all_screen(), Display_brush_color_double(), Display_brush_color_quad(), Display_brush_color_simple(), Display_brush_color_tall(), Display_brush_color_tall2(), Display_brush_color_tall3(), Display_brush_color_triple(), Display_brush_color_wide(), Display_brush_color_wide2(), Display_brush_mono_double(), Display_brush_mono_quad(), Display_brush_mono_simple(), Display_brush_mono_tall(), Display_brush_mono_tall2(), Display_brush_mono_tall3(), Display_brush_mono_triple(), Display_brush_mono_wide(), Display_brush_mono_wide2(), Display_brush_mono_zoom_double(), Display_brush_mono_zoom_quad(), Display_brush_mono_zoom_simple(), Display_brush_mono_zoom_tall(), Display_brush_mono_zoom_tall2(), Display_brush_mono_zoom_tall3(), Display_brush_mono_zoom_triple(), Display_brush_mono_zoom_wide(), Display_brush_mono_zoom_wide2(), Display_cursor(), Display_effect_sprite(), Display_foreback(), Display_grad_block_in_window(), Display_image_limits(), Display_layerbar(), Display_menu(), Display_menu_palette(), Display_menu_palette_avoiding_window(), Display_paintbrush_in_window(), Display_part_of_screen_scaled_double(), Display_part_of_screen_scaled_quad(), Display_part_of_screen_scaled_simple(), Display_part_of_screen_scaled_tall(), Display_part_of_screen_scaled_tall2(), Display_part_of_screen_scaled_tall3(), Display_part_of_screen_scaled_triple(), Display_part_of_screen_scaled_wide(), Display_part_of_screen_scaled_wide2(), Display_separator(), Distort_brush_1_9(), Draw_gradient_preview(), Draw_menu_button(), Draw_preset_sieve_patterns(), Draw_sieve_scaled(), Draw_xor_rect(), Fill_general(), Frame_menu_color(), Get_input(), Hide_cursor(), Horizontal_XOR_line_zoom(), Main_handler(), Move_separator(), Move_window(), Readline_ex_unicode(), Remap_screen_double(), Remap_screen_quad(), Remap_screen_simple(), Remap_screen_tall(), Remap_screen_tall2(), Remap_screen_tall3(), Remap_screen_triple(), Remap_screen_wide(), Remap_screen_wide2(), Scroll_picture(), Tilemap_draw(), Update_part_of_screen(), Update_sieve_area(), Vertical_XOR_line_zoom(), and Window_display_icon_sprite().

◆ Display_cursor()

void Display_cursor ( void  )

◆ Hide_cursor()

void Hide_cursor ( void  )

Boolean: Need to hide/unhide cursor during this step.

◆ Count_used_colors()

word Count_used_colors ( dword usage)

Count used palette indexes in the whole picture Return the total number of different colors Fill in "usage" with the count for each color.

◆ Count_used_colors_area()

word Count_used_colors_area ( dword usage,
word  start_x,
word  start_y,
word  width,
word  height 
)

Same as Count_used_colors, but for a given rectangle in the picture only.

Used bu the C64 block constraint checker.

◆ Window_input_content()

void Window_input_content ( T_Special_button button,
const char *  content 
)

◆ Window_set_input_button()

T_Special_button * Window_set_input_button ( word  x_pos,
word  y_pos,
word  width_in_characters 
)

References NULL.

◆ 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)