Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <stdexcept>
- #include <string>
- #include <FL/Fl.H>
- #include <FL/Fl_Window.H>
- #include <FL/Fl_Button.H>
- #include <Graph_lib/Graph.h>
- #include <Graph_lib/Simple_window.h>
- using namespace Graph_lib;
- const int cell_size = 100;
- struct cell {
- int x;
- int y;
- std::string state;
- cell () { this->x = 0; this->y = 0; this->state = "free"; }
- cell (int X, int Y) {this->x = X; this->y = Y; this->state = "free";}
- };
- // Функция для обработки нажатия кнопки
- void button_callback(Fl_Widget *widget, void *data) {
- std::string *label = (std::string*)data;
- std::cout << "Pushed: " << *label << std::endl;
- }
- int main ()
- try
- {
- Fl_Window *window = new Fl_Window(400, 300, "Window");
- std::string button_name = "Button1";
- Fl_Button *button = new Fl_Button(100, 100, 100, 30, "Button1");
- button->callback(button_callback, (void*)&button_name);
- window->end();
- window->show();
- return Fl::run();
- }
- catch (std::exception& e)
- {
- std::cerr << e.what() << std::endl;
- return 1;
- }
- catch (...)
- {
- std::cerr << "Oops, something went wrong..." << std::endl;
- return 2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement