-
Notifications
You must be signed in to change notification settings - Fork 7
/
Simple_window.cpp
33 lines (25 loc) · 953 Bytes
/
Simple_window.cpp
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
//
// This is a GUI support code to the chapters 12-16 of the book
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//
#include "PPP/Simple_window.h"
#include <QEventLoop>
#include <QTimer>
#include <PPP/GUI_private.h>
//------------------------------------------------------------------------------
Simple_window::Simple_window(Point xy, int w, int h, const string& title) :
Window(xy,w,h,title),
next_button(Point{w-70,0}, 70, 20, "Next", []{})
{
attach(next_button);
}
Simple_window::~Simple_window() {}
//------------------------------------------------------------------------------
void Simple_window::wait_for_button()
// modified event loop:
// handle all events (as per default), quit when button_pushed becomes true
// this allows graphics without control inversion
{
get_impl().wait_for_button(&next_button);
}
//------------------------------------------------------------------------------