1 |
/* |
2 |
Copyright (c) 2014 - 2017 Christian Schoenebeck |
3 |
|
4 |
This file is part of "gigedit" and released under the terms of the |
5 |
GNU General Public License version 2. |
6 |
*/ |
7 |
|
8 |
#ifndef GIGEDIT_SCRIPTSLOTS_H |
9 |
#define GIGEDIT_SCRIPTSLOTS_H |
10 |
|
11 |
#ifdef LIBGIG_HEADER_FILE |
12 |
# include LIBGIG_HEADER_FILE(gig.h) |
13 |
#else |
14 |
# include <gig.h> |
15 |
#endif |
16 |
|
17 |
#ifdef GTKMM_HEADER_FILE |
18 |
# include GTKMM_HEADER_FILE(gtkmm.h) |
19 |
#else |
20 |
# include <gtkmm.h> |
21 |
#endif |
22 |
#include "compat.h" |
23 |
#include <vector> |
24 |
#include "Settings.h" |
25 |
#include "ManagedWindow.h" |
26 |
|
27 |
class ScriptSlots : public ManagedWindow { |
28 |
public: |
29 |
ScriptSlots(); |
30 |
~ScriptSlots(); |
31 |
void setInstrument(gig::Instrument* instrument); |
32 |
|
33 |
sigc::signal<void, gig::Instrument*>& signal_script_slots_changed(); |
34 |
|
35 |
// implementation for abstract methods of interface class "ManagedWindow" |
36 |
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->scriptSlotsWindowX; } |
37 |
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->scriptSlotsWindowY; } |
38 |
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->scriptSlotsWindowW; } |
39 |
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->scriptSlotsWindowH; } |
40 |
|
41 |
protected: |
42 |
struct Row { |
43 |
int id; |
44 |
HBox* hbox; |
45 |
Gtk::Label* label; |
46 |
Gtk::Button* upButton; |
47 |
Gtk::Button* downButton; |
48 |
Gtk::Button* deleteButton; |
49 |
gig::Script* script; |
50 |
}; |
51 |
|
52 |
sigc::signal<void, gig::Instrument*> script_slots_changed_signal; |
53 |
|
54 |
VBox m_vbox; |
55 |
Gtk::Label m_generalInfoLabel; |
56 |
HButtonBox m_buttonBox; |
57 |
Gtk::ScrolledWindow m_scrolledWindow; |
58 |
VBox m_vboxSlots; |
59 |
Gtk::Label m_dragHintLabel; |
60 |
Gtk::Button m_closeButton; |
61 |
|
62 |
gig::Instrument* m_instrument; |
63 |
std::vector<Row> m_slots; |
64 |
|
65 |
void onScriptDragNDropDataReceived( |
66 |
const Glib::RefPtr<Gdk::DragContext>& context, int, int, |
67 |
const Gtk::SelectionData& selection_data, guint, guint time); |
68 |
void appendNewSlot(gig::Script* script); |
69 |
void moveSlotUp(int slotID); |
70 |
void moveSlotDown(int slotID); |
71 |
void deleteSlot(int slotID); |
72 |
void refreshSlots(); |
73 |
void onButtonClose(); |
74 |
void onWindowHide(); |
75 |
void clearSlots(); |
76 |
}; |
77 |
|
78 |
#endif // GIGEDIT_SCRIPTSLOTS_H |