File: program.h

package info (click to toggle)
mysql-workbench 6.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 113,932 kB
  • ctags: 87,814
  • sloc: ansic: 955,521; cpp: 427,465; python: 59,728; yacc: 59,129; xml: 54,204; sql: 7,091; objc: 965; makefile: 638; sh: 613; java: 237; perl: 30; ruby: 6; php: 1
file content (73 lines) | stat: -rw-r--r-- 2,236 bytes parent folder | download
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//!
//! \addtogroup linuxui Linux UI
//! @{
//! 

#ifndef __PROGRAM_H__
#define __PROGRAM_H__

#include <string>
#include <sigc++/sigc++.h>

#include "workbench/wb_context.h"

namespace bec
{
class GRTManager;
}

namespace Gtk
{
  class Window;
}

//==============================================================================


class MainForm;

//==============================================================================
//
//==============================================================================
//! Class Program mostly gathers together top level UI classes and top level 
//! backend classes like wb::WBContextUI under one hood, plus it
//! defines some callbacks-methods to pass to backend's wb::WBContext.
//! Also it has a timer-triggered idle tasks runner, see Program::idle_stuff() 
class Program
{
  public:
    Program(wb::WBOptions &options);
    ~Program();
  
    void shutdown();

    static Program* get_instance() { return _instance; }    
    Gtk::Window* get_mainwindow() const;

  private: // Callbacks for backend
    int confirm_action_becb(const std::string& title, const std::string& msg, const std::string& default_btn, const std::string& alt_btn, const std::string& other_btn);
    std::string show_file_dialog_becb(const std::string& type, const std::string& title, const std::string& extensions);

    void finalize_initialization(wb::WBOptions *options);

    bool idle_stuff();
  private:
    std::deque<sigc::connection> _idleConnections;
    wb::WBContextUI     *_wb_context_ui; //!< 
    wb::WBContext       *_wb_context;
    bec::GRTManager     *_grt_manager;
    MainForm            *_main_form;

    //sigc::signal<void>::iterator idle_signal_conn;
    sigc::connection     _sig_finalize_initialization;
    sigc::connection     _idle_signal_conn;
    Program(const Program&) {} // Forbid copy
    Program& operator=(const Program&) {return *this;} // Forbid copy
    static Program* _instance;
};

#endif

//!                                                                                                                                     
//! @}                                                                                                                                  
//!