Documentation ¶
Overview ¶
Package dialog provides support for Allegro's native dialog addon.
Index ¶
- Constants
- func Install() error
- func Installed() bool
- func ShowNativeFileDialog(display *allegro.Display, dialog *FileChooser) error
- func ShowNativeMessageBoxWithButtons(display *allegro.Display, title, heading, text string, buttons []string, ...) string
- func Shutdown()
- func Version() (major, minor, revision, release uint8)
- type FileChooser
- type FileChooserFlags
- type MessageBoxFlags
- type MessageBoxResult
- type TextLog
- type TextLogFlags
Constants ¶
const ( FILECHOOSER_FILE_MUST_EXIST FileChooserFlags = C.ALLEGRO_FILECHOOSER_FILE_MUST_EXIST FILECHOOSER_SAVE = C.ALLEGRO_FILECHOOSER_SAVE FILECHOOSER_FOLDER = C.ALLEGRO_FILECHOOSER_FOLDER FILECHOOSER_PICTURES = C.ALLEGRO_FILECHOOSER_PICTURES FILECHOOSER_SHOW_HIDDEN = C.ALLEGRO_FILECHOOSER_SHOW_HIDDEN FILECHOOSER_MULTIPLE = C.ALLEGRO_FILECHOOSER_MULTIPLE )
const ( MESSAGEBOX_WARN MessageBoxFlags = C.ALLEGRO_MESSAGEBOX_WARN MESSAGEBOX_ERROR = C.ALLEGRO_MESSAGEBOX_ERROR MESSAGEBOX_QUESTION = C.ALLEGRO_MESSAGEBOX_QUESTION MESSAGEBOX_OK_CANCEL = C.ALLEGRO_MESSAGEBOX_OK_CANCEL MESSAGEBOX_YES_NO = C.ALLEGRO_MESSAGEBOX_YES_NO )
const ( RESPONSE_NONE MessageBoxResult = 0 RESPONSE_YES_OK = 1 RESPONSE_NO_CANCEL = 2 )
Variables ¶
This section is empty.
Functions ¶
func Install ¶
func Install() error
Initialise the native dialog addon.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_init_native_dialog_addon
func Installed ¶
func Installed() bool
Returns true if the native dialog addon is initialized, otherwise returns false.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_is_native_dialog_addon_initialized
func ShowNativeFileDialog ¶
func ShowNativeFileDialog(display *allegro.Display, dialog *FileChooser) error
Show the dialog window. The display may be NULL, otherwise the given display is treated as the parent if possible.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_show_native_file_dialog
func Shutdown ¶
func Shutdown()
Shut down the native dialog addon.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_shutdown_native_dialog_addon
func Version ¶
func Version() (major, minor, revision, release uint8)
Returns the (compiled) version of the addon, in the same format as al_get_allegro_version.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_get_allegro_native_dialog_version
Types ¶
type FileChooser ¶
type FileChooser C.ALLEGRO_FILECHOOSER
func CreateNativeFileDialog ¶
func CreateNativeFileDialog(initial_path, title, patterns string, flags FileChooserFlags) (*FileChooser, error)
Creates a new native file dialog. You should only have one such dialog opened at a time.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_create_native_file_dialog
func (*FileChooser) Count ¶
func (dialog *FileChooser) Count() int
Returns the number of files selected, or 0 if the dialog was cancelled.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_get_native_file_dialog_count
func (*FileChooser) Destroy ¶
func (dialog *FileChooser) Destroy()
Frees up all resources used by the file dialog.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_destroy_native_file_dialog
func (*FileChooser) Path ¶
func (dialog *FileChooser) Path(i int) (string, error)
Returns one of the selected paths with index i. The index should range from 0 to the return value of al_get_native_file_dialog_count -1.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_get_native_file_dialog_path
type FileChooserFlags ¶
type FileChooserFlags int
type MessageBoxFlags ¶
type MessageBoxFlags int
type MessageBoxResult ¶
type MessageBoxResult int
func ShowNativeMessageBox ¶
func ShowNativeMessageBox(display *allegro.Display, title, heading, text string, flags MessageBoxFlags) MessageBoxResult
Show a native GUI message box. This can be used for example to display an error message if creation of an initial display fails. The display may be NULL, otherwise the given display is treated as the parent if possible.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_show_native_message_box
type TextLog ¶
type TextLog C.ALLEGRO_TEXTLOG
func OpenNativeTextLog ¶
func OpenNativeTextLog(title string, flags TextLogFlags) (*TextLog, error)
Opens a window to which you can append log messages with al_append_native_text_log. This can be useful for debugging if you don't want to depend on a console being available.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_open_native_text_log
func (*TextLog) Append ¶
Appends a line of text to the message log window and scrolls to the bottom (if the line would not be visible otherwise). This works like printf. A line is continued until you add a newline character.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_append_native_text_log
func (*TextLog) Close ¶
func (log *TextLog) Close()
Closes a message log window opened with al_open_native_text_log earlier.
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_close_native_text_log
func (*TextLog) EventSource ¶
func (log *TextLog) EventSource() *allegro.EventSource
Get an event source for a text log window. The possible events are:
See https://liballeg.org/a5docs/5.2.6/native_dialog.html#al_get_native_text_log_event_source
type TextLogFlags ¶
type TextLogFlags int
const ( TEXTLOG_NO_CLOSE TextLogFlags = C.ALLEGRO_TEXTLOG_NO_CLOSE TEXTLOG_MONOSPACE = C.ALLEGRO_TEXTLOG_MONOSPACE )