Small changes in dialog for adding numbers
This commit is contained in:
parent
f11ac5cbfc
commit
dc4e547c62
@ -10,6 +10,11 @@ namespace gtkpp {
|
||||
return wnd1._window == wnd2._window;
|
||||
}
|
||||
|
||||
Window::Window() {
|
||||
_window = nullptr;
|
||||
_builder = nullptr;
|
||||
}
|
||||
|
||||
Window::Window(std::shared_ptr<Application> app, bool isAppWindow) {
|
||||
if(isAppWindow) {
|
||||
_window = GTK_WINDOW(adw_application_window_new(GTK_APPLICATION(app->gobj())));
|
||||
|
||||
@ -21,6 +21,7 @@ namespace gtkpp {
|
||||
friend bool operator==(const Window& wnd1, const Window& wnd2);
|
||||
|
||||
public:
|
||||
Window();
|
||||
Window(std::shared_ptr<Application> app, bool isAppWindow);
|
||||
Window(std::shared_ptr<Application> app, const char* resourceName, const char* id);
|
||||
void show();
|
||||
@ -31,6 +32,7 @@ namespace gtkpp {
|
||||
[[nodiscard]] std::shared_ptr<Application> application() const;
|
||||
};
|
||||
|
||||
using WindowPtr = std::shared_ptr<Window>;
|
||||
}
|
||||
|
||||
#endif //AUTOCAT_GNOME_WINDOW_H
|
||||
|
||||
@ -4,6 +4,20 @@
|
||||
|
||||
#include "AddNumberDialog.h"
|
||||
|
||||
AddNumberDialog::AddNumberDialog(): gtkpp::Window(nullptr, "/gui/AddNumberDialog.xml", "add_number_dialog") {
|
||||
AddNumberDialog::AddNumberDialog(GtkWindow* parent): gtkpp::Window() {
|
||||
auto flags = static_cast<GtkDialogFlags>(GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL);
|
||||
auto dialog = gtk_dialog_new_with_buttons("Add plate number",
|
||||
parent,
|
||||
flags,
|
||||
"OK", GTK_RESPONSE_ACCEPT,
|
||||
"Cancel", GTK_RESPONSE_REJECT,
|
||||
nullptr);
|
||||
_window = GTK_WINDOW(dialog);
|
||||
|
||||
//auto contentArea = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
|
||||
|
||||
g_signal_connect_swapped (dialog,
|
||||
"response",
|
||||
G_CALLBACK(gtk_window_destroy),
|
||||
dialog);
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
class AddNumberDialog: public gtkpp::Window {
|
||||
public:
|
||||
AddNumberDialog();
|
||||
explicit AddNumberDialog(GtkWindow* parent);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,19 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkDialog" id="add_number_dialog">
|
||||
<!--
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="button_cancel"/>
|
||||
</child>
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="button_ok">
|
||||
<!--
|
||||
<property name="can-default">True</property>
|
||||
-->
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="cancel">button_cancel</action-widget>
|
||||
<action-widget response="ok" default="true">button_ok</action-widget>
|
||||
</action-widgets>
|
||||
-->
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox" id="vbox1">
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkBox" id="hbuttonbox1">
|
||||
<child>
|
||||
<object class="GtkButton" id="ok_button">
|
||||
<property name="label" translatable="yes">_Ok</property>
|
||||
<property name="use-underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@ -14,7 +14,7 @@ MainWindow::MainWindow(std::shared_ptr<gtkpp::Application> app):
|
||||
|
||||
_addNumberButton.onClick([this] {
|
||||
std::cout << "Add clicked" << std::endl;
|
||||
auto dialog = std::make_unique<AddNumberDialog>();
|
||||
auto dialog = std::make_unique<AddNumberDialog>(gobj());
|
||||
dialog->show();
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user