The main window of GTKSlide.
More...
#include <MainWindow.h>
Inherits Window.
The main window of GTKSlide.
- Author
- John Jekel
- Date
- 2018-2018
◆ MainWindow()
GTKSlide::MainWindow::MainWindow |
( |
Glib::RefPtr< Gtk::Application > & |
application, |
|
|
std::shared_ptr< Grid15::Grid > & |
newGridPtr |
|
) |
| |
Creates and populates the GTKSlide main window.
- Parameters
-
application | The Gtk::Application being used to run the window |
newGridPtr | The Grid15::Grid to use |
- Exceptions
-
Gtk::BuilderError | If something goes wrong during parse |
Glib::Markup | error If something goes wrong during parse |
Glib::FileError | If a file error occurs |
std::runtime_error | If a menuBar cannot be created from the glade XML |
◆ createErrorDialogAndRun()
int GTKSlide::MainWindow::createErrorDialogAndRun |
( |
std::string |
errorMessage, |
|
|
std::string |
details = "" |
|
) |
| |
|
protected |
A helper function which creates and runs a Gtk::MessageDialog informing the user of an error that has occured.
- Parameters
-
errorMessage | The error message to display |
details | Extra details to put (Gtk::MessageDialog::set_secondary_text) |
- Returns
- The responce from the user (result of Gtk::MessageDialog::run)
- Bug:
- Parameters are not string refrences or string views (const std::string & OR std::string_view)
◆ createMenuBarAndAddToMainGrid()
void GTKSlide::MainWindow::createMenuBarAndAddToMainGrid |
( |
| ) |
|
|
protected |
Creates a menu bar for the window and adds it to GtkSlide::MainWindow::mainGrid (it is manage()ed)
Partly based on some Gtkmm examples: https://developer.gnome.org/gtkmm-tutorial/stable/sec-menus-examples.html.en
- Exceptions
-
Gtk::BuilderError | If something goes wrong during parse |
Glib::MarkupError | If something goes wrong during parse |
Glib::FileError | If a file error occurs |
std::runtime_error | If a something cannot be created from the glade XML |
◆ createNotSavedDialogAndRun()
int GTKSlide::MainWindow::createNotSavedDialogAndRun |
( |
| ) |
|
|
protected |
A helper function which creates and runs a Gtk::MessageDialog asking the user what to do with the current unsaved grid.
- Returns
- The responce from the user (result of Gtk::MessageDialog::run)
◆ exit()
bool GTKSlide::MainWindow::exit |
( |
GdkEventAny * |
event | ) |
|
|
protected |
Exits 15Slide after checking if the grid is saved and handeling it.
- Parameters
-
event | Unused; allows connecting to Gtk::Window::signal_delete_event() which requires it |
- Returns
- Unused; allows connecting to Gtk::Window::signal_delete_event() which requires it
◆ onMenuBarAbout()
void GTKSlide::MainWindow::onMenuBarAbout |
( |
| ) |
|
|
protected |
◆ onMenuBarLoad()
void GTKSlide::MainWindow::onMenuBarLoad |
( |
| ) |
|
|
protected |
◆ onMenuBarNewGame()
void GTKSlide::MainWindow::onMenuBarNewGame |
( |
| ) |
|
|
protected |
Resets the grid and handles the old one if it is not saved.
◆ save()
bool GTKSlide::MainWindow::save |
( |
| ) |
|
|
protected |
Saves the grid.
- Returns
- True if the save works, or if it does not, the user choses a valid file and not cancel
◆ saveAs()
bool GTKSlide::MainWindow::saveAs |
( |
| ) |
|
|
protected |
Saves the grid to a new file and updates MainWindow::saveManager.
- Returns
- True if the user choses a valid file and did not choose cancel
◆ applicationPtr
Glib::RefPtr<Gtk::Application> GTKSlide::MainWindow::applicationPtr {} |
|
protected |
The Gtk::Application assisiated with this class, because Gtk::Window::get_application() is unreliable.
◆ gridPtr
std::shared_ptr<Grid15::Grid> GTKSlide::MainWindow::gridPtr {} |
|
protected |
◆ mainGrid
Gtk::Grid GTKSlide::MainWindow::mainGrid |
|
protected |
◆ saveManager
std::shared_ptr<SaveManager> GTKSlide::MainWindow::saveManager {} |
|
protected |
◆ tileGrid
A graphical and interactive representation of a Grid15::Grid.
The documentation for this class was generated from the following files: