File: main.h

package info (click to toggle)
galois 0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 948 kB
  • sloc: cpp: 4,075; xml: 2,325; makefile: 146
file content (80 lines) | stat: -rw-r--r-- 2,219 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* main.h -- main window for falling blocks game.  -*- C++ -*-
   Copyright (C) 2011-2017 Gerardo Ballabio

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program 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 General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. */

#ifndef __MAIN_
#define __MAIN_

#include <gtkmm.h>
#include "area.h"
#include "board.h"
#include "group.h"
#include "preferences.h"
#include "scores.h"

class MainWindow : public Gtk::ApplicationWindow
{
private:
  // child widgets
  Gtk::Grid grid_all;
  ; BoardArea board_area;
  ; NextArea next_area;
  ; Gtk::Label level_label;
  ; Gtk::Label lines_label;
  ; Gtk::Label score_label;

  // standalone dialogs
  PrefsDialog preferences;
  ScoresDialog scores;

  // menu actions
  Glib::RefPtr<Gio::SimpleAction> action_new, action_stop,
    action_prefs, action_scores;

  // timeout
  sigc::connection timeout;
  int delay; // milliseconds
  int animation;
  bool drop, pause;

  // game logic
  game_board board;
  bool next, land;

protected:
  virtual bool on_key_press_event(GdkEventKey *);
  virtual void on_menu_new();
  virtual void on_menu_stop();
  virtual void on_menu_prefs();
  virtual void on_menu_scores();
  virtual void on_menu_quit() { hide(); }
  virtual void on_menu_help();
  virtual void on_menu_about();
  virtual void on_response_prefs(int response_id);
  virtual void on_response_scores(int response_id);
  virtual bool on_timeout_down();
  virtual bool on_timeout_drop();
  virtual bool on_timeout_lines();
  virtual void on_game_drop();
  virtual void on_game_next();
  virtual void on_game_over();
public:
  MainWindow();
  ~MainWindow() { }

  virtual void on_startup(Glib::RefPtr<Gtk::Application> &app);
};

#endif /* __MAIN_ */