This dialog allows the user to choose a font.
Figure 13.4. FontSelectionDialog
File: examplebuttonbox.cc
#include "examplebuttonbox.h"
ExampleButtonBox::ExampleButtonBox(bool horizontal,
const Glib::ustring& title,
gint spacing,
Gtk::ButtonBoxStyle layout)
: Gtk::Frame(title),
m_Button_OK("OK"),
m_Button_Cancel("Cancel"),
m_Button_Help("Help")
{
Gtk::ButtonBox* bbox = 0;
if(horizontal)
bbox = Gtk::manage( new Gtk::HButtonBox() );
else
bbox = Gtk::manage( new Gtk::VButtonBox() );
bbox->set_border_width(5);
add(*bbox);
/* Set the appearance of the Button Box */
bbox->set_layout(layout);
bbox->set_spacing(spacing);
bbox->add(m_Button_OK);
bbox->add(m_Button_Cancel);
bbox->add(m_Button_Help);
}
File: main.cc
#include <gtkmm/main.h>
#include "examplewindow.h"
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
ExampleWindow window;
Gtk::Main::run(window); //Shows the window and returns when it is closed.
return 0;
}