button.h 2.64 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
    This file is part of darktable,
    copyright (c) 2010 Henrik Andersson.

    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/>.
*/
18 19

#pragma once
20 21

#include "paint.h"
22
#include <gtk/gtk.h>
23
G_BEGIN_DECLS
24 25
#define DTGTK_BUTTON(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, dtgtk_button_get_type(), GtkDarktableButton)
#define DTGTK_BUTTON_CLASS(klass)                                                                            \
26
  G_TYPE_CHECK_CLASS_CAST(klass, dtgtk_button_get_type(), GtkDarktableButtonClass)
27
#define DTGTK_IS_BUTTON(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, dtgtk_button_get_type())
28
#define DTGTK_IS_BUTTON_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE(obj, dtgtk_button_get_type())
29

30 31
typedef enum _darktable_button_flags
{
32 33
  DARKTABLE_BUTTON_SHOW_LABEL = 1
} _darktable_button_flags_t;
34

35 36 37 38
typedef struct _GtkDarktableButton
{
  GtkButton widget;
  DTGTKCairoPaintIconFunc icon;
39
  gint icon_flags;
40
  void *icon_data;
41
  GdkRGBA bg, fg;
42 43 44 45 46 47 48
} GtkDarktableButton;

typedef struct _GtkDarktableButtonClass
{
  GtkButtonClass parent_class;
} GtkDarktableButtonClass;

49
GType dtgtk_button_get_type(void);
50

Unknown's avatar
Unknown committed
51
/** instantiate a new darktable button control passing paint function as content */
52
GtkWidget *dtgtk_button_new(DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata);
53
/** set the paint function for a button */
54
void dtgtk_button_set_paint(GtkDarktableButton *button, DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata);
55 56
/** set the active state of the button icon */
void dtgtk_button_set_active(GtkDarktableButton *button, gboolean active);
57 58 59 60 61
/** overwrite the foreground color, or NULL to reset it */
void dtgtk_button_override_color(GtkDarktableButton *button, GdkRGBA *color);
/** overwrite the background color, or NULL to reset it */
void dtgtk_button_override_background_color(GtkDarktableButton *button, GdkRGBA *color);

62
G_END_DECLS
63

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