boom
boom

Reputation: 6166

customizing gtk window title bar

How can i customize gtk window title bar. I need to add custom buttons, and title bar image.alt text

Upvotes: 6

Views: 12714

Answers (3)

Etua
Etua

Reputation: 89

Starting from GTK 3.10 you can use gtk_window_set_titlebar

gtk_window_set_titlebar (GtkWindow *window, GtkWidget *titlebar) as you can see the only arguments you need are the window that you want to customise and the GtkWidget that will serve as the titlebar. GTK developers suggest to use GtkHeaderBar as it provides some features that you would expect from the titlebar like close window buttons out of the box but you are free to use any other GtkWidget.

Upvotes: 2

gregoiregentil
gregoiregentil

Reputation: 1899

Here is a working solution:

#include <gtk/gtk.h>

int main(int argc, char *argv[]) {
    GtkWidget *window;
    gtk_init(&argc, &argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "UV with Y variable");
    gtk_widget_show_all(window);
    gtk_main();
    return 0;
}

Upvotes: 1

ptomato
ptomato

Reputation: 57880

You can't. The title bar is drawn by the window manager, not by GTK. You can tell the window manager to set the title using window.set_title(), and you can set an icon, which may or may not be displayed by the window manager, using window.set_icon(), window.set_icon_name(), or window.set_icon_from_file(). That's about it.

Upvotes: 4

Related Questions