54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
#ifndef XTC_MAIN_WINDOW_HPP
|
|
#define XTC_MAIN_WINDOW_HPP
|
|
|
|
#include <FL/Fl_Double_Window.H>
|
|
#include <memory>
|
|
#include "xtc/xtc_backend.h"
|
|
|
|
class GraphWidget;
|
|
class Fl_Box;
|
|
class Fl_Button;
|
|
class Fl_Tabs;
|
|
|
|
class MainWindow : public Fl_Double_Window {
|
|
public:
|
|
MainWindow();
|
|
~MainWindow() override;
|
|
MainWindow(const MainWindow &) = delete;
|
|
MainWindow &operator=(const MainWindow &) = delete;
|
|
using Fl_Double_Window::show;
|
|
int handle(int event) override;
|
|
|
|
private:
|
|
std::unique_ptr<xtc_graph, decltype(&xtc_graph_destroy)> graph_{nullptr, xtc_graph_destroy};
|
|
GraphWidget *graph_widget_ = nullptr;
|
|
Fl_Box *graph_state_ = nullptr;
|
|
xtc_backend *backend_ = nullptr;
|
|
bool ready_ = false;
|
|
bool running_ = false;
|
|
bool closing_ = false;
|
|
Fl_Button *play_ = nullptr;
|
|
Fl_Button *stop_ = nullptr;
|
|
Fl_Box *indicator_ = nullptr;
|
|
Fl_Box *status_ = nullptr;
|
|
Fl_Box *error_ = nullptr;
|
|
Fl_Tabs *tabs_ = nullptr;
|
|
|
|
static xtc_result edit_graph(void *context, const xtc_graph_edit &edit, size_t *out_added_id);
|
|
void open_backend();
|
|
void start_engine();
|
|
void stop_engine();
|
|
void reconnect_engine();
|
|
void refresh_status();
|
|
bool close_window();
|
|
void report_error(const char *operation, xtc_result result);
|
|
static void play_callback(Fl_Widget *, void *context);
|
|
static void stop_callback(Fl_Widget *, void *context);
|
|
static void reconnect_callback(Fl_Widget *, void *context);
|
|
static void close_callback(Fl_Widget *, void *context);
|
|
static void view_callback(Fl_Widget *widget, void *view);
|
|
static void about_callback(Fl_Widget *, void *);
|
|
static void timer_callback(void *context);
|
|
};
|
|
|
|
#endif
|