Subversion Repositories programming

Rev

Rev 347 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
348 ira 1
/*******************************************************************************
2
 * elevator_window.h
3
 *
4
 * Header file for the Elevator_Window class.
5
 *
6
 * Copyright 2006, Ira W. Snyder (devel@irasnyder.com)
7
 ******************************************************************************/
340 ira 8
 
9
#ifndef ELEVATOR_WINDOW_H
10
#define ELEVATOR_WINDOW_H
11
 
12
#include <gtkmm/button.h>
13
#include <gtkmm/window.h>
14
#include <gtkmm/togglebutton.h>
15
#include <gtkmm/table.h>
16
#include <gtkmm/label.h>
17
#include <gtkmm/image.h>
18
#include <gtkmm/stock.h>
19
#include <gtkmm/dialog.h>
20
#include <gtkmm/entry.h>
21
 
344 ira 22
#include <boost/algorithm/string.hpp>
23
 
340 ira 24
#include <vector>
25
#include <string>
26
#include <iostream>
27
#include <sstream>
28
#include <assert.h>
29
 
30
#include "elevator.h"
31
#include "controller.h"
344 ira 32
#include "dispatch_data.h"
340 ira 33
 
34
class Controller;
35
 
36
typedef struct
37
{
38
    Glib::ustring str;
39
    int button_num;
40
    int direction;
41
    Gtk::ToggleButton *theButton;
42
}
43
Button_Data;
44
 
45
class Elevator_Window : public Gtk::Window
46
{
47
    public:
347 ira 48
        Elevator_Window (int numFloors, int numElevators);
340 ira 49
        virtual ~Elevator_Window ();
50
 
51
        void set_controller (Controller *controller);
344 ira 52
        void get_floors_from_user (int elevator_num);
340 ira 53
 
54
        // Helper Functions
55
        void open_elevator_at (int row, int col);
56
        void close_elevator_at (int row, int col);
57
        void unset_up_button (int button_num);
58
        void unset_down_button (int button_num);
59
        void set_label (int label_num, std::string new_text);
60
 
61
    protected:
62
        // Signal Handlers
63
        virtual void on_toggle_button_pressed (Button_Data data);
64
 
65
        // Member Widgets
66
        Gtk::Table m_table;
67
        std::vector<Gtk::ToggleButton*> upbuttons;
68
        std::vector<Gtk::ToggleButton*> downbuttons;
69
        std::vector<Gtk::Image*> images;
70
        std::vector<Gtk::Label*> labels;
71
 
72
        // Member Controller
73
        Controller *controller;
346 ira 74
 
75
        // Member Variables
76
        int numFloors;
77
        int numElevators;
340 ira 78
};
79
 
80
#endif // ELEVATOR_WINDOW_H
81