The Battle for Wesnoth  1.15.2+dev
folder_create.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2018 by Iris Morelle <shadowm2006@gmail.com>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
18 
19 namespace gui2
20 {
21 namespace dialogs
22 {
23 
25 {
26 public:
27  /**
28  * Constructor.
29  *
30  * @param [in, out] folder_name
31  * The parameter's usage is:
32  * - Input: A suggested folder name.
33  * - Output: The folder name the user actually
34  * entered if the dialog returns @ref
35  * retval::OK; undefined otherwise.
36  */
37  folder_create(std::string& folder_name);
38 
39  /** The execute function; see @ref modal_dialog for more information. */
41 
42 private:
43  friend class bookmark_create;
44 
46 
47  /** Changes the dialog caption so it can be used for naming bookmarks. */
49  {
50  bookmark_mode_ = true;
51  return *this;
52  }
53 
54  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
55  virtual const std::string& window_id() const override;
56 
57  /** Inherited from modal_dialog. */
58  virtual void pre_show(window& window) override;
59 };
60 
62 {
63 public:
64  /** The execute function; see @ref modal_dialog for more information. */
65  static bool execute(std::string& bookmark_name)
66  {
67  return folder_create(bookmark_name).enable_bookmark_mode().show();
68  }
69 };
70 
71 } // namespace dialogs
72 } // namespace gui2
static bool execute(std::string &bookmark_name)
The execute function; see modal_dialog for more information.
Generic file dialog.
Definition: field-fwd.hpp:22
folder_create & enable_bookmark_mode()
Changes the dialog caption so it can be used for naming bookmarks.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
Various uncategorised dialogs.
folder_create(std::string &folder_name)
Constructor.
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
Abstract base class for all modal dialogs.
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62