I did all the includes and used name spaces
#include "include/main.h"
#include <iostream>
#include <gtkmm.h>
using namespace std;
using namespace Gtk;
Window* appWindow = nullptr;
Loaded the glade file and tried to load a theme for widgets
auto refBuilder = Builder::create();
auto refProvider = CssProvider::create();
auto refStyleContext = StyleContext::create();
try
{
refBuilder->add_from_resource("/res/gui.glade");
refProvider->load_from_resource("/res/theme.css");
}
Caught errors. Which it does. It gives an error when it cannnot load either of the resources.
catch(const Glib::FileError& ex)
{
cerr << "FileError: " << ex.what() << endl;
return 1;
}
catch(const Glib::MarkupError& ex)
{
cerr << "MarkupError: " << ex.what() << endl;
return 1;
}
catch(const Gtk::BuilderError& ex)
{
cerr << "BuilderError: " << ex.what() << endl;
return 1;
}
Now I cant seem to apply the css for my widgets
refBuilder->get_widget("winFrame", appWindow);
if(appWindow)
{
Glib::RefPtr<Gdk::Screen>refScreen = appWindow->get_screen();
refBuilder->get_widget("quit_Item", quitItem);
refStyleContext->add_provider_for_screen(refScreen, refProvider, GTK_STYLE_PROVIDER_PRIORITY_USER);
if(quitItem)
{
quitItem->signal_activate().connect( sigc::ptr_fun(on_button_clicked) );
};
};
app->run(*appWindow);
delete appWindow;
return 0;
I have the following css which i used to try, but not even a button changed colour
.recordButton {
color: red;
background: blue;
border-color: red;
}
GtkBox{
background: #669999;
text-shadow: 1px 1px 5px black;
box-shadow: 0px 0px 5px black;
border: 1px solid black;
}
Buton{
background: #669999;
text-shadow: 1px 1px 5px black;
box-shadow: 0px 0px 5px black;
border: 1px solid black;
}