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
|
#include <GUI.h>
using namespace Graph_lib;
//------------------------------------------------
class rotation : public Window {
public:
rotation(Point xy, int w, int h, const string& title):
Window(xy,w,h,title),
b(Point(200,200), 100, 60, "Button", cb_b) {
attach(b);
attach(i);
}
static void cb_b(Address, Address pw) { reference_to<rotation>(pw).rotate(); }
void rotate() { b.move(100,100); i.move(100,100);}
private:
Button b;
Image i = Image(Point(200,200), "image.jpg");
};
//-------------------------------------------
int main(){
Image i = Image(Point(200,200), "image.jpg");
rotation win(Point(100,100), 600, 400, "Rotation");
return gui_main();
}
|