FontSelectionDialog
| Chapter 15. Dialogs |

## FontSelectionDialog

The `FontSelectionDialog` allows the user to choose a font.

Reference

### Example

Figure 15.4. FontSelectionDialog

Source Code

File: `examplewindow.h` (For use with gtkmm 3, not gtkmm 2)

    #ifndef GTKMM_EXAMPLEWINDOW_H
    #define GTKMM_EXAMPLEWINDOW_H

    #include <gtkmm.h>

    class ExampleWindow : public Gtk::Window
    {
    public:
      ExampleWindow();
      virtual ~ExampleWindow();

    protected:
      //Signal handlers:
      void on_button_font_set();

      //Child widgets:
      Gtk::FontButton m_Button;
    };

    #endif //GTKMM_EXAMPLEWINDOW_H

File: `examplewindow.cc` (For use with gtkmm 3, not gtkmm 2)

    #include "examplewindow.h"
    #include <iostream>

    ExampleWindow::ExampleWindow()
    : m_Button("sans")
    {
      set_title("Gtk::FontSelectionDialog example");

      add(m_Button);
      m_Button.signal_font_set().connect(sigc::mem_fun(*this,
                  &ExampleWindow::on_button_font_set) );

      show_all_children();
    }

    ExampleWindow::~ExampleWindow()
    {
    }

    void ExampleWindow::on_button_font_set()
    {
      Glib::ustring font_name = m_Button.get_font_name();
      std::cout << "Font chosen: " << font_name << std::endl;
    }

File: `main.cc` (For use with gtkmm 3, not gtkmm 2)

    #include "examplewindow.h"
    #include <gtkmm/main.h>

    int main(int argc, char *argv[])
    {
      Gtk::Main kit(argc, argv);

      ExampleWindow window;
      //Shows the window and returns when it is closed.
      Gtk::Main::run(window);

      return 0;
    }

ColorSelectionDialog |  | Chapter 16. The Drawing Area Widget