src/file-system.cpp \
src/gui-element.cpp \
src/gui-environment.cpp \
+ src/gui-file-open-dialog.cpp \
src/gui-in-out-fader.cpp \
src/gui-listbox.cpp \
src/gui-scrollbar.cpp \
<gui-editbox>
<gui-element>
<gui-environment>
+ <gui-file-open-dialog>
<gui-font>
<gui-image>
<gui-listbox>
add-custom-scene-node!
add-editbox!
add-file-archive!
+ add-file-open-dialog!
add-image!
add-internal-point!
add-item!
get-event-key
get-event-key-pressed
get-event-type
+ get-file-name
get-file-system
get-font
get-fps
(editbox (addEditBox gui-environment text rectangle border parent id)))
(mem-wrapped editbox))))
+(define-method (add-file-open-dialog! (gui-environment <gui-environment>) . rest)
+ (let-keywords rest #f
+ ((title "")
+ (modal #t)
+ (parent (make <gui-element>))
+ (id -1)
+ (restore-cwd #f)
+ (start-dir ""))
+ (let* ((addFileOpenDialog (get-irrlicht-proc "addFileOpenDialog" gui-environment parent))
+ (dialog (addFileOpenDialog gui-environment title modal parent id restore-cwd start-dir)))
+ (mem-wrapped dialog))))
+
(define-method (add-image! (gui-environment <gui-environment>) image pos . rest)
(let-keywords rest #f
((use-alpha-channel #t)
(let ((getSkin (get-irrlicht-proc "getSkin" gui-environment)))
(getSkin gui-environment)))
-(export <gui-environment> add-button! add-editbox! add-image! add-listbox! add-scrollbar!
- add-static-text! add-window! draw-all get-built-in-font get-font get-skin)
+(export <gui-environment> add-button! add-editbox! add-file-open-dialog! add-image! add-listbox!
+ add-scrollbar! add-static-text! add-window! draw-all get-built-in-font get-font get-skin)
;; IGUIStaticText
(irr-class #:init-value "IGUIWindow"))
(export <gui-window>)
+
+
+;; IGUIFileOpenDialog
+(define-class <gui-file-open-dialog> (<gui-element>)
+ (irr-class #:init-value "IGUIFileOpenDialog"))
+
+(define-method (get-file-name (dialog <gui-file-open-dialog>))
+ (let ((getFileName (get-irrlicht-proc "getFileName" dialog)))
+ (getFileName dialog)))
+
+(export <gui-file-open-dialog> get-file-name)
DEFINE_GSUBR ("IGUIButton_getID", 1, 0, 0, IGUIElement_getID<gui::IGUIButton*>);
DEFINE_GSUBR ("IGUIEditBox_getID", 1, 0, 0, IGUIElement_getID<gui::IGUIEditBox*>);
DEFINE_GSUBR ("IGUIElement_getID", 1, 0, 0, IGUIElement_getID<gui::IGUIElement*>);
+ DEFINE_GSUBR ("IGUIFileOpenDialog_getID", 1, 0, 0, IGUIElement_getID<gui::IGUIFileOpenDialog*>);
DEFINE_GSUBR ("IGUIImage_getID", 1, 0, 0, IGUIElement_getID<gui::IGUIImage*>);
DEFINE_GSUBR ("IGUIListBox_getID", 1, 0, 0, IGUIElement_getID<gui::IGUIListBox*>);
DEFINE_GSUBR ("IGUIScrollBar_getID", 1, 0, 0, IGUIElement_getID<gui::IGUIScrollBar*>);
return scm_from_irr_pointer ("<gui-editbox>", (void*) editbox);
}
+template <typename TParent>
+SCM
+IGUIEnvironment_addFileOpenDialog (SCM gui_environment,
+ SCM title,
+ SCM modal,
+ SCM parent,
+ SCM id,
+ SCM restore_cwd,
+ SCM start_dir)
+{
+ gui::IGUIEnvironment* guienv = (gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment);
+ wchar_t* wtitle = (wchar_t*) scm_to_utf32_string (title);
+ io::path::char_type* cstartDir = scm_to_utf8_string (start_dir);
+
+ gui::IGUIFileOpenDialog* dialog =
+ guienv->addFileOpenDialog (wtitle,
+ scm_to_bool (modal),
+ (TParent)scm_to_irr_pointer (parent),
+ scm_to_int32 (id),
+ scm_to_bool (restore_cwd),
+ cstartDir);
+
+ free (wtitle);
+ free (cstartDir);
+ return scm_from_irr_pointer ("<gui-file-open-dialog>", (void*) dialog);
+}
+
template <typename TParent>
SCM
IGUIEnvironment_addImage (SCM gui_environment,
IGUIEnvironment_addButton<gui::IGUIElement*>);
DEFINE_GSUBR ("IGUIEnvironment_addEditBox_IGUIElement", 6, 0, 0,
IGUIEnvironment_addEditBox<gui::IGUIElement*>);
+ DEFINE_GSUBR ("IGUIEnvironment_addFileOpenDialog_IGUIElement", 7, 0, 0,
+ IGUIEnvironment_addFileOpenDialog<gui::IGUIElement*>);
DEFINE_GSUBR ("IGUIEnvironment_addImage_IGUIElement", 7, 0, 0,
IGUIEnvironment_addImage<gui::IGUIElement*>);
DEFINE_GSUBR ("IGUIEnvironment_addListBox_IGUIElement", 5, 0, 0,
--- /dev/null
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+ Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of guile-irrlicht.
+
+ guile-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ guile-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "gui-file-open-dialog.h"
+#include "gsubr.h"
+#include "wrapped.h"
+
+using namespace irr;
+
+SCM
+IGUIFileOpenDialog_getFileName (SCM gui_file_open_dialog)
+{
+ gui::IGUIFileOpenDialog* dialog =
+ (gui::IGUIFileOpenDialog*)scm_to_irr_pointer (gui_file_open_dialog);
+ return scm_from_utf32_string ((scm_t_wchar*) dialog->getFileName ());
+}
+
+void
+init_gui_file_open_dialog (void)
+{
+ DEFINE_GSUBR ("IGUIFileOpenDialog_getFileName", 1, 0, 0, IGUIFileOpenDialog_getFileName);
+}
--- /dev/null
+/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
+
+ Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
+
+ This file is part of guile-irrlicht.
+
+ guile-irrlicht is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 3 of the
+ License, or (at your option) any later version.
+
+ guile-irrlicht is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with guile-irrlicht. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __GUILE_IRRLICHT_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
+#define __GUILE_IRRLICHT_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
+
+void
+init_gui_file_open_dialog (void);
+
+#endif
#include "file-system.h"
#include "gui-element.h"
#include "gui-environment.h"
+#include "gui-file-open-dialog.h"
#include "gui-in-out-fader.h"
#include "gui-listbox.h"
#include "gui-scrollbar.h"
init_file_system ();
init_gui_element ();
init_gui_environment ();
+ init_gui_file_open_dialog ();
init_gui_in_out_fader ();
init_gui_listbox ();
init_gui_scrollbar ();