-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rules_window.h
52 lines (39 loc) · 1.18 KB
/
Rules_window.h
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
#pragma once
#include"Graph.h"
#include"Simple_window.h"
#include <FL/Fl_Multiline_Output.H>
#include"Rules_window.h"
extern string text;
struct Multi_Out_box : Widget { //Multiline Out_box
Multi_Out_box(Point xy, int w, int h, const string& s) :Widget(xy, w, h, s, 0) {}
void put(const string&);
void attach(Graph_lib::Window& win);
};
void Multi_Out_box::put(const string& s) {
reference_to<Fl_Multiline_Output>(pw).value(s.c_str());
}
void Multi_Out_box::attach(Graph_lib::Window& win) {
pw = new Fl_Multiline_Output(loc.x, loc.y, width, height, label.c_str());
own = &win;
}
struct Rules_window :public Window {
bool button_pushed;
Button ok_button;
Multi_Out_box txt;
public:
Rules_window(Point xy, int w, int h, const string& title) :Window(w, h, title),
button_pushed(false), ok_button(Point(x_max() - 70, 30), 70, 20, "OK", cb_OK),
txt({ 0,0 }, 1000, 800, "") {
attach(txt);
attach(ok_button);
txt.put(text);
}
void wait_for_button() {
while (!button_pushed) Fl::wait();
button_pushed = false;
Fl::redraw();
}
private:
static void cb_OK(Address, Address addr) { reference_to<Rules_window>(addr).quit(); }
void quit() { hide(); button_pushed = true; }
};