You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the API for PFD works well for the functionality it provides.
However, there is a possibility for growth in this space of portable dialogs,
which will (eventually) necessitate updating the interface to accept more data.
My own request, to allow setting the parent window for the dialogs, is an example
of possible evolution: #82
At the same time, the library needs to deal with, at least, 3 platforms; each of which has
their own particular needs: Windows, Linux, and macOS.
To support this evolution and the need to support multiple platforms, I propose that the interface
to the user facing functions/constructor (eg: save_file, open_file, select_folder, message) be updated to
receive a single struct. This struct contains all the info needed by the function/constructor.
Each function receives a struct specific to it. Common functionality can be placed in a base struct.
Struct args provide a straightforward way to pass lots of data, and to pass platform specific bits, as well.
Based on the current design, it should be possible to instantiate a default struct for the function
and call that function with that default object and get something showing on screen.
This is nice, from an ergonomic perspective, because it gets the user interacting with a dialog with minimal fuss.
pfd::open_file_info info;
auto r = pfd::open_file(info).result();
In the future, updating these struct params can be done without further changing the public function signatures.
New fields can just be added to the structs.
Instead of calling the construtors directly, call functions that return the constructed objects. That provides more flexibility for evolving the api.
// open_file_diag open_file(open_file_info&&); // maybe
open_file_diag open_file(const open_file_info& info) {
// Possibly inspect the 'info' object and assert() on debug.constexprauto ctx = get_ctx_object(); // Who knows, maybe this is a compile-time object, configured by the user-dev.
open_file_diag diag(ctx, info); // Example of additional 'ctx' object that dialog objects could accept. Just an example.return diag; // No copy performed: C++ now guarantees NRVO.
}
Hello,
Currently, the API for PFD works well for the functionality it provides.
However, there is a possibility for growth in this space of portable dialogs,
which will (eventually) necessitate updating the interface to accept more data.
My own request, to allow setting the parent window for the dialogs, is an example
of possible evolution: #82
At the same time, the library needs to deal with, at least, 3 platforms; each of which has
their own particular needs: Windows, Linux, and macOS.
To support this evolution and the need to support multiple platforms, I propose that the interface
to the user facing functions/constructor (eg: save_file, open_file, select_folder, message) be updated to
receive a single struct. This struct contains all the info needed by the function/constructor.
and call that function with that default object and get something showing on screen.
This is nice, from an ergonomic perspective, because it gets the user interacting with a dialog with minimal fuss.
New fields can just be added to the structs.
Example 'info/param' API:
The text was updated successfully, but these errors were encountered: