The Battle for Wesnoth  1.17.0-dev
screenshot_notification.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 2021
3  by Iris Morelle <shadowm2006@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 #include "sdl/surface.hpp"
20 
21 namespace gui2::dialogs
22 {
23 
24 /**
25  * @ingroup GUIWindowDefinitionWML
26  *
27  * Notification dialog used after saving a game or map screenshot to display information about it for the user.
28  * Key |Type |Mandatory|Description
29  * ------------------|--------------|---------|-----------
30  * path | text_box |yes |Read-only textbox containing the screenshot path.
31  * filesize | @ref label |no |Optional label to display the file size.
32  * copy | @ref button |yes |Button to copy the path to clipboard.
33  * open | @ref button |yes |Button to open the screnshot using the default application.
34  * browse_dir | @ref button |yes |Button to browse the screenshots directory in the file manager.
35  */
37 {
38 public:
39  /**
40  * Constructor.
41  *
42  * @param path Path to the screenshot file to create.
43  * @param screenshot Screenshot to save.
44  */
45  screenshot_notification(const std::string& path, surface screenshot);
46 
47  /**
48  * The display function.
49  *
50  * See @ref modal_dialog for more information.
51  */
53 
54 private:
55  std::string path_;
56  const std::string screenshots_dir_path_;
58 
59  void save_screenshot();
60  void keypress_callback(bool& handled, const SDL_Keycode key);
61 
62  virtual const std::string& window_id() const override;
63 
64  virtual void pre_show(window& window) override;
65 };
66 } // namespace dialogs
screenshot_notification(const std::string &path, surface screenshot)
Constructor.
Notification dialog used after saving a game or map screenshot to display information about it for th...
virtual const std::string & window_id() const override
The id of the window to build.
std::string path
Definition: game_config.cpp:39
std::string path_
The display function.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
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:65
void keypress_callback(bool &handled, const SDL_Keycode key)