sidepanel.c 1.87 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
    This file is part of darktable,
    copyright (c) 2015 LebedevRI.

    darktable is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    darktable 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with darktable.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "dtgtk/sidepanel.h"
Roman Lebedev's avatar
Roman Lebedev committed
20
#include "develop/imageop.h"
21

Roman Lebedev's avatar
Roman Lebedev committed
22 23 24 25 26
#include <gtk/gtk.h>

G_DEFINE_TYPE(GtkDarktableSidePanel, dtgtk_side_panel, GTK_TYPE_BOX);

static void dtgtk_side_panel_get_preferred_width(GtkWidget *widget, gint *minimum_size, gint *natural_size)
27
{
Roman Lebedev's avatar
Roman Lebedev committed
28
  GtkDarktableSidePanelClass *class = DTGTK_SIDE_PANEL_GET_CLASS(widget);
29

Roman Lebedev's avatar
Roman Lebedev committed
30
  *minimum_size = *natural_size = class->width;
31 32
}

Roman Lebedev's avatar
Roman Lebedev committed
33
static void dtgtk_side_panel_class_init(GtkDarktableSidePanelClass *class)
34
{
Roman Lebedev's avatar
Roman Lebedev committed
35
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(class);
36

Roman Lebedev's avatar
Roman Lebedev committed
37 38 39
  widget_class->get_preferred_width = dtgtk_side_panel_get_preferred_width;

  class->width = dt_conf_get_int("panel_width");
40 41
}

Roman Lebedev's avatar
Roman Lebedev committed
42
static void dtgtk_side_panel_init(GtkDarktableSidePanel *panel)
43 44
{
  gtk_widget_set_vexpand(GTK_WIDGET(panel), TRUE);
45
}
46

47 48 49 50
// public functions
GtkWidget *dtgtk_side_panel_new()
{
  return g_object_new(dtgtk_side_panel_get_type(), "orientation", GTK_ORIENTATION_VERTICAL, NULL);
51 52 53 54
}

// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
Tobias Ellinghaus's avatar
Tobias Ellinghaus committed
55
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;