Commit 941f1ad1 authored by Matthias Clasen's avatar Matthias Clasen

Add a simple tab class

This is a very barebones subclass of GtkTab, which shows the page
title in a label.
parent e6e418f6
......@@ -303,6 +303,7 @@ gtk_public_h_sources = \
gtkstyleprovider.h \
gtkswitch.h \
gtktab.h \
gtksimpletab.h \
gtktabstrip.h \
gtktestutils.h \
gtktextattributes.h \
......@@ -903,6 +904,7 @@ gtk_base_c_sources = \
gtkstyleproviderprivate.c \
gtkswitch.c \
gtktab.c \
gtksimpletab.c \
gtktabstrip.c \
gtktestutils.c \
gtktextattributes.c \
......
......@@ -204,6 +204,7 @@
#include <gtk/gtkstyleprovider.h>
#include <gtk/gtkswitch.h>
#include <gtk/gtktab.h>
#include <gtk/gtksimpletab.h>
#include <gtk/gtktabstrip.h>
#include <gtk/gtktextattributes.h>
#include <gtk/gtktextbuffer.h>
......
/* gtksimpletab.c
*
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtksimpletab.h"
#include "gtkintl.h"
#include "gtkprivate.h"
#include "gtkenums.h"
#include "gtklabel.h"
struct _GtkSimpleTab
{
GtkTab parent;
GtkWidget *label;
};
typedef struct _GtkSimpleTabClass GtkSimpleTabClass;
struct _GtkSimpleTabClass
{
GtkTabClass parent_class;
};
G_DEFINE_TYPE (GtkSimpleTab, gtk_simple_tab, GTK_TYPE_TAB)
static void
gtk_simple_tab_class_init (GtkSimpleTabClass *klass)
{
}
static void
gtk_simple_tab_init (GtkSimpleTab *self)
{
self->label = gtk_label_new ("");
gtk_widget_show (self->label);
gtk_widget_set_halign (self->label, GTK_ALIGN_CENTER);
gtk_tab_set_child (GTK_TAB (self), self->label);
g_object_bind_property (self, "title", self->label, "label", G_BINDING_DEFAULT);
}
/* gtksimpletab.h
*
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_SIMPLE_TAB_H__
#define __GTK_SIMPLE_TAB_H__
#include <gtk/gtktab.h>
G_BEGIN_DECLS
#define GTK_TYPE_SIMPLE_TAB (gtk_simple_tab_get_type ())
#define GTK_SIMPLE_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SIMPLE_TAB, GtkSimpleTab))
#define GTK_IS_SIMPLE_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SIMPLE_TAB))
typedef struct _GtkSimpleTab GtkSimpleTab;
GDK_AVAILABLE_IN_3_22
GType gtk_simple_tab_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GTK_SIMPLE_TAB_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment