The Battle for Wesnoth  1.19.5+dev
screenshot_notification.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 2024
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 
25 {
26 public:
27  /**
28  * Constructor.
29  *
30  * @param path Path to the screenshot file to create.
31  * @param screenshot Screenshot to save.
32  */
33  screenshot_notification(const std::string& path, surface screenshot);
34 
35  /**
36  * The display function.
37  *
38  * See @ref modal_dialog for more information.
39  */
41 
42 private:
43  std::string path_;
44  const std::string screenshots_dir_path_;
46 
47  void save_screenshot();
48  void keypress_callback(bool& handled, const SDL_Keycode key);
49 
50  virtual const std::string& window_id() const override;
51 
52  virtual void pre_show() override;
53 };
54 } // namespace dialogs
Abstract base class for all modal dialogs.
void keypress_callback(bool &handled, const SDL_Keycode key)
virtual const std::string & window_id() const override
The ID of the window to build.
screenshot_notification(const std::string &path, surface screenshot)
Constructor.
virtual void pre_show() override
Actions to be taken before showing the window.
std::string path_
The display function.
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
std::string path
Definition: filesystem.cpp:90