diff --git a/montaukos.org/docs/dtinternals/assets/discard_dialog.png b/montaukos.org/docs/dtinternals/assets/discard_dialog.png new file mode 100644 index 0000000..6fea8f6 Binary files /dev/null and b/montaukos.org/docs/dtinternals/assets/discard_dialog.png differ diff --git a/montaukos.org/docs/dtinternals/assets/save_dialog.png b/montaukos.org/docs/dtinternals/assets/save_dialog.png new file mode 100644 index 0000000..3392125 Binary files /dev/null and b/montaukos.org/docs/dtinternals/assets/save_dialog.png differ diff --git a/montaukos.org/docs/dtinternals/dialogslib.html b/montaukos.org/docs/dtinternals/dialogslib.html new file mode 100644 index 0000000..5dfdcac --- /dev/null +++ b/montaukos.org/docs/dtinternals/dialogslib.html @@ -0,0 +1,269 @@ + + + + + + + Dialogs Library - MontaukOS + + + + + + + + + +
+
+

Dialogs

+
+ +
+ +

Overview

+

+The dialogs library provides the following system dialogs across apps: +

+ + + +

Message Box

+

+message_box displays a popup window with text and buttons. +

+ +
gui::dialogs::MessageBoxResult message_box(
+    const char* title,
+    const char* message,
+    gui::dialogs::MessageBoxButtons buttons = gui::dialogs::MESSAGE_BOX_OK,
+    char* out_message = nullptr,
+    int out_message_len = 0);
+ +

Button Sets

+ + + + + + +
ValueButtons
MESSAGE_BOX_OKOK
MESSAGE_BOX_OK_CANCELOK, Cancel
MESSAGE_BOX_YES_NOYes, No
MESSAGE_BOX_YES_NO_CANCELYes, No, Cancel
+ +

Results

+ + + + + + + +
ValueMeaning
MESSAGE_BOX_RESULT_OKThe user selected OK.
MESSAGE_BOX_RESULT_CANCELThe user selected Cancel or closed a cancelable dialog.
MESSAGE_BOX_RESULT_YESThe user selected Yes.
MESSAGE_BOX_RESULT_NOThe user selected No, or closed a Yes/No dialog.
MESSAGE_BOX_RESULT_NONEThe dialog could not be loaded or invoked.
+ +

Example

+
#include <gui/dialogs.hpp>
+
+void show_confirm() {
+    auto result = gui::dialogs::message_box(
+        "Close Document",
+        "Discard unsaved changes?",
+        gui::dialogs::MESSAGE_BOX_YES_NO_CANCEL);
+
+    if (result == gui::dialogs::MESSAGE_BOX_RESULT_YES) {
+        /* discard and close */
+    }
+}
+ +
+Message box asking whether to discard unsaved changes +

Example MESSAGE_BOX_YES_NO_CANCEL dialog.

+
+ +

File Dialogs

+

+File dialog helpers allow applications to use graphical file selection views (similar to the Files app) to select paths for Open/Save operations. +

+ +
bool open_file(
+    const char* title,
+    const char* initial_path,
+    char* out_path,
+    int out_path_len,
+    char* out_message = nullptr,
+    int out_message_len = 0);
+
+bool save_file(
+    const char* title,
+    const char* initial_path,
+    const char* suggested_name,
+    char* out_path,
+    int out_path_len,
+    char* out_message = nullptr,
+    int out_message_len = 0);
+ +

+Use initial_path to select the starting directory or current file +context. save_file also accepts a suggested_name for +the filename field. +

+ +

Open Example

+
char path[256];
+char message[160];
+
+if (gui::dialogs::open_file("Open File", "", path, sizeof(path),
+                            message, sizeof(message))) {
+    /* open path */
+}
+ +

Save Example

+
char path[256];
+
+if (gui::dialogs::save_file("Save File", "", "untitled.txt",
+                            path, sizeof(path))) {
+    /* write path */
+}
+ +
+Save file dialog showing folders and a filename field +

Save-file dialog as used by the MontaukOS Word Processor app.

+
+ +

Print Dialogs

+

+Print dialog helpers allow applications to expose printer configuration to the user, and submit a file for printing. +

+ +
bool configure_print(
+    const char* title,
+    const char* initial_printer_uri,
+    const char* job_name,
+    char* out_printer_uri,
+    int out_printer_uri_len,
+    char* out_printer_name,
+    int out_printer_name_len,
+    uint32_t* out_copies = nullptr,
+    char* out_message = nullptr,
+    int out_message_len = 0);
+
+bool print_file(
+    const char* title,
+    const char* source_path,
+    const char* job_name,
+    char* out_job_id,
+    int out_job_id_len,
+    char* out_message = nullptr,
+    int out_message_len = 0);
+ + +

Include

+
#include <gui/dialogs.hpp>

+ +
+

Copyright (c) 2026 Montauk Operating System. All rights reserved.

Page last revised 22 April 2026.

+ +
+ +
+Back to Documentation Index +
+ +
+ +