|
@@ -29,7 +29,25 @@ MainWindow::MainWindow()
|
|
|
: Gtk::ApplicationWindow(),
|
|
|
m_button("Send"),
|
|
|
m_button2("A ver si esto va"),
|
|
|
- m_box(Gtk::ORIENTATION_VERTICAL, 0)
|
|
|
+ m_rosterpanel_reveal_btn("go-next"),
|
|
|
+ m_test_hide_btn("hiding things"), // Remove later
|
|
|
+ m_vbox(Gtk::ORIENTATION_VERTICAL, 0)
|
|
|
+{
|
|
|
+ generateUI();
|
|
|
+ // Signals
|
|
|
+ m_button.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::sendMessage));
|
|
|
+ m_button2.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onConnectSignal));
|
|
|
+ m_rosterpanel_reveal_btn.signal_clicked().connect(sigc::mem_fun(*this,
|
|
|
+ &MainWindow::showHideSideBar));
|
|
|
+ show_all_children();
|
|
|
+ std::cout << "Window created" << "\n";
|
|
|
+
|
|
|
+ // dispatcher connection
|
|
|
+ m_msg_dispatcher.connect(sigc::mem_fun(*this, &MainWindow::on_message_from_gloox));
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::generateUI()
|
|
|
{
|
|
|
m_headerbar.set_show_close_button();
|
|
|
set_titlebar(m_headerbar);
|
|
@@ -37,26 +55,29 @@ MainWindow::MainWindow()
|
|
|
|
|
|
set_default_size(400, 400);
|
|
|
|
|
|
- add(m_box);
|
|
|
+ // Adding the main container in the window
|
|
|
+ add(m_overlay);
|
|
|
|
|
|
+ // Aligning the buttons
|
|
|
m_button.set_halign(Gtk::ALIGN_CENTER);
|
|
|
m_button.set_valign(Gtk::ALIGN_CENTER);
|
|
|
|
|
|
- m_box.pack_start(m_conversationCont, Gtk::PACK_EXPAND_WIDGET);
|
|
|
- m_box.pack_start(m_h_box, Gtk::PACK_SHRINK);
|
|
|
- m_h_box.pack_start(m_entry, Gtk::PACK_EXPAND_WIDGET);
|
|
|
- m_h_box.pack_start(m_button, Gtk::PACK_SHRINK);
|
|
|
- m_h_box.pack_start(m_button2, Gtk::PACK_SHRINK);
|
|
|
-
|
|
|
- // Signals
|
|
|
- m_button.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::sendMessage));
|
|
|
- m_button2.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onConnectSignal));
|
|
|
- show_all_children();
|
|
|
- std::cout << "Window created" << "\n";
|
|
|
-
|
|
|
- // dispatcher connection
|
|
|
- m_msg_dispatcher.connect(sigc::mem_fun(*this, &MainWindow::on_message_from_gloox));
|
|
|
-
|
|
|
+ // Placing widgets
|
|
|
+ // m_main_hbox.pack_start(m_sidebar);
|
|
|
+ // m_vbox.add(m_overlay);
|
|
|
+ m_overlay.add(m_vbox);
|
|
|
+ m_overlay.add_overlay(m_sidebar);
|
|
|
+ m_sidebar.set_transition_type(Gtk::RevealerTransitionType::REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
|
|
|
+ m_sidebar.set_reveal_child(true);
|
|
|
+ // m_main_hbox.pack_start(m_vbox, Gtk::PACK_EXPAND_WIDGET);
|
|
|
+ m_vbox.pack_start(m_conversationCont, Gtk::PACK_EXPAND_WIDGET);
|
|
|
+ m_vbox.pack_start(m_hbox, Gtk::PACK_SHRINK);
|
|
|
+ m_hbox.pack_start(m_entry, Gtk::PACK_EXPAND_WIDGET);
|
|
|
+ m_hbox.pack_start(m_button, Gtk::PACK_SHRINK);
|
|
|
+ m_hbox.pack_start(m_button2, Gtk::PACK_SHRINK);
|
|
|
+ // GtkHeaderBar
|
|
|
+ m_headerbar.pack_start(m_rosterpanel_reveal_btn);
|
|
|
+ m_headerbar.pack_start(m_test_hide_btn);
|
|
|
}
|
|
|
|
|
|
void MainWindow::sendMessage()
|
|
@@ -92,3 +113,12 @@ void MainWindow::onConnectSignal()
|
|
|
m_conversationCont.addMessage("Message receved");
|
|
|
m_conversationCont.addMessage(m_xmpplar_client->getBody());
|
|
|
}
|
|
|
+
|
|
|
+void MainWindow::showHideSideBar()
|
|
|
+{
|
|
|
+ if (m_sidebar.get_child_revealed()) {
|
|
|
+ m_sidebar.set_reveal_child(false);
|
|
|
+ }else{
|
|
|
+ m_sidebar.set_reveal_child(true);
|
|
|
+ }
|
|
|
+}
|