Add Message Dialog
This commit is contained in:
parent
bff59d9ba2
commit
45e7cf0cb8
|
@ -91,6 +91,7 @@
|
|||
"name": "win32",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"{$workspaceFolder}/../**",
|
||||
"${workspaceFolder}/src/**",
|
||||
//I assume the msys2 installed in D:/msys64
|
||||
"D:/msys64/mingw64/include/gtkmm-3.0/**",
|
||||
|
|
|
@ -16,7 +16,7 @@ pkg_check_modules (GTKMM3 REQUIRED gtkmm-3.0)
|
|||
include_directories (${GTKMM3_INCLUDE_DIRS})
|
||||
link_directories (${GTKMM3_LIBRARY_DIRS})
|
||||
|
||||
add_executable(XeRelease src/main.cc src/MyWin.cc src/resources.cpp)
|
||||
add_executable(XeRelease src/main.cc src/MyWin.cc src/MyDialog.cc src/resources.cpp)
|
||||
|
||||
IF(WIN32)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS -mwindows)
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#include "MyDialog.hh"
|
||||
|
||||
MsgBox::MsgBox(Gtk::Window &parent)
|
||||
:hbox(Gtk::ORIENTATION_HORIZONTAL,5)
|
||||
{
|
||||
//Initalize MsgBox
|
||||
set_icon_name("Xe-Release");
|
||||
set_default_size(300,150);
|
||||
add_button("OK",Gtk::RESPONSE_OK);
|
||||
set_transient_for(parent);
|
||||
//Add Message
|
||||
image.set_from_icon_name("Xe-Release",Gtk::ICON_SIZE_DIALOG);
|
||||
vbox=get_content_area();
|
||||
hbox.pack_start(image,Gtk::PACK_SHRINK);
|
||||
hbox.pack_start(msg_label,Gtk::PACK_SHRINK);
|
||||
vbox->pack_start(hbox);
|
||||
}
|
||||
|
||||
void MsgBox::Init(Glib::ustring msg){
|
||||
msg_label.set_label(msg);
|
||||
}
|
||||
|
||||
void MsgBox::on_response(int response_id){
|
||||
hide();
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class MyDialog : public Gtk::Dialog{
|
||||
|
||||
};
|
||||
|
||||
class MsgBox : public Gtk::Dialog{
|
||||
public:
|
||||
MsgBox(Gtk::Window &parent);
|
||||
void Init(Glib::ustring msg);
|
||||
protected:
|
||||
//Signal Handler
|
||||
void on_response(int response_id) override;
|
||||
private:
|
||||
//Child Widgets
|
||||
Gtk::Image image;
|
||||
Gtk::Label msg_label;
|
||||
Gtk::Box *vbox,hbox;
|
||||
};
|
|
@ -2,9 +2,16 @@
|
|||
#include "img7.xpm"
|
||||
#include "winpe.xpm"
|
||||
|
||||
enum Releases{
|
||||
LongTerm,
|
||||
Stable,
|
||||
Develop,
|
||||
};
|
||||
|
||||
MyWin::MyWin()
|
||||
:btn_box(Gtk::ORIENTATION_VERTICAL,5),
|
||||
btn_ver("Xe-Ver")
|
||||
btn_ver("Xe-Ver"),
|
||||
msg_dialog(*this)
|
||||
{
|
||||
//Initalize window
|
||||
set_icon_name("Xe-Release");
|
||||
|
@ -29,6 +36,7 @@ btn_ver("Xe-Ver")
|
|||
btn_box.pack_start(combo,Gtk::PACK_SHRINK);
|
||||
btn_box.pack_start(btn_ver,Gtk::PACK_SHRINK);
|
||||
overlay.add_overlay(btn_box);
|
||||
btn_ver.signal_clicked().connect(sigc::mem_fun(*this,&MyWin::main_releases));
|
||||
|
||||
//Show everything
|
||||
add(overlay);
|
||||
|
@ -86,6 +94,23 @@ void MyWin::background2(){
|
|||
sized.reset();
|
||||
}
|
||||
|
||||
void MyWin::main_releases(){
|
||||
int version=combo.get_active_row_number();
|
||||
switch (version)
|
||||
{
|
||||
case Releases::LongTerm:
|
||||
msg_dialog.Init("Xe LongTerm");
|
||||
break;
|
||||
case Releases::Stable:
|
||||
msg_dialog.Init("Xe Stable");
|
||||
break;
|
||||
case Releases::Develop:
|
||||
msg_dialog.Init("Xe Develop");
|
||||
break;
|
||||
}
|
||||
msg_dialog.show_all();
|
||||
}
|
||||
|
||||
void MyWin::about_dialog(){
|
||||
char *version;
|
||||
version=g_strdup_printf("12.0\nRunning Against Gtkmm %d.%d.%d",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include "MyDialog.hh"
|
||||
|
||||
class MyWin : public Gtk::ApplicationWindow{
|
||||
public:
|
||||
|
@ -22,10 +23,14 @@ private:
|
|||
Gtk::PopoverMenu popover;
|
||||
void titlebar_init();
|
||||
|
||||
//Dialogs
|
||||
MsgBox msg_dialog;
|
||||
|
||||
//Backgrounds
|
||||
void background1();
|
||||
void background2();
|
||||
|
||||
//Signal Handlers
|
||||
void about_dialog();
|
||||
void main_releases();
|
||||
};
|
Loading…
Reference in New Issue