1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-05-12 12:00:13 +00:00

Common dialogs support

This commit is contained in:
Samuel Gomes 2022-10-23 12:57:02 +05:30
parent feb2b302d4
commit 93e58baa1d
15 changed files with 8648 additions and 12 deletions

View file

@ -192,6 +192,7 @@ include $(PATH_INTERNAL_C)/parts/core/build.mk
include $(PATH_INTERNAL_C)/parts/input/game_controller/build.mk
include $(PATH_INTERNAL_C)/parts/video/font/ttf/build.mk
include $(PATH_INTERNAL_C)/parts/video/image/build.mk
include $(PATH_INTERNAL_C)/parts/gui/build.mk
.PHONY: all clean
@ -215,6 +216,15 @@ else
QBLIB_NAME := $(addsuffix 0,$(QBLIB_NAME))
endif
ifneq ($(filter y,$(DEP_COMMON_DIALOGS)),)
CXXFLAGS += -DDEPENDENCY_COMMON_DIALOGS
QBLIB_NAME := $(addsuffix 1,$(QBLIB_NAME))
LICENSE_IN_USE += tinyfiledialogs
else
QBLIB_NAME := $(addsuffix 0,$(QBLIB_NAME))
endif
ifneq ($(filter y,$(DEP_CONSOLE_ONLY)),)
CXXFLAGS += -DDEPENDENCY_CONSOLE_ONLY
QBLIB_NAME := $(addsuffix 1,$(QBLIB_NAME))
@ -381,6 +391,10 @@ ifeq ($(OS),win)
ifneq ($(filter y,$(DEP_ICON) $(DEP_ICON_RC) $(DEP_SCREENIMAGE) $(DEP_PRINTER)),)
CXXLIBS += -lgdi32
endif
ifneq ($(filter y,$(DEP_COMMON_DIALOGS)),)
CXXLIBS += -lcomdlg32 -lole32
endif
endif
ifneq ($(filter y,$(DEP_DATA)),)

View file

@ -25,6 +25,7 @@
#include "mutex.h"
#include "audio.h"
#include "image.h"
#include "gui.h"
int32 disableEvents = 0;

View file

@ -30,6 +30,7 @@ int32 func__display();
void qbg_sub_view_print(int32, int32, int32);
qbs *qbs_new(int32, uint8);
qbs *qbs_new_txt(const char *);
qbs *qbs_new_txt_len(const char *, int32_t); // a740g: Added this here for now so that we don't have to decare it ourselves everywhere
qbs *qbs_add(qbs *, qbs *);
qbs *qbs_set(qbs *, qbs *);
void qbg_sub_window(float, float, float, float, int32);

View file

@ -0,0 +1,42 @@
//-----------------------------------------------------------------------------------------------------
// ___ ____ __ _ _ ____ _____ ____ _ _ ___ _ _ _
// / _ \| __ ) / /_ | || | | _ \| ____| / ___| | | |_ _| | | (_) |__ _ __ __ _ _ __ _ _
// | | | | _ \| '_ \| || |_| |_) | _| | | _| | | || | | | | | '_ \| '__/ _` | '__| | | |
// | |_| | |_) | (_) |__ _| __/| |___ | |_| | |_| || | | |___| | |_) | | | (_| | | | |_| |
// \__\_\____/ \___/ |_| |_| |_____| \____|\___/|___| |_____|_|_.__/|_| \__,_|_| \__, |
// |___/
// QB64-PE GUI Library
// Powered by tinyfiledialogs (http://tinyfiledialogs.sourceforge.net)
//
// Copyright (c) 2022 Samuel Gomes
// https://github.com/a740g
//
//-----------------------------------------------------------------------------------------------------
#pragma once
//-----------------------------------------------------------------------------------------------------
// HEADER FILES
//-----------------------------------------------------------------------------------------------------
#include <stdint.h>
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
// FORWARD DECLARATIONS
//-----------------------------------------------------------------------------------------------------
struct qbs;
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
// FUNCTIONS
//-----------------------------------------------------------------------------------------------------
void sub__guiNotifyPopup(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsIconType, int32_t passed);
int32_t func__guiMessageBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsDialogType, qbs *qbsIconType, int32_t nDefaultButton, int32_t passed);
void sub__guiMessageBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsIconType, int32_t passed);
qbs *func__guiInputBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsDefaultInput, int32_t passed);
qbs *func__guiSelectFolderDialog(qbs *qbsTitle, qbs *qbsDefaultPath, int32_t passed);
uint32_t func__guiColorChooserDialog(qbs *qbsTitle, uint32_t nDefaultRGB, int32_t passed);
qbs *func__guiOpenFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbsFilterPatterns, qbs *qbsSingleFilterDescription, int32_t nAllowMultipleSelects,
int32_t passed);
qbs *func__guiSaveFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbsFilterPatterns, qbs *qbsSingleFilterDescription);
//-----------------------------------------------------------------------------------------------------

View file

@ -42,6 +42,13 @@
# endif
# define IMAGE_DEBUG_CHECK(_exp_) // Don't do anything in release builds
#endif
// The byte ordering here are straight from libqb.cpp. So, if libqb.cpp is wrong, then we are wrong! ;)
#define IMAGE_GET_BGRA_RED(c) (uint32_t(c) >> 16 & 0xFF)
#define IMAGE_GET_BGRA_GREEN(c) (uint32_t(c) >> 8 & 0xFF)
#define IMAGE_GET_BGRA_BLUE(c) (uint32_t(c) & 0xFF)
#define IMAGE_GET_BGRA_ALPHA(c) (uint32_t(c) >> 24)
#define IMAGE_MAKE_BGRA(r, g, b, a) (uint32_t((uint8_t(b) | (uint16_t(uint8_t(g)) << 8)) | (uint32_t(uint8_t(r)) << 16) | (uint32_t(uint8_t(a)) << 24)))
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,22 @@
GUI_SRCS := \
gui.cpp
TFD_SRCS := \
tinyfiledialogs.c
GUI_OBJS := $(patsubst %.cpp,$(PATH_INTERNAL_C)/parts/gui/%.o,$(GUI_SRCS))
TFD_OBJS := $(patsubst %.c,$(PATH_INTERNAL_C)/parts/gui/%.o,$(TFD_SRCS))
$(PATH_INTERNAL_C)/parts/gui/%.o: $(PATH_INTERNAL_C)/parts/gui/%.cpp
$(CXX) -O2 $(CXXFLAGS) -DDEPENDENCY_CONSOLE_ONLY -Wall $< -c -o $@
$(PATH_INTERNAL_C)/parts/gui/%.o: $(PATH_INTERNAL_C)/parts/gui/%.c
$(CC) -O2 $(CFLAGS) -DDEPENDENCY_CONSOLE_ONLY -Wall $< -c -o $@
ifdef DEP_COMMON_DIALOGS
EXE_LIBS += $(GUI_OBJS) $(TFD_OBJS)
endif
CLEAN_LIST += $(GUI_OBJS) $(TFD_OBJS)

View file

@ -0,0 +1,364 @@
//-----------------------------------------------------------------------------------------------------
// ___ ____ __ _ _ ____ _____ ____ _ _ ___ _ _ _
// / _ \| __ ) / /_ | || | | _ \| ____| / ___| | | |_ _| | | (_) |__ _ __ __ _ _ __ _ _
// | | | | _ \| '_ \| || |_| |_) | _| | | _| | | || | | | | | '_ \| '__/ _` | '__| | | |
// | |_| | |_) | (_) |__ _| __/| |___ | |_| | |_| || | | |___| | |_) | | | (_| | | | |_| |
// \__\_\____/ \___/ |_| |_| |_____| \____|\___/|___| |_____|_|_.__/|_| \__,_|_| \__, |
// |___/
// QB64-PE GUI Library
// Powered by tinyfiledialogs (http://tinyfiledialogs.sourceforge.net)
//
// Copyright (c) 2022 Samuel Gomes
// https://github.com/a740g
//
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
// HEADER FILES
//-----------------------------------------------------------------------------------------------------
#include "gui.h"
// We need the IMAGE_... macros from here
#include "image.h"
#include "tinyfiledialogs.h"
// The below include is a bad idea because of reasons mentioned in https://github.com/QB64-Phoenix-Edition/QB64pe/issues/172
// However, we need a bunch of things like the 'qbs' structs and some more
// We'll likely keep the 'include' this way because I do not want to duplicate stuff and cause issues
// Matt is already doing work to separate and modularize libqb
// So, this will be replaced with relevant stuff once that work is done
#include "../../libqb.h"
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
// FUNCTIONS
//-----------------------------------------------------------------------------------------------------
/// @brief Splits a string delimted by '|' into an array of strings
/// @param input The string to be parsed
/// @param count Point to an integer that will hold the count of tokens. This cannot be NULL
/// @return Array of string tokens. This must be freed using gui_free_tokens()
static char **gui_tokenize(const char *input, int32_t *count) {
auto str = strdup(input); // since strtok() modifys the string
auto capacity = 2;
char **result = (char **)malloc(capacity * sizeof(*result));
(*count) = 0; // Set count to zero
auto tok = strtok(str, "|");
for (;;) {
if ((*count) >= capacity)
result = (char **)realloc(result, (capacity *= 2) * sizeof(*result));
result[(*count)++] = tok ? strdup(tok) : tok;
if (!tok)
break;
tok = strtok(nullptr, "|");
}
free(str);
--(*count); // Since incrementing happens before we check for null above
return result;
}
/// @brief Frees all string and the array itself created by gui_tokenize()
/// @param tokens Array of string pointers
static void gui_free_tokens(char **tokens) {
for (auto it = tokens; it && *it; ++it)
free(*it);
free(tokens);
}
/// @brief Shows a system notification (on Windows this will be an action center notification)
/// @param qbsTitle [OPTIONAL] Title of the notification
/// @param qbsMessage [OPTIONAL] The message that will be displayed
/// @param qbsIconType [OPTIONAL] Icon type ("info" "warning" "error")
/// @param passed How many parameters were passed?
void sub__guiNotifyPopup(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsIconType, int32_t passed) {
static qbs *aTitle = nullptr;
static qbs *aMessage = nullptr;
static qbs *aIconType = nullptr;
if (!aTitle)
aTitle = qbs_new(0, 0);
if (!aMessage)
aMessage = qbs_new(0, 0);
if (!aIconType)
aIconType = qbs_new(0, 0);
if (passed & 1)
qbs_set(aTitle, qbs_add(qbsTitle, qbs_new_txt_len("\0", 1)));
else
qbs_set(aTitle, qbs_new_txt_len("\0", 1));
if (passed & 2)
qbs_set(aMessage, qbs_add(qbsMessage, qbs_new_txt_len("\0", 1)));
else
qbs_set(aMessage, qbs_new_txt_len("\0", 1));
if (passed & 4)
qbs_set(aIconType, qbs_add(qbsIconType, qbs_new_txt_len("\0", 1)));
else
qbs_set(aIconType, qbs_new_txt("info")); // info if not passed
tinyfd_notifyPopup((const char *)aTitle->chr, (const char *)aMessage->chr, (const char *)aIconType->chr);
}
/// @brief Shows a standard system message dialog box
/// @param qbsTitle [OPTIONAL] Title of the dialog box
/// @param qbsMessage [OPTIONAL] The message that will be displayed
/// @param qbsDialogType [OPTIONAL] The dialog type ("ok" "okcancel" "yesno" "yesnocancel")
/// @param qbsIconType [OPTIONAL] The dialog icon type ("info" "warning" "error" "question")
/// @param nDefaultButon [OPTIONAL] The default button that will be selected
/// @param passed How many parameters were passed?
/// @return 0 for cancel/no, 1 for ok/yes, 2 for no in yesnocancel
int32_t func__guiMessageBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsDialogType, qbs *qbsIconType, int32_t nDefaultButton, int32_t passed) {
static qbs *aTitle = nullptr;
static qbs *aMessage = nullptr;
static qbs *aDialogType = nullptr;
static qbs *aIconType = nullptr;
if (!aTitle)
aTitle = qbs_new(0, 0);
if (!aMessage)
aMessage = qbs_new(0, 0);
if (!aDialogType)
aDialogType = qbs_new(0, 0);
if (!aIconType)
aIconType = qbs_new(0, 0);
qbs_set(aTitle, qbs_add(qbsTitle, qbs_new_txt_len("\0", 1)));
qbs_set(aMessage, qbs_add(qbsMessage, qbs_new_txt_len("\0", 1)));
qbs_set(aDialogType, qbs_add(qbsDialogType, qbs_new_txt_len("\0", 1)));
qbs_set(aIconType, qbs_add(qbsIconType, qbs_new_txt_len("\0", 1)));
if (!passed)
nDefaultButton = 1; // 1 for ok/yes
return tinyfd_messageBox((const char *)aTitle->chr, (const char *)aMessage->chr, (const char *)aDialogType->chr, (const char *)aIconType->chr,
nDefaultButton);
}
/// @brief Shows a standard system message dialog box
/// @param qbsTitle [OPTIONAL] Title of the dialog box
/// @param qbsMessage [OPTIONAL] The message that will be displayed
/// @param qbsIconType [OPTIONAL] The dialog icon type ("info" "warning" "error")
/// @param passed How many parameters were passed?
void sub__guiMessageBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsIconType, int32_t passed) {
static qbs *aTitle = nullptr;
static qbs *aMessage = nullptr;
static qbs *aIconType = nullptr;
if (!aTitle)
aTitle = qbs_new(0, 0);
if (!aMessage)
aMessage = qbs_new(0, 0);
if (!aIconType)
aIconType = qbs_new(0, 0);
if (passed & 1)
qbs_set(aTitle, qbs_add(qbsTitle, qbs_new_txt_len("\0", 1)));
else
qbs_set(aTitle, qbs_new_txt_len("\0", 1));
if (passed & 2)
qbs_set(aMessage, qbs_add(qbsMessage, qbs_new_txt_len("\0", 1)));
else
qbs_set(aMessage, qbs_new_txt_len("\0", 1));
if (passed & 4)
qbs_set(aIconType, qbs_add(qbsIconType, qbs_new_txt_len("\0", 1)));
else
qbs_set(aIconType, qbs_new_txt("info")); // info if not passed
tinyfd_messageBox((const char *)aTitle->chr, (const char *)aMessage->chr, "ok", (const char *)aIconType->chr, 1);
}
/// @brief Shows an input box for getting a string from the user
/// @param qbsTitle [OPTIONAL] Title of the dialog box
/// @param qbsMessage [OPTIONAL] The message or prompt that will be displayed
/// @param qbsDefaultInput [OPTIONAL] The default response that can be changed by the user
/// @param passed How many parameters were passed?
/// @return The user response or an empty string if the user cancelled
qbs *func__guiInputBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsDefaultInput, int32_t passed) {
static qbs *aTitle = nullptr;
static qbs *aMessage = nullptr;
static qbs *aDefaultInput = nullptr;
char *sDefaultInput = nullptr;
if (!aTitle)
aTitle = qbs_new(0, 0);
if (!aMessage)
aMessage = qbs_new(0, 0);
if (!aDefaultInput)
aDefaultInput = qbs_new(0, 0);
qbs_set(aTitle, qbs_add(qbsTitle, qbs_new_txt_len("\0", 1)));
qbs_set(aMessage, qbs_add(qbsMessage, qbs_new_txt_len("\0", 1)));
if (passed) {
qbs_set(aDefaultInput, qbs_add(qbsDefaultInput, qbs_new_txt_len("\0", 1)));
sDefaultInput =
aDefaultInput->len == 1 ? nullptr : (char *)aDefaultInput->chr; // if string is "" then password box, else we pass the default input as is
} else {
qbs_set(aDefaultInput, qbs_new_txt_len("\0", 1)); // input box by default
sDefaultInput = (char *)aDefaultInput->chr;
}
auto sInput = tinyfd_inputBox((const char *)aTitle->chr, (const char *)aMessage->chr, (const char *)sDefaultInput);
return qbs_new_txt(sInput);
}
/// @brief Shows the browse for folder dialog box
/// @param qbsTitle [OPTIONAL] Title of the dialog box
/// @param qbsDefaultPath [OPTIONAL] The default path from where to start browsing
/// @param passed How many parameters were passed?
/// @return The path selected by the user or an empty string if the user cancelled
qbs *func__guiSelectFolderDialog(qbs *qbsTitle, qbs *qbsDefaultPath, int32_t passed) {
static qbs *aTitle = nullptr;
static qbs *aDefaultPath = nullptr;
if (!aTitle)
aTitle = qbs_new(0, 0);
if (!aDefaultPath)
aDefaultPath = qbs_new(0, 0);
qbs_set(aTitle, qbs_add(qbsTitle, qbs_new_txt_len("\0", 1)));
if (passed)
qbs_set(aDefaultPath, qbs_add(qbsDefaultPath, qbs_new_txt_len("\0", 1)));
else
qbs_set(aDefaultPath, qbs_new_txt_len("\0", 1));
auto sFolder = tinyfd_selectFolderDialog((const char *)aTitle->chr, (const char *)aDefaultPath->chr);
return qbs_new_txt(sFolder);
}
/// @brief Shows the color picker dialog box
/// @param qbsTitle [OPTIONAL] Title of the dialog box
/// @param nDefaultRGB [OPTIONAL] Default selected color
/// @param passed How many parameters were passed?
/// @return 0 on cancel (i.e. no color, no alpha, nothing). Else, returns color with alpha set to 255
uint32_t func__guiColorChooserDialog(qbs *qbsTitle, uint32_t nDefaultRGB, int32_t passed) {
static qbs *aTitle = nullptr;
if (!aTitle)
aTitle = qbs_new(0, 0);
qbs_set(aTitle, qbs_add(qbsTitle, qbs_new_txt_len("\0", 1)));
if (!passed)
nDefaultRGB = 0;
// Break the color into RGB components
uint8_t lRGB[3] = {IMAGE_GET_BGRA_RED(nDefaultRGB), IMAGE_GET_BGRA_GREEN(nDefaultRGB), IMAGE_GET_BGRA_BLUE(nDefaultRGB)};
// On cancel, return 0 (i.e. no color, no alpha, nothing). Else, return color with alpha set to 255
return !tinyfd_colorChooser((const char *)aTitle->chr, nullptr, lRGB, lRGB) ? 0 : IMAGE_MAKE_BGRA(lRGB[0], lRGB[1], lRGB[2], 0xFF);
}
/// @brief Shows the system file open dialog box
/// @param qbsTitle [OPTIONAL] Title of the dialog box
/// @param qbsDefaultPathAndFile [OPTIONAL] The default path (and filename) that will be pre-populated
/// @param qbsFilterPatterns [OPTIONAL] File filters separated using '|' (e.g. "*.png|*.jpg")
/// @param qbsSingleFilterDescription [OPTIONAL] Single filter description (e.g. "Image files")
/// @param nAllowMultipleSelects [OPTIONAL] Should multiple file selection be allowed?
/// @param passed How many parameters were passed?
/// @return The file name (or names separated by '|' if multiselect was on) selected by the user or an empty string if the user cancelled
qbs *func__guiOpenFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbsFilterPatterns, qbs *qbsSingleFilterDescription, int32_t nAllowMultipleSelects,
int32_t passed) {
static qbs *aTitle = nullptr;
static qbs *aDefaultPathAndFile = nullptr;
static qbs *aFilterPatterns = nullptr;
static qbs *aSingleFilterDescription = nullptr;
if (!aTitle)
aTitle = qbs_new(0, 0);
if (!aDefaultPathAndFile)
aDefaultPathAndFile = qbs_new(0, 0);
if (!aFilterPatterns)
aFilterPatterns = qbs_new(0, 0);
if (!aSingleFilterDescription)
aSingleFilterDescription = qbs_new(0, 0);
qbs_set(aTitle, qbs_add(qbsTitle, qbs_new_txt_len("\0", 1)));
qbs_set(aDefaultPathAndFile, qbs_add(qbsDefaultPathAndFile, qbs_new_txt_len("\0", 1)));
qbs_set(aFilterPatterns, qbs_add(qbsFilterPatterns, qbs_new_txt_len("\0", 1)));
qbs_set(aSingleFilterDescription, qbs_add(qbsSingleFilterDescription, qbs_new_txt_len("\0", 1)));
if (!passed)
nAllowMultipleSelects = false;
char *sSingleFilterDescription = aSingleFilterDescription->len == 1 ? nullptr : (char *)aSingleFilterDescription->chr;
int32_t aNumOfFilterPatterns;
auto psaFilterPatterns = gui_tokenize((const char *)aFilterPatterns->chr, &aNumOfFilterPatterns); // get the number of file filters & count
auto sFileName = tinyfd_openFileDialog((const char *)aTitle->chr, (const char *)aDefaultPathAndFile->chr, aNumOfFilterPatterns, psaFilterPatterns,
(const char *)sSingleFilterDescription, nAllowMultipleSelects);
gui_free_tokens(psaFilterPatterns); // free memory used by tokenizer
return qbs_new_txt(sFileName);
}
/// @brief Shows the system file save dialog box
/// @param qbsTitle [OPTIONAL] Title of the dialog box
/// @param qbsDefaultPathAndFile [OPTIONAL] The default path (and filename) that will be pre-populated
/// @param qbsFilterPatterns [OPTIONAL] File filters separated using '|' (e.g. "*.png|*.jpg")
/// @param qbsSingleFilterDescription [OPTIONAL] Single filter description (e.g. "Image files")
/// @return The file name selected by the user or an empty string if the user cancelled
qbs *func__guiSaveFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbsFilterPatterns, qbs *qbsSingleFilterDescription) {
static qbs *aTitle = nullptr;
static qbs *aDefaultPathAndFile = nullptr;
static qbs *aFilterPatterns = nullptr;
static qbs *aSingleFilterDescription = nullptr;
if (!aTitle)
aTitle = qbs_new(0, 0);
if (!aDefaultPathAndFile)
aDefaultPathAndFile = qbs_new(0, 0);
if (!aFilterPatterns)
aFilterPatterns = qbs_new(0, 0);
if (!aSingleFilterDescription)
aSingleFilterDescription = qbs_new(0, 0);
qbs_set(aTitle, qbs_add(qbsTitle, qbs_new_txt_len("\0", 1)));
qbs_set(aDefaultPathAndFile, qbs_add(qbsDefaultPathAndFile, qbs_new_txt_len("\0", 1)));
qbs_set(aFilterPatterns, qbs_add(qbsFilterPatterns, qbs_new_txt_len("\0", 1)));
qbs_set(aSingleFilterDescription, qbs_add(qbsSingleFilterDescription, qbs_new_txt_len("\0", 1)));
char *sSingleFilterDescription = aSingleFilterDescription->len == 1 ? nullptr : (char *)aSingleFilterDescription->chr;
int32_t aNumOfFilterPatterns;
auto psaFilterPatterns = gui_tokenize((const char *)aFilterPatterns->chr, &aNumOfFilterPatterns); // get the number of file filters & count
auto sFileName = tinyfd_saveFileDialog((const char *)aTitle->chr, (const char *)aDefaultPathAndFile->chr, aNumOfFilterPatterns, psaFilterPatterns,
(const char *)sSingleFilterDescription);
gui_free_tokens(psaFilterPatterns); // free memory used by tokenizer
return qbs_new_txt(sFileName);
}
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,303 @@
/* If you are using a C++ compiler to compile tinyfiledialogs.c (maybe renamed with an extension ".cpp")
then comment out << extern "C" >> bellow in this header file) */
/*_________
/ \ tinyfiledialogs.h v3.8.8 [Apr 22, 2021] zlib licence
|tiny file| Unique header file created [November 9, 2014]
| dialogs | Copyright (c) 2014 - 2021 Guillaume Vareille http://ysengrin.com
\____ ___/ http://tinyfiledialogs.sourceforge.net
\| git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
____________________________________________
| |
| email: tinyfiledialogs at ysengrin.com |
|____________________________________________|
________________________________________________________________________________
| ____________________________________________________________________________ |
| | | |
| | on windows: | |
| | - for UTF-16, use the wchar_t functions at the bottom of the header file | |
| | - _wfopen() requires wchar_t | |
| | | |
| | - in tinyfiledialogs, char is UTF-8 by default (since v3.6) | |
| | - but fopen() expects MBCS (not UTF-8) | |
| | - if you want char to be MBCS: set tinyfd_winUtf8 to 0 | |
| | | |
| | - alternatively, tinyfiledialogs provides | |
| | functions to convert between UTF-8, UTF-16 and MBCS | |
| |____________________________________________________________________________| |
|________________________________________________________________________________|
If you like tinyfiledialogs, please upvote my stackoverflow answer
https://stackoverflow.com/a/47651444
- License -
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef TINYFILEDIALOGS_H
#define TINYFILEDIALOGS_H
#ifdef __cplusplus
/* if tinydialogs.c is compiled as C++ code rather than C code, you may need to comment this out
and the corresponding closing bracket near the end of this file. */
extern "C" {
#endif
/******************************************************************************************************/
/**************************************** UTF-8 on Windows ********************************************/
/******************************************************************************************************/
#ifdef _WIN32
/* On windows, if you want to use UTF-8 ( instead of the UTF-16/wchar_t functions at the end of this file )
Make sure your code is really prepared for UTF-8 (on windows, functions like fopen() expect MBCS and not UTF-8) */
extern int tinyfd_winUtf8; /* on windows char strings can be 1:UTF-8(default) or 0:MBCS */
/* for MBCS change this to 0, in tinyfiledialogs.c or in your code */
/* Here are some functions to help you convert between UTF-16 UTF-8 MBSC */
char * tinyfd_utf8toMbcs(char const * aUtf8string);
char * tinyfd_utf16toMbcs(wchar_t const * aUtf16string);
wchar_t * tinyfd_mbcsTo16(char const * aMbcsString);
char * tinyfd_mbcsTo8(char const * aMbcsString);
wchar_t * tinyfd_utf8to16(char const * aUtf8string);
char * tinyfd_utf16to8(wchar_t const * aUtf16string);
#endif
/******************************************************************************************************/
/******************************************************************************************************/
/******************************************************************************************************/
/************* 3 funtions for C# (you don't need this in C or C++) : */
char const * tinyfd_getGlobalChar(char const * aCharVariableName); /* returns NULL on error */
int tinyfd_getGlobalInt(char const * aIntVariableName); /* returns -1 on error */
int tinyfd_setGlobalInt(char const * aIntVariableName, int aValue); /* returns -1 on error */
/* aCharVariableName: "tinyfd_version" "tinyfd_needs" "tinyfd_response"
aIntVariableName : "tinyfd_verbose" "tinyfd_silent" "tinyfd_allowCursesDialogs"
"tinyfd_forceConsole" "tinyfd_assumeGraphicDisplay" "tinyfd_winUtf8"
**************/
extern char tinyfd_version[8]; /* contains tinyfd current version number */
extern char tinyfd_needs[]; /* info about requirements */
extern int tinyfd_verbose; /* 0 (default) or 1 : on unix, prints the command line calls */
extern int tinyfd_silent; /* 1 (default) or 0 : on unix, hide errors and warnings from called dialogs */
/* Curses dialogs are difficult to use, on windows they are only ascii and uses the unix backslah */
extern int tinyfd_allowCursesDialogs; /* 0 (default) or 1 */
extern int tinyfd_forceConsole; /* 0 (default) or 1 */
/* for unix & windows: 0 (graphic mode) or 1 (console mode).
0: try to use a graphic solution, if it fails then it uses console mode.
1: forces all dialogs into console mode even when an X server is present,
it can use the package dialog or dialog.exe.
on windows it only make sense for console applications */
extern int tinyfd_assumeGraphicDisplay; /* 0 (default) or 1 */
/* some systems don't set the environment variable DISPLAY even when a graphic display is present.
set this to 1 to tell tinyfiledialogs to assume the existence of a graphic display */
extern char tinyfd_response[1024];
/* if you pass "tinyfd_query" as aTitle,
the functions will not display the dialogs
but will return 0 for console mode, 1 for graphic mode.
tinyfd_response is then filled with the retain solution.
possible values for tinyfd_response are (all lowercase)
for graphic mode:
windows_wchar windows applescript kdialog zenity zenity3 matedialog
shellementary qarma yad python2-tkinter python3-tkinter python-dbus
perl-dbus gxmessage gmessage xmessage xdialog gdialog
for console mode:
dialog whiptail basicinput no_solution */
void tinyfd_beep(void);
int tinyfd_notifyPopup(
char const * aTitle, /* NULL or "" */
char const * aMessage, /* NULL or "" may contain \n \t */
char const * aIconType); /* "info" "warning" "error" */
/* return has only meaning for tinyfd_query */
int tinyfd_messageBox(
char const * aTitle , /* NULL or "" */
char const * aMessage , /* NULL or "" may contain \n \t */
char const * aDialogType , /* "ok" "okcancel" "yesno" "yesnocancel" */
char const * aIconType , /* "info" "warning" "error" "question" */
int aDefaultButton ) ;
/* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */
char * tinyfd_inputBox(
char const * aTitle , /* NULL or "" */
char const * aMessage , /* NULL or "" (\n and \t have no effect) */
char const * aDefaultInput ) ; /* NULL passwordBox, "" inputbox */
/* returns NULL on cancel */
char * tinyfd_saveFileDialog(
char const * aTitle , /* NULL or "" */
char const * aDefaultPathAndFile , /* NULL or "" */
int aNumOfFilterPatterns , /* 0 (1 in the following example) */
char const * const * aFilterPatterns , /* NULL or char const * lFilterPatterns[1]={"*.txt"} */
char const * aSingleFilterDescription ) ; /* NULL or "text files" */
/* returns NULL on cancel */
char * tinyfd_openFileDialog(
char const * aTitle, /* NULL or "" */
char const * aDefaultPathAndFile, /* NULL or "" */
int aNumOfFilterPatterns , /* 0 (2 in the following example) */
char const * const * aFilterPatterns, /* NULL or char const * lFilterPatterns[2]={"*.png","*.jpg"}; */
char const * aSingleFilterDescription, /* NULL or "image files" */
int aAllowMultipleSelects ) ; /* 0 or 1 */
/* in case of multiple files, the separator is | */
/* returns NULL on cancel */
char * tinyfd_selectFolderDialog(
char const * aTitle, /* NULL or "" */
char const * aDefaultPath); /* NULL or "" */
/* returns NULL on cancel */
char * tinyfd_colorChooser(
char const * aTitle, /* NULL or "" */
char const * aDefaultHexRGB, /* NULL or "#FF0000" */
unsigned char const aDefaultRGB[3] , /* unsigned char lDefaultRGB[3] = { 0 , 128 , 255 }; */
unsigned char aoResultRGB[3] ) ; /* unsigned char lResultRGB[3]; */
/* returns the hexcolor as a string "#FF0000" */
/* aoResultRGB also contains the result */
/* aDefaultRGB is used only if aDefaultHexRGB is NULL */
/* aDefaultRGB and aoResultRGB can be the same array */
/* returns NULL on cancel */
/************ WINDOWS ONLY SECTION ************************/
#ifdef _WIN32
/* windows only - utf-16 version */
int tinyfd_notifyPopupW(
wchar_t const * aTitle, /* NULL or L"" */
wchar_t const * aMessage, /* NULL or L"" may contain \n \t */
wchar_t const * aIconType); /* L"info" L"warning" L"error" */
/* windows only - utf-16 version */
int tinyfd_messageBoxW(
wchar_t const * aTitle, /* NULL or L"" */
wchar_t const * aMessage, /* NULL or L"" may contain \n \t */
wchar_t const * aDialogType, /* L"ok" L"okcancel" L"yesno" */
wchar_t const * aIconType, /* L"info" L"warning" L"error" L"question" */
int aDefaultButton ); /* 0 for cancel/no , 1 for ok/yes */
/* returns 0 for cancel/no , 1 for ok/yes */
/* windows only - utf-16 version */
wchar_t * tinyfd_inputBoxW(
wchar_t const * aTitle, /* NULL or L"" */
wchar_t const * aMessage, /* NULL or L"" (\n nor \t not respected) */
wchar_t const * aDefaultInput); /* NULL passwordBox, L"" inputbox */
/* windows only - utf-16 version */
wchar_t * tinyfd_saveFileDialogW(
wchar_t const * aTitle, /* NULL or L"" */
wchar_t const * aDefaultPathAndFile, /* NULL or L"" */
int aNumOfFilterPatterns, /* 0 (1 in the following example) */
wchar_t const * const * aFilterPatterns, /* NULL or wchar_t const * lFilterPatterns[1]={L"*.txt"} */
wchar_t const * aSingleFilterDescription); /* NULL or L"text files" */
/* returns NULL on cancel */
/* windows only - utf-16 version */
wchar_t * tinyfd_openFileDialogW(
wchar_t const * aTitle, /* NULL or L"" */
wchar_t const * aDefaultPathAndFile, /* NULL or L"" */
int aNumOfFilterPatterns , /* 0 (2 in the following example) */
wchar_t const * const * aFilterPatterns, /* NULL or wchar_t const * lFilterPatterns[2]={L"*.png","*.jpg"} */
wchar_t const * aSingleFilterDescription, /* NULL or L"image files" */
int aAllowMultipleSelects ) ; /* 0 or 1 */
/* in case of multiple files, the separator is | */
/* returns NULL on cancel */
/* windows only - utf-16 version */
wchar_t * tinyfd_selectFolderDialogW(
wchar_t const * aTitle, /* NULL or L"" */
wchar_t const * aDefaultPath); /* NULL or L"" */
/* returns NULL on cancel */
/* windows only - utf-16 version */
wchar_t * tinyfd_colorChooserW(
wchar_t const * aTitle, /* NULL or L"" */
wchar_t const * aDefaultHexRGB, /* NULL or L"#FF0000" */
unsigned char const aDefaultRGB[3], /* unsigned char lDefaultRGB[3] = { 0 , 128 , 255 }; */
unsigned char aoResultRGB[3]); /* unsigned char lResultRGB[3]; */
/* returns the hexcolor as a string L"#FF0000" */
/* aoResultRGB also contains the result */
/* aDefaultRGB is used only if aDefaultHexRGB is NULL */
/* aDefaultRGB and aoResultRGB can be the same array */
/* returns NULL on cancel */
#endif /*_WIN32 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* TINYFILEDIALOGS_H */
/*
________________________________________________________________________________
| ____________________________________________________________________________ |
| | | |
| | on windows: | |
| | - for UTF-16, use the wchar_t functions at the bottom of the header file | |
| | - _wfopen() requires wchar_t | |
| | | |
| | - in tinyfiledialogs, char is UTF-8 by default (since v3.6) | |
| | - but fopen() expects MBCS (not UTF-8) | |
| | - if you want char to be MBCS: set tinyfd_winUtf8 to 0 | |
| | | |
| | - alternatively, tinyfiledialogs provides | |
| | functions to convert between UTF-8, UTF-16 and MBCS | |
| |____________________________________________________________________________| |
|________________________________________________________________________________|
- This is not for ios nor android (it works in termux though).
- The files can be renamed with extension ".cpp" as the code is 100% compatible C C++
(just comment out << extern "C" >> in the header file)
- Windows is fully supported from XP to 10 (maybe even older versions)
- C# & LUA via dll, see files in the folder EXTRAS
- OSX supported from 10.4 to latest (maybe even older versions)
- Do not use " and ' as the dialogs will be displayed with a warning
instead of the title, message, etc...
- There's one file filter only, it may contain several patterns.
- If no filter description is provided,
the list of patterns will become the description.
- On windows link against Comdlg32.lib and Ole32.lib
(on windows the no linking claim is a lie)
- On unix: it tries command line calls, so no such need (NO LINKING).
- On unix you need one of the following:
applescript, kdialog, zenity, matedialog, shellementary, qarma, yad,
python (2 or 3)/tkinter/python-dbus (optional), Xdialog
or curses dialogs (opens terminal if running without console).
- One of those is already included on most (if not all) desktops.
- In the absence of those it will use gdialog, gxmessage or whiptail
with a textinputbox. If nothing is found, it switches to basic console input,
it opens a console if needed (requires xterm + bash).
- for curses dialogs you must set tinyfd_allowCursesDialogs=1
- You can query the type of dialog that will be used (pass "tinyfd_query" as aTitle)
- String memory is preallocated statically for all the returned values.
- File and path names are tested before return, they should be valid.
- tinyfd_forceConsole=1; at run time, forces dialogs into console mode.
- On windows, console mode only make sense for console applications.
- On windows, console mode is not implemented for wchar_T UTF-16.
- Mutiple selects are not possible in console mode.
- The package dialog must be installed to run in curses dialogs in console mode.
It is already installed on most unix systems.
- On osx, the package dialog can be installed via
http://macappstore.org/dialog or http://macports.org
- On windows, for curses dialogs console mode,
dialog.exe should be copied somewhere on your executable path.
It can be found at the bottom of the following page:
http://andrear.altervista.org/home/cdialog.php
*/

View file

@ -42,12 +42,6 @@
//-----------------------------------------------------------------------------------------------------
// MACROS
//-----------------------------------------------------------------------------------------------------
// The byte ordering here are straight from libqb.cpp. So, if libqb.cpp is wrong, then we are wrong! ;)
#define IMAGE_GET_BGRA_RED(c) (uint32_t(c) >> 16 & 0xFF)
#define IMAGE_GET_BGRA_GREEN(c) (uint32_t(c) >> 8 & 0xFF)
#define IMAGE_GET_BGRA_BLUE(c) (uint32_t(c) & 0xFF)
#define IMAGE_GET_BGRA_ALPHA(c) (uint32_t(c) >> 24)
#define IMAGE_MAKE_BGRA(r, g, b, a) (uint32_t((uint8_t(b) | (uint16_t(uint8_t(g)) << 8)) | (uint32_t(uint8_t(r)) << 16) | (uint32_t(uint8_t(a)) << 24)))
// Calculates the RGB distance in the RGB color cube
#define IMAGE_CALCULATE_RGB_DISTANCE(r1, g1, b1, r2, g2, b2) \
sqrt(((float(r2) - float(r1)) * (float(r2) - float(r1))) + ((float(g2) - float(g1)) * (float(g2) - float(g1))) + \

View file

@ -1,5 +1,6 @@
#include "common.h"
#include "audio.h"
#include "gui.h"
extern int32 func__cinp(int32 toggle,
int32 passed); // Console INP scan code reader

View file

@ -0,0 +1,47 @@
--------------------------------------------------------------------------------
License of tiny file dialogs
/*_________
/ \ tinyfiledialogs.c v3.8.8 [Apr 22, 2021] zlib licence
|tiny file| Unique code file created [November 9, 2014]
| dialogs | Copyright (c) 2014 - 2021 Guillaume Vareille http://ysengrin.com
\____ ___/ http://tinyfiledialogs.sourceforge.net
\| git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
____________________________________________
| |
| email: tinyfiledialogs at ysengrin.com |
|____________________________________________|
_________________________________________________________________________________
| |
| the windows only wchar_t UTF-16 prototypes are at the bottom of the header file |
|_________________________________________________________________________________|
_________________________________________________________
| |
| on windows: - since v3.6 char is UTF-8 by default |
| - if you want MBCS set tinyfd_winUtf8 to 0 |
| - functions like fopen expect MBCS |
|_________________________________________________________|
If you like tinyfiledialogs, please upvote my stackoverflow answer
https://stackoverflow.com/a/47651444
- License -
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-----------
Thanks for contributions, bug corrections & thorough testing to:
- Don Heyse http://ldglite.sf.net for bug corrections & thorough testing!
- Paul Rouget
*/

View file

@ -107,6 +107,7 @@ CONST DEPENDENCY_ICON = 10: DEPENDENCY_LAST = DEPENDENCY_LAST + 1
CONST DEPENDENCY_SCREENIMAGE = 11: DEPENDENCY_LAST = DEPENDENCY_LAST + 1
CONST DEPENDENCY_DEVICEINPUT = 12: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 'removes support for gamepad input if not present
CONST DEPENDENCY_ZLIB = 13: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 'ZLIB library linkage, if desired, for compression/decompression.
CONST DEPENDENCY_COMMON_DIALOGS = 14: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 ' a740g: common dialogs support using tiny file dialogs
@ -12511,6 +12512,7 @@ IF DEPENDENCY(DEPENDENCY_SCREENIMAGE) THEN makedeps$ = makedeps$ + " DEP_SCREENI
IF DEPENDENCY(DEPENDENCY_LOADFONT) THEN makedeps$ = makedeps$ + " DEP_FONT=y"
IF DEPENDENCY(DEPENDENCY_DEVICEINPUT) THEN makedeps$ = makedeps$ + " DEP_DEVICEINPUT=y"
IF DEPENDENCY(DEPENDENCY_ZLIB) THEN makedeps$ = makedeps$ + " DEP_ZLIB=y"
IF DEPENDENCY(DEPENDENCY_COMMON_DIALOGS) THEN makedeps$ = makedeps$ + " DEP_COMMON_DIALOGS=y" ' a740g: Common dialogs support using tiny file dialogs
IF inline_DATA = 0 AND DataOffset THEN makedeps$ = makedeps$ + " DEP_DATA=y"
IF Console THEN makedeps$ = makedeps$ + " DEP_CONSOLE=y"
IF ExeIconSet OR VersionInfoSet THEN makedeps$ = makedeps$ + " DEP_ICON_RC=y"
@ -13293,11 +13295,11 @@ FUNCTION ParseCMDLineArgs$ ()
END IF
END FUNCTION
FUNCTION InvalidSettingError$(token$)
FUNCTION InvalidSettingError$ (token$)
InvalidSettingError$ = "Invalid temporary setting switch: " + AddQuotes$(token$)
END FUNCTION
SUB PrintTemporarySettingsHelpAndExit(errstr$)
SUB PrintTemporarySettingsHelpAndExit (errstr$)
_DEST _CONSOLE
PRINT "QB64-PE Compiler V" + Version$
@ -13321,7 +13323,7 @@ SUB PrintTemporarySettingsHelpAndExit(errstr$)
SYSTEM
END SUB
FUNCTION ParseBooleanSetting&(token$, setting AS _UNSIGNED LONG)
FUNCTION ParseBooleanSetting& (token$, setting AS _UNSIGNED LONG)
DIM equals AS LONG
DIM value AS STRING
@ -13344,7 +13346,7 @@ FUNCTION ParseBooleanSetting&(token$, setting AS _UNSIGNED LONG)
END SELECT
END FUNCTION
FUNCTION ParseLongSetting&(token$, setting AS _UNSIGNED LONG)
FUNCTION ParseLongSetting& (token$, setting AS _UNSIGNED LONG)
DIM equals AS LONG
equals = INSTR(token$, "=")
@ -13355,7 +13357,7 @@ FUNCTION ParseLongSetting&(token$, setting AS _UNSIGNED LONG)
ParseLongSetting& = -1
END FUNCTION
FUNCTION ParseStringSetting&(token$, setting AS STRING)
FUNCTION ParseStringSetting& (token$, setting AS STRING)
DIM equals AS LONG
equals = INSTR(token$, "=")

View file

@ -1970,7 +1970,7 @@ id.args = 2
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER)
id.specialformat = "?[,?]"
id.ret = ULONGTYPE - ISPOINTER
id.hr_syntax = "_SNDOPEN(fileName$)"
id.hr_syntax = "_SNDOPEN(fileName$[, capabilities$])"
regid
clearid
@ -3866,3 +3866,103 @@ id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
id.hr_syntax = "_TOGGLEBIT(numericalVariable, numericalValue)"
regid
' a740g: Common dialog support using tiny file dialogs
clearid
id.n = qb64prefix$ + "NotifyPopup" ' Name in CaMeL case
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
id.subfunc = 2 ' 1 = function, 2 = sub
id.callname = "sub__guiNotifyPopup" ' C/C++ function name
id.args = 3 ' number of arguments - "passed"
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) ' arguments & types
id.specialformat = "[?][,[?][,?]]" ' special format (optional in [])
id.hr_syntax = "_NOTIFYPOPUP [title$][, message$][, iconType$]" ' syntax help
regid
clearid
id.n = qb64prefix$ + "MessageBox" ' Name in CaMeL case
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
id.subfunc = 2 ' 1 = function, 2 = sub
id.callname = "sub__guiMessageBox" ' C/C++ function name
id.args = 3 ' number of arguments - "passed"
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) ' arguments & types
id.specialformat = "[?][,[?][,?]]" ' special format (optional in [])
id.hr_syntax = "_MESSAGEBOX [title$][, message$][, iconType$]" ' syntax help
regid
clearid
id.n = qb64prefix$ + "SelectFolderDialog" ' Name in CaMeL case
id.musthave = "$"
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
id.subfunc = 1 ' 1 = function, 2 = sub
id.callname = "func__guiSelectFolderDialog" ' C/C++ function name
id.args = 2 ' number of arguments - "passed"
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) ' arguments & types
id.specialformat = "?[,?]" ' special format (optional in [])
id.ret = STRINGTYPE - ISPOINTER ' return type for functions
id.hr_syntax = "_SELECTFOLDERDIALOG$(title$[, defaultPath$])" ' syntax help
regid
clearid
id.n = qb64prefix$ + "ColorChooserDialog" ' Name in CaMeL case
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
id.subfunc = 1 ' 1 = function, 2 = sub
id.callname = "func__guiColorChooserDialog" ' C/C++ function name
id.args = 2 ' number of arguments - "passed"
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER) ' arguments & types
id.specialformat = "?[,?]" ' special format (optional in [])
id.ret = LONGTYPE - ISPOINTER ' return type for functions
id.hr_syntax = "_COLORCHOOSERDIALOG&(title$[, defaultRGB&])" ' syntax help
regid
clearid
id.n = qb64prefix$ + "MessageBox" ' Name in CaMeL case
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
id.subfunc = 1 ' 1 = function, 2 = sub
id.callname = "func__guiMessageBox" ' C/C++ function name
id.args = 5 ' number of arguments - "passed"
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER) ' arguments & types
id.specialformat = "?,?,?,?[,?]" ' special format (optional in [])
id.ret = LONGTYPE - ISPOINTER ' return type for functions
id.hr_syntax = "_MESSAGEBOX&(title$, message$, dialogType$, iconType$[, defaultButton&])" ' syntax help
regid
clearid
id.n = qb64prefix$ + "InputBox" ' Name in CaMeL case
id.musthave = "$"
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
id.subfunc = 1 ' 1 = function, 2 = sub
id.callname = "func__guiInputBox" ' C/C++ function name
id.args = 3 ' number of arguments - "passed"
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) ' arguments & types
id.specialformat = "?,?[,?]" ' special format (optional in [])
id.ret = STRINGTYPE - ISPOINTER ' return type for functions
id.hr_syntax = "_INPUTBOX$(title$, message$[, defaultInput$])" ' syntax help
regid
clearid
id.n = qb64prefix$ + "OpenFileDialog" ' Name in CaMeL case
id.musthave = "$"
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
id.subfunc = 1 ' 1 = function, 2 = sub
id.callname = "func__guiOpenFileDialog" ' C/C++ function name
id.args = 5 ' number of arguments - "passed"
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER) ' arguments & types
id.specialformat = "?,?,?,?[,?]" ' special format (optional in [])
id.ret = STRINGTYPE - ISPOINTER ' return type for functions
id.hr_syntax = "_OPENFILEDIALOG$(title$, defaultPathAndFile$, filterPatterns$, singleFilterDescription$[, allowMultipleSelects&])" ' syntax help
regid
clearid
id.n = qb64prefix$ + "SaveFileDialog" ' Name in CaMeL case
id.musthave = "$"
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
id.subfunc = 1 ' 1 = function, 2 = sub
id.callname = "func__guiSaveFileDialog" ' C/C++ function name
id.args = 4 ' number of arguments - "passed"
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) ' arguments & types
id.ret = STRINGTYPE - ISPOINTER ' return type for functions
id.hr_syntax = "_SAVEFILEDIALOG$(title$, defaultPathAndFile$, filterPatterns$, singleFilterDescription$)" ' syntax help
regid
' a740g: Common dialog support using tiny file dialogs

View file

@ -5,4 +5,5 @@ listOfKeywords$ = listOfKeywords$ + "_GLCOPYTEXSUBIMAGE2D@_GLCULLFACE@_GLDELETEL
listOfKeywords$ = listOfKeywords$ + "_GLPOPATTRIB@_GLPOPCLIENTATTRIB@_GLPOPMATRIX@_GLPOPNAME@_GLPRIORITIZETEXTURES@_GLPUSHATTRIB@_GLPUSHCLIENTATTRIB@_GLPUSHMATRIX@_GLPUSHNAME@_GLRASTERPOS2D@_GLRASTERPOS2DV@_GLRASTERPOS2F@_GLRASTERPOS2FV@_GLRASTERPOS2I@_GLRASTERPOS2IV@_GLRASTERPOS2S@_GLRASTERPOS2SV@_GLRASTERPOS3D@_GLRASTERPOS3DV@_GLRASTERPOS3F@_GLRASTERPOS3FV@_GLRASTERPOS3I@_GLRASTERPOS3IV@_GLRASTERPOS3S@_GLRASTERPOS3SV@_GLRASTERPOS4D@_GLRASTERPOS4DV@_GLRASTERPOS4F@_GLRASTERPOS4FV@_GLRASTERPOS4I@_GLRASTERPOS4IV@_GLRASTERPOS4S@_GLRASTERPOS4SV@_GLREADBUFFER@_GLREADPIXELS@_GLRECTD@_GLRECTDV@_GLRECTF@_GLRECTFV@_GLRECTI@_GLRECTIV@_GLRECTS@_GLRECTSV@_GLRENDERMODE@_GLROTATED@_GLROTATEF@_GLSCALED@_GLSCALEF@_GLSCISSOR@_GLSELECTBUFFER@_GLSHADEMODEL@_GLSTENCILFUNC@_GLSTENCILMASK@_GLSTENCILOP@_GLTEXCOORD1D@_GLTEXCOORD1DV@_GLTEXCOORD1F@_GLTEXCOORD1FV@_GLTEXCOORD1I@_GLTEXCOORD1IV@_GLTEXCOORD1S@_GLTEXCOORD1SV@_GLTEXCOORD2D@_GLTEXCOORD2DV@_GLTEXCOORD2F@_GLTEXCOORD2FV@_GLTEXCOORD2I@_GLTEXCOORD2IV@_GLTEXCOORD2S@_GLTEXCOORD2SV@_GLTEXCOORD3D@_GLTEXCOORD3DV@_GLTEXCOORD3F@_GLTEXCOORD3FV@_GLTEXCOORD3I@_GLTEXCOORD3IV@_GLTEXCOORD3S@_GLTEXCOORD3SV@_GLTEXCOORD4D@_GLTEXCOORD4DV@_GLTEXCOORD4F@_GLTEXCOORD4FV@_GLTEXCOORD4I@_GLTEXCOORD4IV@_GLTEXCOORD4S@_GLTEXCOORD4SV@_GLTEXCOORDPOINTER@_GLTEXENVF@_GLTEXENVFV@_GLTEXENVI@_GLTEXENVIV@_GLTEXGEND@_GLTEXGENDV@_GLTEXGENF@_GLTEXGENFV@_GLTEXGENI@_GLTEXGENIV@_GLTEXIMAGE1D@_GLTEXIMAGE2D@_GLTEXPARAMETERF@_GLTEXPARAMETERFV@_GLTEXPARAMETERI@_GLTEXPARAMETERIV@_GLTEXSUBIMAGE1D@_GLTEXSUBIMAGE2D@_GLTRANSLATED@_GLTRANSLATEF@_GLVERTEX2D@_GLVERTEX2DV@_GLVERTEX2F@_GLVERTEX2FV@_GLVERTEX2I@_GLVERTEX2IV@_GLVERTEX2S@_GLVERTEX2SV@_GLVERTEX3D@_GLVERTEX3DV@_GLVERTEX3F@_GLVERTEX3FV@_GLVERTEX3I@_GLVERTEX3IV@_GLVERTEX3S@_GLVERTEX3SV@_GLVERTEX4D@_GLVERTEX4DV@_GLVERTEX4F@_GLVERTEX4FV@_GLVERTEX4I@_GLVERTEX4IV@_GLVERTEX4S@_GLVERTEX4SV@_GLVERTEXPOINTER@_GLVIEWPORT@SMOOTH@STRETCH@_ANTICLOCKWISE@_BEHIND@_CLEAR@_FILLBACKGROUND@_GLUPERSPECTIVE@_HARDWARE@_HARDWARE1@_KEEPBACKGROUND@_NONE@_OFF@_ONLY@_ONLYBACKGROUND@_ONTOP@_SEAMLESS@_SMOOTH@_SMOOTHSHRUNK@_SMOOTHSTRETCHED@"
listOfKeywords$ = listOfKeywords$ + "_SOFTWARE@_SQUAREPIXELS@_STRETCH@_ALLOWFULLSCREEN@_ALL@_ECHO@_INSTRREV@_TRIM$@_ACCEPTFILEDROP@_FINISHDROP@_TOTALDROPPEDFILES@_DROPPEDFILE@_DROPPEDFILE$@_SHR@_SHL@_ROR@_ROL@" ' a740g: added ROR & ROL
listOfKeywords$ = listOfKeywords$ + "_DEFLATE$@_INFLATE$@_READBIT@_RESETBIT@_SETBIT@_TOGGLEBIT@$ASSERTS@_ASSERT@_CAPSLOCK@_NUMLOCK@_SCROLLLOCK@_TOGGLE@_CONSOLEFONT@_CONSOLECURSOR@_CONSOLEINPUT@_CINP@$NOPREFIX@$COLOR@$DEBUG@_ENVIRONCOUNT@$UNSTABLE@$MIDISOUNDFONT@"
listOfKeywords$ = listOfKeywords$ + "_NOTIFYPOPUP@_MESSAGEBOX@_INPUTBOX$@_SELECTFOLDERDIALOG$@_COLORCHOOSERDIALOG@_OPENFILEDIALOG$@_SAVEFILEDIALOG$@" ' a740g: added common dialog keywords