Add new tool dialog
parent
587b4dbdb1
commit
36ba59f63d
|
@ -107,4 +107,65 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkAssistant" id="NewToolDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">New tool</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="transient_for">mainWindow</property>
|
||||
<property name="use_header_bar">0</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="NewToolDialogTmp">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Tool name: </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="ToolName">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="has_padding">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover">
|
||||
<property name="name">Tools</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="relative_to">ToolsButton</property>
|
||||
<property name="position">bottom</property>
|
||||
<property name="constrain_to">none</property>
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="name">ToolsList</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -87,6 +87,54 @@ extern void sirEdit::gui::openMainWindow(shared_ptr<sirEdit::data::Serializer> s
|
|||
});
|
||||
}
|
||||
|
||||
// Tools pop-up
|
||||
|
||||
// New tool
|
||||
{
|
||||
Gtk::Button* newToolButton;
|
||||
Gtk::Assistant* newToolAssistant;
|
||||
Gtk::Entry* toolName;
|
||||
Gtk::Widget* newToolDialogTmp;
|
||||
mainWindowBuild->get_widget("ToolAddButton", newToolButton);
|
||||
mainWindowBuild->get_widget("NewToolDialog", newToolAssistant);
|
||||
mainWindowBuild->get_widget("ToolName", toolName);
|
||||
mainWindowBuild->get_widget("NewToolDialogTmp", newToolDialogTmp);
|
||||
|
||||
// New dialog / close
|
||||
{
|
||||
newToolButton->signal_clicked().connect([newToolAssistant, toolName, newToolDialogTmp]() -> void {
|
||||
newToolAssistant->set_current_page(0);
|
||||
newToolAssistant->set_page_complete(*newToolDialogTmp, false);
|
||||
toolName->set_text("");
|
||||
newToolAssistant->show_all();
|
||||
});
|
||||
|
||||
auto closeFunc = [newToolAssistant]() -> void {
|
||||
newToolAssistant->hide();
|
||||
};
|
||||
newToolAssistant->signal_cancel().connect(closeFunc);
|
||||
newToolAssistant->signal_close().connect(closeFunc);
|
||||
}
|
||||
|
||||
// Dialog update checkers
|
||||
{
|
||||
auto updateCheck = [toolName, newToolDialogTmp, newToolAssistant]() -> void {
|
||||
if(toolName->get_text() == "") {
|
||||
newToolAssistant->set_page_complete(*newToolDialogTmp, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Check if tool exists
|
||||
|
||||
newToolAssistant->set_page_complete(*newToolDialogTmp, true);
|
||||
return;
|
||||
};
|
||||
toolName->signal_changed().connect(updateCheck);
|
||||
}
|
||||
|
||||
// TODO: Dialog finished
|
||||
}
|
||||
|
||||
// Window
|
||||
Gtk::ApplicationWindow* window;
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue