#ifdef away testcases.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2003-01-01 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/fnmatch.c (FNMATCH_TEST_CASES): #undef, since having
|
||||
a main() in the library is obviously bad.
|
||||
|
||||
2002-12-27 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_drag_data_received): Place the
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2003-01-01 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/fnmatch.c (FNMATCH_TEST_CASES): #undef, since having
|
||||
a main() in the library is obviously bad.
|
||||
|
||||
2002-12-27 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_drag_data_received): Place the
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2003-01-01 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/fnmatch.c (FNMATCH_TEST_CASES): #undef, since having
|
||||
a main() in the library is obviously bad.
|
||||
|
||||
2002-12-27 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_drag_data_received): Place the
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2003-01-01 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/fnmatch.c (FNMATCH_TEST_CASES): #undef, since having
|
||||
a main() in the library is obviously bad.
|
||||
|
||||
2002-12-27 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_drag_data_received): Place the
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2003-01-01 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/fnmatch.c (FNMATCH_TEST_CASES): #undef, since having
|
||||
a main() in the library is obviously bad.
|
||||
|
||||
2002-12-27 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_drag_data_received): Place the
|
||||
|
||||
@@ -1,392 +0,0 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <demos.h>
|
||||
|
||||
static GtkTextBuffer *info_buffer;
|
||||
static GtkTextBuffer *source_buffer;
|
||||
|
||||
static gchar *current_file = NULL;
|
||||
|
||||
enum {
|
||||
TITLE_COLUMN,
|
||||
FILENAME_COLUMN,
|
||||
FUNC_COLUMN,
|
||||
ITALIC_COLUMN,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
gboolean
|
||||
read_line (FILE *stream, GString *str)
|
||||
{
|
||||
int n_read = 0;
|
||||
|
||||
flockfile (stream);
|
||||
|
||||
g_string_truncate (str, 0);
|
||||
|
||||
while (1)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = getc_unlocked (stream);
|
||||
|
||||
if (c == EOF)
|
||||
goto done;
|
||||
else
|
||||
n_read++;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
{
|
||||
int next_c = getc_unlocked (stream);
|
||||
|
||||
if (!(next_c == EOF ||
|
||||
(c == '\r' && next_c == '\n') ||
|
||||
(c == '\n' && next_c == '\r')))
|
||||
ungetc (next_c, stream);
|
||||
|
||||
goto done;
|
||||
}
|
||||
default:
|
||||
g_string_append_c (str, c);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
funlockfile (stream);
|
||||
|
||||
return n_read > 0;
|
||||
}
|
||||
|
||||
void
|
||||
load_file (const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
GtkTextIter start, end;
|
||||
GString *buffer = g_string_new (NULL);
|
||||
int state = 0;
|
||||
gboolean in_para = 0;
|
||||
|
||||
if (current_file && !strcmp (current_file, filename))
|
||||
return;
|
||||
|
||||
g_free (current_file);
|
||||
current_file = g_strdup (filename);
|
||||
|
||||
gtk_text_buffer_get_bounds (info_buffer, &start, &end);
|
||||
gtk_text_buffer_delete (info_buffer, &start, &end);
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
gtk_text_buffer_delete (source_buffer, &start, &end);
|
||||
|
||||
file = fopen (filename, "r");
|
||||
if (!file)
|
||||
{
|
||||
g_warning ("Cannot open %s: %s\n", filename, g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (info_buffer, &start, 0);
|
||||
while (read_line (file, buffer))
|
||||
{
|
||||
gchar *p = buffer->str;
|
||||
gchar *q;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
/* Reading title */
|
||||
while (*p == '/' || *p == '*' || isspace (*p))
|
||||
p++;
|
||||
q = p + strlen (p);
|
||||
while (q > p && isspace (*(q - 1)))
|
||||
q--;
|
||||
|
||||
if (q > p)
|
||||
{
|
||||
int len_chars = g_utf8_pointer_to_offset (p, q);
|
||||
|
||||
end = start;
|
||||
|
||||
g_assert (strlen (p) >= q - p);
|
||||
gtk_text_buffer_insert (info_buffer, &end, p, q - p);
|
||||
start = end;
|
||||
|
||||
gtk_text_iter_backward_chars (&start, len_chars);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "title", &start, &end);
|
||||
|
||||
start = end;
|
||||
|
||||
state++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* Reading body of info section */
|
||||
while (isspace (*p))
|
||||
p++;
|
||||
if (*p == '*' && *(p + 1) == '/')
|
||||
{
|
||||
gtk_text_buffer_get_iter_at_offset (source_buffer, &start, 0);
|
||||
state++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len;
|
||||
|
||||
while (*p == '*' || isspace (*p))
|
||||
p++;
|
||||
|
||||
len = strlen (p);
|
||||
while (isspace (*(p + len - 1)))
|
||||
len--;
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
if (in_para)
|
||||
gtk_text_buffer_insert (info_buffer, &start, " ", 1);
|
||||
|
||||
g_assert (strlen (p) >= len);
|
||||
gtk_text_buffer_insert (info_buffer, &start, p, len);
|
||||
in_para = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
||||
in_para = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* Skipping blank lines */
|
||||
while (isspace (*p))
|
||||
p++;
|
||||
if (*p)
|
||||
{
|
||||
p = buffer->str;
|
||||
state++;
|
||||
/* Fall through */
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* Reading program body */
|
||||
gtk_text_buffer_insert (source_buffer, &start, p, -1);
|
||||
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "source", &start, &end);
|
||||
}
|
||||
|
||||
gboolean
|
||||
button_press_event_cb (GtkTreeView *tree_view,
|
||||
GdkEventButton *event,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
if (event->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
GtkTreePath *path = NULL;
|
||||
|
||||
gtk_tree_view_get_path_at_pos (tree_view,
|
||||
event->window,
|
||||
event->x,
|
||||
event->y,
|
||||
&path,
|
||||
NULL);
|
||||
|
||||
if (path)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean italic;
|
||||
GVoidFunc func;
|
||||
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
gtk_tree_store_get (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
FUNC_COLUMN, &func,
|
||||
ITALIC_COLUMN, &italic,
|
||||
-1);
|
||||
(func) ();
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
ITALIC_COLUMN, !italic,
|
||||
-1);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (tree_view),
|
||||
"button_press_event");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
selection_cb (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GValue value = {0, };
|
||||
|
||||
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
return;
|
||||
|
||||
gtk_tree_model_get_value (model, &iter,
|
||||
FILENAME_COLUMN,
|
||||
&value);
|
||||
load_file (g_value_get_string (&value));
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_text (GtkTextBuffer **buffer,
|
||||
gboolean is_source)
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_view;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_SHADOW_IN);
|
||||
|
||||
text_view = gtk_text_view_new ();
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
|
||||
|
||||
*buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), *buffer);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
|
||||
if (is_source)
|
||||
{
|
||||
font_desc = pango_font_description_from_string ("Courier 10");
|
||||
gtk_widget_modify_font (text_view, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
}
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), !is_source);
|
||||
|
||||
return scrolled_window;
|
||||
}
|
||||
|
||||
/* Technically a list, but if we do go to 80 demos, we may want to move to a tree */
|
||||
static GtkWidget *
|
||||
create_tree (void)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkCellRenderer *cell;
|
||||
GtkWidget *tree_view;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreeStore *model;
|
||||
GtkTreeIter iter;
|
||||
gint i;
|
||||
|
||||
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
|
||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
||||
|
||||
gtk_tree_selection_set_type (GTK_TREE_SELECTION (selection),
|
||||
GTK_TREE_SELECTION_SINGLE);
|
||||
gtk_widget_set_usize (tree_view, 200, -1);
|
||||
|
||||
for (i=0; i < G_N_ELEMENTS (testgtk_demos); i++)
|
||||
{
|
||||
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
|
||||
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
TITLE_COLUMN, testgtk_demos[i].title,
|
||||
FILENAME_COLUMN, testgtk_demos[i].filename,
|
||||
FUNC_COLUMN, testgtk_demos[i].func,
|
||||
ITALIC_COLUMN, FALSE,
|
||||
-1);
|
||||
}
|
||||
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Widget",
|
||||
cell,
|
||||
"text", TITLE_COLUMN,
|
||||
"italic", ITALIC_COLUMN,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
|
||||
GTK_TREE_VIEW_COLUMN (column));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", selection_cb, model);
|
||||
gtk_signal_connect (GTK_OBJECT (tree_view), "button_press_event", GTK_SIGNAL_FUNC (button_press_event_cb), model);
|
||||
|
||||
return tree_view;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *tree;
|
||||
GtkTextTag *tag;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
tree = create_tree ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), tree, FALSE, FALSE, 0);
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
create_text (&info_buffer, FALSE),
|
||||
gtk_label_new ("Info"));
|
||||
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
create_text (&source_buffer, TRUE),
|
||||
gtk_label_new ("Source"));
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "title");
|
||||
gtk_object_set (GTK_OBJECT (tag),
|
||||
"font", "Sans 18",
|
||||
NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "source");
|
||||
gtk_object_set (GTK_OBJECT (tag),
|
||||
"font", "Courier 10",
|
||||
"pixels_above_lines", 0,
|
||||
"pixels_below_lines", 0,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
|
||||
load_file (testgtk_demos[0].filename);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ _gtk_fnmatch (const char *pattern,
|
||||
return gtk_fnmatch_intern (pattern, string, TRUE);
|
||||
}
|
||||
|
||||
#define FNMATCH_TEST_CASES
|
||||
#undef FNMATCH_TEST_CASES
|
||||
#ifdef FNMATCH_TEST_CASES
|
||||
|
||||
#define TEST(pat, str, result) \
|
||||
|
||||
2454
gtk/gtkiconview.c
2454
gtk/gtkiconview.c
File diff suppressed because it is too large
Load Diff
@@ -1,151 +0,0 @@
|
||||
/* eggiconlist.h
|
||||
* Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __EGG_ICON_LIST_H__
|
||||
#define __EGG_ICON_LIST_H__
|
||||
|
||||
#include <gtk/gtkcontainer.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EGG_TYPE_ICON_LIST (egg_icon_list_get_type ())
|
||||
#define EGG_ICON_LIST(obj) (GTK_CHECK_CAST ((obj), EGG_TYPE_ICON_LIST, EggIconList))
|
||||
#define EGG_ICON_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EGG_TYPE_ICON_LIST, EggIconListClass))
|
||||
#define EGG_IS_ICON_LIST(obj) (GTK_CHECK_TYPE ((obj), EGG_TYPE_ICON_LIST))
|
||||
#define EGG_IS_ICON_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EGG_TYPE_ICON_LIST))
|
||||
#define EGG_ICON_LIST_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), EGG_TYPE_ICON_LIST, EggIconListClass))
|
||||
|
||||
#define EGG_TYPE_ICON_LIST_ITEM (egg_icon_list_item_get_type ())
|
||||
|
||||
typedef struct _EggIconList EggIconList;
|
||||
typedef struct _EggIconListClass EggIconListClass;
|
||||
typedef struct _EggIconListPrivate EggIconListPrivate;
|
||||
typedef struct _EggIconListItem EggIconListItem;
|
||||
|
||||
typedef void (* EggIconListForeachFunc) (EggIconList *icon_list,
|
||||
EggIconListItem *item,
|
||||
gpointer data);
|
||||
typedef gint (* EggIconListItemCompareFunc) (EggIconList *icon_list,
|
||||
EggIconListItem *a,
|
||||
EggIconListItem *b,
|
||||
gpointer user_data);
|
||||
|
||||
struct _EggIconList
|
||||
{
|
||||
GtkContainer parent;
|
||||
|
||||
EggIconListPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EggIconListClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
|
||||
void (* set_scroll_adjustments) (EggIconList *icon_list,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
void (* item_activated) (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
void (* selection_changed) (EggIconList *icon_list);
|
||||
void (* item_added) (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
void (* item_removed) (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
void (* item_changed) (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
/* Key binding signals */
|
||||
void (* select_all) (EggIconList *icon_list);
|
||||
void (* unselect_all) (EggIconList *icon_list);
|
||||
void (* select_cursor_item) (EggIconList *icon_list);
|
||||
void (* toggle_cursor_item) (EggIconList *icon_list);
|
||||
};
|
||||
|
||||
GType egg_icon_list_get_type (void);
|
||||
GType egg_icon_list_item_get_type (void);
|
||||
GtkWidget *egg_icon_list_new (void);
|
||||
|
||||
EggIconListItem * egg_icon_list_item_new (GdkPixbuf *icon,
|
||||
const gchar *label);
|
||||
void egg_icon_list_item_ref (EggIconListItem *item);
|
||||
void egg_icon_list_item_unref (EggIconListItem *item);
|
||||
void egg_icon_list_item_set_data (EggIconListItem *item,
|
||||
gpointer data);
|
||||
void egg_icon_list_item_set_data_full (EggIconListItem *item,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy_notify);
|
||||
gpointer egg_icon_list_item_get_data (EggIconListItem *item);
|
||||
void egg_icon_list_item_set_label (EggIconListItem *item,
|
||||
const char *label);
|
||||
G_CONST_RETURN gchar *egg_icon_list_item_get_label (EggIconListItem *item);
|
||||
void egg_icon_list_item_set_icon (EggIconListItem *item,
|
||||
GdkPixbuf *icon);
|
||||
GdkPixbuf * egg_icon_list_item_get_icon (EggIconListItem *item);
|
||||
void egg_icon_list_append_item (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
void egg_icon_list_prepend_item (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
void egg_icon_list_insert_item_before (EggIconList *icon_list,
|
||||
EggIconListItem *sibling,
|
||||
EggIconListItem *item);
|
||||
void egg_icon_list_insert_item_after (EggIconList *icon_list,
|
||||
EggIconListItem *sibling,
|
||||
EggIconListItem *item);
|
||||
void egg_icon_list_remove_item (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
void egg_icon_list_clear (EggIconList *icon_list);
|
||||
EggIconListItem * egg_icon_list_get_item_at_pos (EggIconList *icon_list,
|
||||
gint x,
|
||||
gint y);
|
||||
gint egg_icon_list_get_item_count (EggIconList *icon_list);
|
||||
void egg_icon_list_foreach (EggIconList *icon_list,
|
||||
EggIconListForeachFunc func,
|
||||
gpointer data);
|
||||
GList * egg_icon_list_get_selected (EggIconList *icon_list);
|
||||
void egg_icon_list_selected_foreach (EggIconList *icon_list,
|
||||
EggIconListForeachFunc func,
|
||||
gpointer data);
|
||||
void egg_icon_list_set_selection_mode (EggIconList *icon_list,
|
||||
GtkSelectionMode mode);
|
||||
GtkSelectionMode egg_icon_list_get_selection_mode (EggIconList *icon_list);
|
||||
void egg_icon_list_select_item (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
void egg_icon_list_unselect_item (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
gboolean egg_icon_list_item_is_selected (EggIconListItem *item);
|
||||
void egg_icon_list_select_all (EggIconList *icon_list);
|
||||
void egg_icon_list_unselect_all (EggIconList *icon_list);
|
||||
void egg_icon_list_set_sorted (EggIconList *icon_list,
|
||||
gboolean sorted);
|
||||
gboolean egg_icon_list_get_sorted (EggIconList *icon_list);
|
||||
void egg_icon_list_set_sort_func (EggIconList *icon_list,
|
||||
EggIconListItemCompareFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy_notify);
|
||||
void egg_icon_list_set_sort_order (EggIconList *icon_list,
|
||||
GtkSortType order);
|
||||
GtkSortType egg_icon_list_get_sort_order (EggIconList *icon_list);
|
||||
void egg_icon_list_item_activated (EggIconList *icon_list,
|
||||
EggIconListItem *item);
|
||||
|
||||
/* For accessibility */
|
||||
GList *egg_icon_list_get_items (EggIconList *icon_list);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __EGG_ICON_LIST_H__ */
|
||||
@@ -1,6 +0,0 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
.libs
|
||||
*.lo
|
||||
*.la
|
||||
@@ -1,252 +0,0 @@
|
||||
Fri Sep 6 20:32:45 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixbuf-draw.c: Account for the possibility of detail == NULL
|
||||
(#89561, Hongli Lai, Luca Barbato)
|
||||
|
||||
Sun Apr 21 14:10:04 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixbuf-rc-style.c pixbuf.h pixbuf-draw.c: Add a fake STEPPER
|
||||
function that is used for drawing scrollbar steppers,
|
||||
so that themes that want to draw the button and arrow
|
||||
separately can override the default handling.
|
||||
|
||||
* pixbuf-draw.c: Remove draw_polygon() since it was
|
||||
just a cut-and-paste of the default one. Remove
|
||||
some unused code.
|
||||
|
||||
2002-03-07 James Henstridge <james@daa.com.au>
|
||||
|
||||
* Makefile.am (libpixmap_la_LIBADD): link pixbuf engine against
|
||||
the gtk+ libraries, so that it can be used with programs that
|
||||
dlopen gtk+ without the RTLD_GLOBAL flag (such as scripting
|
||||
languages and mozilla).
|
||||
|
||||
Thu Feb 7 00:21:21 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixbuf-render.c (pixbuf_render): Add gradient
|
||||
rendering -- if the source width/height is zero,
|
||||
render a gradient from the surrounding values.
|
||||
|
||||
Mon Jan 28 15:34:43 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixbuf-render.c (compute_hint): Fix hint computation
|
||||
again.
|
||||
|
||||
Mon Jan 28 12:17:07 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixbuf-render.c (compute_hint): Fix problems in computing
|
||||
MISSING hint.
|
||||
|
||||
Sun Jan 27 23:58:13 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixbuf-render.c (compute_hint): Optimize the case
|
||||
where a component is entirely transparent by skipping
|
||||
drawing it.
|
||||
|
||||
* pixbuf-rc-style.c (theme_parse_image): Catch case
|
||||
where background or overlay border/stretch are specified
|
||||
without a background image.
|
||||
|
||||
* pixbuf-render.c (theme_pixbuf_destroy): Actually free
|
||||
the structure and filename.
|
||||
|
||||
=================== Move back into gtk-engines ====================
|
||||
|
||||
Sat Jan 19 02:45:17 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* src/pixbuf-render.c (theme_pixbuf_compute_hints): Catch
|
||||
invalid borders, and warn.
|
||||
|
||||
Sat Jan 19 00:32:14 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* examples/*: Add an extrodinarily ugly example.
|
||||
|
||||
* src/pixbuf-draw.c (draw_simple_image): Never shape
|
||||
the window, even if we are allowed to. Shaping is
|
||||
ugly -- if the widget isn't NO_WINDOW (most are),
|
||||
you'll just have to draw it rectangular.
|
||||
|
||||
* src/pixbuf-render.c (pixbuf_render): Always use
|
||||
gdk_pixbuf_render_alpha() with FULL_ALPHA() as the
|
||||
type.
|
||||
|
||||
* pixbuf.h src/pixbuf-render.c (theme_pixbuf_compute_hints): To
|
||||
speed up scaling, cache whether pixbufs have constant rows
|
||||
or constant columns.
|
||||
|
||||
* src/pixbuf-render.c (pixbuf_render): Speed up scaling
|
||||
by using the hints from compute_hints().
|
||||
|
||||
Fri Jan 18 20:49:48 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* configure.in: Use pkg-config to get the binray version
|
||||
of GTK+ that we use for an install path.
|
||||
|
||||
Fri Jan 18 18:14:11 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* src/pixbuf-draw.c (draw_focus): Fix for changes to draw_focus.
|
||||
|
||||
2001-09-21 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* src/pixbuf-rc-style-c : GtkRcStyle::parse has a GtkSettings
|
||||
parameter now. Pass it through theme_parse_file () to use it
|
||||
gtk_rc_find_pixmap_in_path ()
|
||||
|
||||
* src/pixbuf-draw.c : the font field from GtkStyle is private
|
||||
now, use accessor gtk_style_get_font ()
|
||||
|
||||
* makefile.msc : compile on win32, use it if you have a _real_
|
||||
fast computer or want to see gtk in slow motion :-)
|
||||
|
||||
Thu May 3 05:36:06 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixbuf.h: Fix trailing comma on enumeration. (#54071)
|
||||
|
||||
2001-03-05 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* src/pixbuf-draw.c: made the "parent_class" pointer static.
|
||||
|
||||
(Owen, I just commented out the draw methods which don't exist any
|
||||
more to make it compile).
|
||||
|
||||
2001-02-20 Sven Neumann <sven@convergence.de>
|
||||
|
||||
* src/pixbuf-draw.c (draw_vline): use draw_vline method of
|
||||
parent_class, not draw_hline
|
||||
|
||||
Wed Nov 15 21:56:28 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* src/pixbuf-*: A few updates for GTypePlugin.
|
||||
|
||||
Tue Jul 18 12:13:19 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Updates to work with GTK+-2.0 theme engine architecture.
|
||||
It won't even sort of work with GTK+-1.2 any more.
|
||||
|
||||
* configure.in src/Makefile.am: Look for GTK+-2.0,
|
||||
install engine into GTK+-2.0 location.
|
||||
|
||||
* src/pixbuf-style.h src/pixbuf-rc-style.[ch]: New
|
||||
files for GtkRcStyle and GtkStyle subclasses. Parsing,
|
||||
etc, moves to pixbuf-rc-style.[ch]
|
||||
|
||||
* src/pixbuf-draw.c: Chain up to parent implementation
|
||||
when images aren't found for a certain element.
|
||||
|
||||
Sun Jul 9 18:15:58 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* configure.in (ACLOCAL): Add -Wall for gcc.
|
||||
|
||||
* src/pixbuf-render.c (pixbuf_render): Fix problem
|
||||
using gdk_rectangle_intersect() from GTK+-1.2.
|
||||
|
||||
* src/pixbuf-render.c src/pixbuf-draw.c: Remove
|
||||
direct access to pixbuf internals.
|
||||
|
||||
Mon Mar 6 11:44:58 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* docs/gap-geometry.fig: Moved into docs/ subdir
|
||||
|
||||
* Makefile.am configure.in autogen.sh src/Makefile.am:
|
||||
automakify
|
||||
|
||||
* src/pixbuf.h src/pixbuf-render.c src/pixbuf-draw.c
|
||||
src/pixbuf-main.c: Move sources into subdir and
|
||||
rename.
|
||||
|
||||
Mon Mar 6 11:02:07 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixmap_theme_pixbuf.c: Handle drawing transparency without a
|
||||
mask correctly.
|
||||
|
||||
* pixmap_theme_main.c pixmap_theme_draw.c: Remove duplicate
|
||||
includes.
|
||||
|
||||
Sun Feb 6 21:34:30 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* Started ChangeLog for pixbuf engine, check sources
|
||||
into CVS.
|
||||
|
||||
========== ChangeLog for pixmap engine ===================
|
||||
|
||||
1999-11-22 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* pixmap_theme_main.c (theme_duplicate_style): Really copy the
|
||||
`src_data->img_list', not just the pointer that points to it.
|
||||
|
||||
Tue Oct 5 15:13:29 1999 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixmap_theme_draw.c (apply_theme_image): Don't set
|
||||
background pixmap on pixmaps.
|
||||
|
||||
1999-02-14 Raja R Harinath <harinath@cs.umn.edu>
|
||||
|
||||
* Theme/gtk/Makefile.am.in (Makefile.am): Handle the case when
|
||||
files are deleted.
|
||||
|
||||
Thu Feb 11 21:16:53 1999 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixmap_theme_main.c (theme_data_unref): Free the
|
||||
theme data structure as well as the contents.
|
||||
|
||||
1999-02-03 Raja R Harinath <harinath@cs.umn.edu>
|
||||
|
||||
* Theme/gtk/Makefile.am.in: New file. Theme/gtk/Makefile.am is
|
||||
generated from this file when new *.png files are added.
|
||||
|
||||
1999-01-23 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* pixmap_theme_main.c (theme_init): Turn on pixmap cache.
|
||||
|
||||
Mon Jan 18 13:37:23 1999 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* Theme/gtk/gtkrc: Give buttons a gray background
|
||||
color so they look a little less funny when initially
|
||||
drawing.
|
||||
|
||||
Wed Jan 13 18:58:25 1999 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixmap_theme_draw.c: Fixed pervasive mis-bracketing
|
||||
that was causing drawing if the drawn region and
|
||||
clipping region did NOT intersect, and a couple
|
||||
of errors in computing source and destination
|
||||
regions.
|
||||
|
||||
1998-11-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* pixmap_theme_draw.c: #include <math.h>
|
||||
|
||||
1998-11-07 Raja R Harinath <harinath@cs.umn.edu>
|
||||
|
||||
* Theme/gtk/Makefile.am (theme_DATA):
|
||||
Update to new directory contents.
|
||||
* configure.in: Remove.
|
||||
|
||||
Fri Nov 6 17:26:12 1998 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixmap_theme_main.c: Removed some debugging
|
||||
printf's.
|
||||
|
||||
* Theme/gtk/notebook1.c Theme/gtk/menubar.png: new
|
||||
bigger pixmaps to reduce pixelation.
|
||||
|
||||
* Theme/gtk/gtkrc: Reorganized to use several styles
|
||||
instead of one huge style. Change clist backgrounds
|
||||
to be prettier.
|
||||
|
||||
Thu Nov 5 10:23:46 1998 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixmap_theme_draw.c (draw_shadow_gap): Fixed hard-coded
|
||||
gap_side of '0'.
|
||||
|
||||
Mon Nov 2 14:46:02 1998 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixmap_theme_draw.c (apply_theme_image_shadow_gap): Removed
|
||||
several hundred lines of duplicated code with a bit of
|
||||
reoriganization.
|
||||
|
||||
Wed Oct 28 16:18:04 1998 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* pixmap_theme_main.c (theme_symbols): Removed lots
|
||||
and lots of white space.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
INCLUDES = $(GTK_CFLAGS)
|
||||
|
||||
enginedir = $(libdir)/gtk-2.0/$(GTK_VERSION)/engines
|
||||
|
||||
engine_LTLIBRARIES = libpixmap.la
|
||||
|
||||
libpixmap_la_SOURCES = \
|
||||
pixbuf-draw.c \
|
||||
pixbuf-main.c \
|
||||
pixbuf-render.c \
|
||||
pixbuf-rc-style.c \
|
||||
pixbuf-rc-style.h \
|
||||
pixbuf-style.h \
|
||||
pixbuf.h
|
||||
|
||||
libpixmap_la_LDFLAGS = -avoid-version -module
|
||||
libpixmap_la_LIBADD = $(GTK_LIBS)
|
||||
|
||||
dist-hook:
|
||||
cp -pr examples $(distdir); \
|
||||
find $(distdir)/examples -name 'CVS' -print | xargs rm -rf
|
||||
@@ -1,17 +0,0 @@
|
||||
The code in this directory is a GTK+ theme engine based on the earlier
|
||||
pixmap theme engine.
|
||||
|
||||
The config files are meant to be compatible, but instead of rendering
|
||||
using Imlib, it renders using GdkPixbuf. This makes the memory
|
||||
management much more understandable, and also allows us to use
|
||||
GdkPixbuf's high quality scaling.
|
||||
|
||||
Most of the code was reworked/rewritten in the process to make it more
|
||||
understandable and maintainable.
|
||||
|
||||
There are lots of bugs here, a considersable number of bugs. But it's
|
||||
cleaned up a great deal from the older pixmap engine. Please don't
|
||||
make it uglier again.
|
||||
|
||||
Owen Taylor <otaylor@redhat.com>
|
||||
6 February 2000
|
||||
@@ -1,14 +0,0 @@
|
||||
gtk-2.0/triangle-background.png is copyright Owen Taylor, 1997
|
||||
and may be used without restriction as long as this attribution
|
||||
is reproduced.
|
||||
|
||||
images/bc.pnm images/bc-dark.pnm images/bc-light.png are
|
||||
from the BrushedMetalClean theme; I believe Tuomas Kuosmanen
|
||||
and Carsten Haitzler had something to do with the original
|
||||
BrushedMetal artwork.
|
||||
|
||||
This theme is truly hideous for a reason ... to demonstrate
|
||||
that alpha-compositing is going on.
|
||||
|
||||
Owen Taylor
|
||||
19 Jan 2002x
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 836 B |
Binary file not shown.
@@ -1,65 +0,0 @@
|
||||
style "default"
|
||||
{
|
||||
fg[NORMAL] = "#ffffff"
|
||||
fg[PRELIGHT] = "#ffffff"
|
||||
bg_pixmap[NORMAL] = "triangle_background.png"
|
||||
# bg_pixmap[NORMAL] = "bc.png"
|
||||
bg_pixmap[PRELIGHT] = "bc-light.png"
|
||||
bg_pixmap[ACTIVE] = "bc-dark.png" bg_pixmap[INSENSITIVE] = "bc.png"
|
||||
}
|
||||
|
||||
class "GtkWidget" style "default"
|
||||
|
||||
style "bubble-button"
|
||||
{
|
||||
engine "pixmap"
|
||||
{
|
||||
image
|
||||
{
|
||||
function = BOX
|
||||
file = "bubble-blue.png"
|
||||
border = { 8, 8, 8, 8 }
|
||||
stretch = TRUE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# common default
|
||||
class "GtkButton" style "bubble-button"
|
||||
|
||||
style "bubble-range"
|
||||
{
|
||||
GtkRange::slider_width = 16
|
||||
GtkRange::stepper_size = 16
|
||||
|
||||
engine "pixmap"
|
||||
{
|
||||
image
|
||||
{
|
||||
function = BOX
|
||||
file = "bubble-blue.png"
|
||||
border = { 8, 8, 8, 8 }
|
||||
stretch = TRUE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# common default
|
||||
class "GtkRange" style "bubble-range"
|
||||
|
||||
style "bubble-menuitem"
|
||||
{
|
||||
engine "pixmap"
|
||||
{
|
||||
image
|
||||
{
|
||||
function = BOX
|
||||
file = "bubble-blue.png"
|
||||
border = { 8, 8, 8, 8 }
|
||||
stretch = TRUE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# common default
|
||||
class "GtkMenuItem" style "bubble-menuitem"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 57 KiB |
File diff suppressed because it is too large
Load Diff
@@ -1,57 +0,0 @@
|
||||
/* GTK+ Pixbuf Engine
|
||||
* Copyright (C) 1998-2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Written by Owen Taylor <otaylor@redhat.com>, based on code by
|
||||
* Carsten Haitzler <raster@rasterman.com>
|
||||
*/
|
||||
|
||||
#include "pixbuf.h"
|
||||
#include "pixbuf-style.h"
|
||||
#include "pixbuf-rc-style.h"
|
||||
#include <gmodule.h>
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
theme_init (GTypeModule *module)
|
||||
{
|
||||
pixbuf_rc_style_register_type (module);
|
||||
pixbuf_style_register_type (module);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
theme_exit (void)
|
||||
{
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT GtkRcStyle *
|
||||
theme_create_rc_style (void)
|
||||
{
|
||||
return GTK_RC_STYLE (g_object_new (PIXBUF_TYPE_RC_STYLE, NULL));
|
||||
}
|
||||
|
||||
/* The following function will be called by GTK+ when the module
|
||||
* is loaded and checks to see if we are compatible with the
|
||||
* version of GTK+ that loads us.
|
||||
*/
|
||||
G_MODULE_EXPORT const gchar* g_module_check_init (GModule *module);
|
||||
const gchar*
|
||||
g_module_check_init (GModule *module)
|
||||
{
|
||||
return gtk_check_version (GTK_MAJOR_VERSION,
|
||||
GTK_MINOR_VERSION,
|
||||
GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
|
||||
}
|
||||
@@ -1,815 +0,0 @@
|
||||
/* GTK+ Pixbuf Engine
|
||||
* Copyright (C) 1998-2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Written by Owen Taylor <otaylor@redhat.com>, based on code by
|
||||
* Carsten Haitzler <raster@rasterman.com>
|
||||
*/
|
||||
|
||||
#include "pixbuf.h"
|
||||
#include "pixbuf-style.h"
|
||||
#include "pixbuf-rc-style.h"
|
||||
|
||||
static void pixbuf_rc_style_init (PixbufRcStyle *style);
|
||||
static void pixbuf_rc_style_class_init (PixbufRcStyleClass *klass);
|
||||
static void pixbuf_rc_style_finalize (GObject *object);
|
||||
static guint pixbuf_rc_style_parse (GtkRcStyle *rc_style,
|
||||
GtkSettings *settings,
|
||||
GScanner *scanner);
|
||||
static void pixbuf_rc_style_merge (GtkRcStyle *dest,
|
||||
GtkRcStyle *src);
|
||||
static GtkStyle *pixbuf_rc_style_create_style (GtkRcStyle *rc_style);
|
||||
|
||||
static void theme_image_unref (ThemeImage *data);
|
||||
|
||||
static struct
|
||||
{
|
||||
gchar *name;
|
||||
guint token;
|
||||
}
|
||||
theme_symbols[] =
|
||||
{
|
||||
{ "image", TOKEN_IMAGE },
|
||||
{ "function", TOKEN_FUNCTION },
|
||||
{ "file", TOKEN_FILE },
|
||||
{ "stretch", TOKEN_STRETCH },
|
||||
{ "recolorable", TOKEN_RECOLORABLE },
|
||||
{ "border", TOKEN_BORDER },
|
||||
{ "detail", TOKEN_DETAIL },
|
||||
{ "state", TOKEN_STATE },
|
||||
{ "shadow", TOKEN_SHADOW },
|
||||
{ "gap_side", TOKEN_GAP_SIDE },
|
||||
{ "gap_file", TOKEN_GAP_FILE },
|
||||
{ "gap_border", TOKEN_GAP_BORDER },
|
||||
{ "gap_start_file", TOKEN_GAP_START_FILE },
|
||||
{ "gap_start_border", TOKEN_GAP_START_BORDER },
|
||||
{ "gap_end_file", TOKEN_GAP_END_FILE },
|
||||
{ "gap_end_border", TOKEN_GAP_END_BORDER },
|
||||
{ "overlay_file", TOKEN_OVERLAY_FILE },
|
||||
{ "overlay_border", TOKEN_OVERLAY_BORDER },
|
||||
{ "overlay_stretch", TOKEN_OVERLAY_STRETCH },
|
||||
{ "arrow_direction", TOKEN_ARROW_DIRECTION },
|
||||
{ "orientation", TOKEN_ORIENTATION },
|
||||
|
||||
{ "HLINE", TOKEN_D_HLINE },
|
||||
{ "VLINE", TOKEN_D_VLINE },
|
||||
{ "SHADOW", TOKEN_D_SHADOW },
|
||||
{ "POLYGON", TOKEN_D_POLYGON },
|
||||
{ "ARROW", TOKEN_D_ARROW },
|
||||
{ "DIAMOND", TOKEN_D_DIAMOND },
|
||||
{ "OVAL", TOKEN_D_OVAL },
|
||||
{ "STRING", TOKEN_D_STRING },
|
||||
{ "BOX", TOKEN_D_BOX },
|
||||
{ "FLAT_BOX", TOKEN_D_FLAT_BOX },
|
||||
{ "CHECK", TOKEN_D_CHECK },
|
||||
{ "OPTION", TOKEN_D_OPTION },
|
||||
{ "CROSS", TOKEN_D_CROSS },
|
||||
{ "RAMP", TOKEN_D_RAMP },
|
||||
{ "TAB", TOKEN_D_TAB },
|
||||
{ "SHADOW_GAP", TOKEN_D_SHADOW_GAP },
|
||||
{ "BOX_GAP", TOKEN_D_BOX_GAP },
|
||||
{ "EXTENSION", TOKEN_D_EXTENSION },
|
||||
{ "FOCUS", TOKEN_D_FOCUS },
|
||||
{ "SLIDER", TOKEN_D_SLIDER },
|
||||
{ "ENTRY", TOKEN_D_ENTRY },
|
||||
{ "HANDLE", TOKEN_D_HANDLE },
|
||||
{ "STEPPER", TOKEN_D_STEPPER },
|
||||
|
||||
{ "TRUE", TOKEN_TRUE },
|
||||
{ "FALSE", TOKEN_FALSE },
|
||||
|
||||
{ "TOP", TOKEN_TOP },
|
||||
{ "UP", TOKEN_UP },
|
||||
{ "BOTTOM", TOKEN_BOTTOM },
|
||||
{ "DOWN", TOKEN_DOWN },
|
||||
{ "LEFT", TOKEN_LEFT },
|
||||
{ "RIGHT", TOKEN_RIGHT },
|
||||
|
||||
{ "NORMAL", TOKEN_NORMAL },
|
||||
{ "ACTIVE", TOKEN_ACTIVE },
|
||||
{ "PRELIGHT", TOKEN_PRELIGHT },
|
||||
{ "SELECTED", TOKEN_SELECTED },
|
||||
{ "INSENSITIVE", TOKEN_INSENSITIVE },
|
||||
|
||||
{ "NONE", TOKEN_NONE },
|
||||
{ "IN", TOKEN_IN },
|
||||
{ "OUT", TOKEN_OUT },
|
||||
{ "ETCHED_IN", TOKEN_ETCHED_IN },
|
||||
{ "ETCHED_OUT", TOKEN_ETCHED_OUT },
|
||||
{ "HORIZONTAL", TOKEN_HORIZONTAL },
|
||||
{ "VERTICAL", TOKEN_VERTICAL },
|
||||
};
|
||||
|
||||
static GtkRcStyleClass *parent_class;
|
||||
|
||||
GType pixbuf_type_rc_style = 0;
|
||||
|
||||
void
|
||||
pixbuf_rc_style_register_type (GTypeModule *module)
|
||||
{
|
||||
static const GTypeInfo object_info =
|
||||
{
|
||||
sizeof (PixbufRcStyleClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) pixbuf_rc_style_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (PixbufRcStyle),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) pixbuf_rc_style_init,
|
||||
};
|
||||
|
||||
pixbuf_type_rc_style = g_type_module_register_type (module,
|
||||
GTK_TYPE_RC_STYLE,
|
||||
"PixbufRcStyle",
|
||||
&object_info, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_rc_style_init (PixbufRcStyle *style)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_rc_style_class_init (PixbufRcStyleClass *klass)
|
||||
{
|
||||
GtkRcStyleClass *rc_style_class = GTK_RC_STYLE_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
rc_style_class->parse = pixbuf_rc_style_parse;
|
||||
rc_style_class->merge = pixbuf_rc_style_merge;
|
||||
rc_style_class->create_style = pixbuf_rc_style_create_style;
|
||||
|
||||
object_class->finalize = pixbuf_rc_style_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_rc_style_finalize (GObject *object)
|
||||
{
|
||||
PixbufRcStyle *rc_style = PIXBUF_RC_STYLE (object);
|
||||
|
||||
g_list_foreach (rc_style->img_list, (GFunc) theme_image_unref, NULL);
|
||||
g_list_free (rc_style->img_list);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_file(GtkSettings *settings,
|
||||
GScanner *scanner,
|
||||
ThemePixbuf **theme_pb)
|
||||
{
|
||||
guint token;
|
||||
gchar *pixmap;
|
||||
|
||||
/* Skip 'blah_file' */
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_STRING)
|
||||
return G_TOKEN_STRING;
|
||||
|
||||
if (!*theme_pb)
|
||||
*theme_pb = theme_pixbuf_new ();
|
||||
|
||||
pixmap = gtk_rc_find_pixmap_in_path(settings, scanner, scanner->value.v_string);
|
||||
if (pixmap)
|
||||
{
|
||||
theme_pixbuf_set_filename (*theme_pb, pixmap);
|
||||
g_free (pixmap);
|
||||
}
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_border (GScanner *scanner,
|
||||
ThemePixbuf **theme_pb)
|
||||
{
|
||||
guint token;
|
||||
gint left, right, top, bottom;
|
||||
|
||||
/* Skip 'blah_border' */
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_LEFT_CURLY)
|
||||
return G_TOKEN_LEFT_CURLY;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_INT)
|
||||
return G_TOKEN_INT;
|
||||
left = scanner->value.v_int;
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_COMMA)
|
||||
return G_TOKEN_COMMA;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_INT)
|
||||
return G_TOKEN_INT;
|
||||
right = scanner->value.v_int;
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_COMMA)
|
||||
return G_TOKEN_COMMA;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_INT)
|
||||
return G_TOKEN_INT;
|
||||
top = scanner->value.v_int;
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_COMMA)
|
||||
return G_TOKEN_COMMA;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_INT)
|
||||
return G_TOKEN_INT;
|
||||
bottom = scanner->value.v_int;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_RIGHT_CURLY)
|
||||
return G_TOKEN_RIGHT_CURLY;
|
||||
|
||||
if (!*theme_pb)
|
||||
*theme_pb = theme_pixbuf_new ();
|
||||
|
||||
theme_pixbuf_set_border (*theme_pb, left, right, top, bottom);
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_stretch(GScanner *scanner,
|
||||
ThemePixbuf **theme_pb)
|
||||
{
|
||||
guint token;
|
||||
gboolean stretch;
|
||||
|
||||
/* Skip 'blah_stretch' */
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token == TOKEN_TRUE)
|
||||
stretch = TRUE;
|
||||
else if (token == TOKEN_FALSE)
|
||||
stretch = FALSE;
|
||||
else
|
||||
return TOKEN_TRUE;
|
||||
|
||||
if (!*theme_pb)
|
||||
*theme_pb = theme_pixbuf_new ();
|
||||
|
||||
theme_pixbuf_set_stretch (*theme_pb, stretch);
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_recolorable(GScanner * scanner,
|
||||
ThemeImage * data)
|
||||
{
|
||||
guint token;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != TOKEN_RECOLORABLE)
|
||||
return TOKEN_RECOLORABLE;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token == TOKEN_TRUE)
|
||||
data->recolorable = 1;
|
||||
else if (token == TOKEN_FALSE)
|
||||
data->recolorable = 0;
|
||||
else
|
||||
return TOKEN_TRUE;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_function(GScanner * scanner,
|
||||
ThemeImage *data)
|
||||
{
|
||||
guint token;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != TOKEN_FUNCTION)
|
||||
return TOKEN_FUNCTION;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if ((token >= TOKEN_D_HLINE) && (token <= TOKEN_D_STEPPER))
|
||||
data->match_data.function = token;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_detail(GScanner * scanner,
|
||||
ThemeImage * data)
|
||||
{
|
||||
guint token;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != TOKEN_DETAIL)
|
||||
return TOKEN_DETAIL;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_STRING)
|
||||
return G_TOKEN_STRING;
|
||||
|
||||
if (data->match_data.detail)
|
||||
g_free (data->match_data.detail);
|
||||
|
||||
data->match_data.detail = g_strdup(scanner->value.v_string);
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_state(GScanner * scanner,
|
||||
ThemeImage * data)
|
||||
{
|
||||
guint token;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != TOKEN_STATE)
|
||||
return TOKEN_STATE;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token == TOKEN_NORMAL)
|
||||
data->match_data.state = GTK_STATE_NORMAL;
|
||||
else if (token == TOKEN_ACTIVE)
|
||||
data->match_data.state = GTK_STATE_ACTIVE;
|
||||
else if (token == TOKEN_PRELIGHT)
|
||||
data->match_data.state = GTK_STATE_PRELIGHT;
|
||||
else if (token == TOKEN_SELECTED)
|
||||
data->match_data.state = GTK_STATE_SELECTED;
|
||||
else if (token == TOKEN_INSENSITIVE)
|
||||
data->match_data.state = GTK_STATE_INSENSITIVE;
|
||||
else
|
||||
return TOKEN_NORMAL;
|
||||
|
||||
data->match_data.flags |= THEME_MATCH_STATE;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_shadow(GScanner * scanner,
|
||||
ThemeImage * data)
|
||||
{
|
||||
guint token;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != TOKEN_SHADOW)
|
||||
return TOKEN_SHADOW;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token == TOKEN_NONE)
|
||||
data->match_data.shadow = GTK_SHADOW_NONE;
|
||||
else if (token == TOKEN_IN)
|
||||
data->match_data.shadow = GTK_SHADOW_IN;
|
||||
else if (token == TOKEN_OUT)
|
||||
data->match_data.shadow = GTK_SHADOW_OUT;
|
||||
else if (token == TOKEN_ETCHED_IN)
|
||||
data->match_data.shadow = GTK_SHADOW_ETCHED_IN;
|
||||
else if (token == TOKEN_ETCHED_OUT)
|
||||
data->match_data.shadow = GTK_SHADOW_ETCHED_OUT;
|
||||
else
|
||||
return TOKEN_NONE;
|
||||
|
||||
data->match_data.flags |= THEME_MATCH_SHADOW;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_arrow_direction(GScanner * scanner,
|
||||
ThemeImage * data)
|
||||
{
|
||||
guint token;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != TOKEN_ARROW_DIRECTION)
|
||||
return TOKEN_ARROW_DIRECTION;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token == TOKEN_UP)
|
||||
data->match_data.arrow_direction = GTK_ARROW_UP;
|
||||
else if (token == TOKEN_DOWN)
|
||||
data->match_data.arrow_direction = GTK_ARROW_DOWN;
|
||||
else if (token == TOKEN_LEFT)
|
||||
data->match_data.arrow_direction = GTK_ARROW_LEFT;
|
||||
else if (token == TOKEN_RIGHT)
|
||||
data->match_data.arrow_direction = GTK_ARROW_RIGHT;
|
||||
else
|
||||
return TOKEN_UP;
|
||||
|
||||
data->match_data.flags |= THEME_MATCH_ARROW_DIRECTION;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_gap_side(GScanner * scanner,
|
||||
ThemeImage * data)
|
||||
{
|
||||
guint token;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != TOKEN_GAP_SIDE)
|
||||
return TOKEN_GAP_SIDE;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
if (token == TOKEN_TOP)
|
||||
data->match_data.gap_side = GTK_POS_TOP;
|
||||
else if (token == TOKEN_BOTTOM)
|
||||
data->match_data.gap_side = GTK_POS_BOTTOM;
|
||||
else if (token == TOKEN_LEFT)
|
||||
data->match_data.gap_side = GTK_POS_LEFT;
|
||||
else if (token == TOKEN_RIGHT)
|
||||
data->match_data.gap_side = GTK_POS_RIGHT;
|
||||
else
|
||||
return TOKEN_TOP;
|
||||
|
||||
data->match_data.flags |= THEME_MATCH_GAP_SIDE;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_orientation(GScanner * scanner,
|
||||
ThemeImage * data)
|
||||
{
|
||||
guint token;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != TOKEN_ORIENTATION)
|
||||
return TOKEN_ORIENTATION;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return G_TOKEN_EQUAL_SIGN;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
if (token == TOKEN_HORIZONTAL)
|
||||
data->match_data.orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
else if (token == TOKEN_VERTICAL)
|
||||
data->match_data.orientation = GTK_ORIENTATION_VERTICAL;
|
||||
else
|
||||
return TOKEN_HORIZONTAL;
|
||||
|
||||
data->match_data.flags |= THEME_MATCH_ORIENTATION;
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
theme_image_ref (ThemeImage *data)
|
||||
{
|
||||
data->refcount++;
|
||||
}
|
||||
|
||||
static void
|
||||
theme_image_unref (ThemeImage *data)
|
||||
{
|
||||
data->refcount--;
|
||||
if (data->refcount == 0)
|
||||
{
|
||||
if (data->match_data.detail)
|
||||
g_free (data->match_data.detail);
|
||||
if (data->background)
|
||||
theme_pixbuf_destroy (data->background);
|
||||
if (data->overlay)
|
||||
theme_pixbuf_destroy (data->overlay);
|
||||
if (data->gap_start)
|
||||
theme_pixbuf_destroy (data->gap_start);
|
||||
if (data->gap)
|
||||
theme_pixbuf_destroy (data->gap);
|
||||
if (data->gap_end)
|
||||
theme_pixbuf_destroy (data->gap_end);
|
||||
g_free (data);
|
||||
}
|
||||
}
|
||||
|
||||
static guint
|
||||
theme_parse_image(GtkSettings *settings,
|
||||
GScanner *scanner,
|
||||
PixbufRcStyle *pixbuf_style,
|
||||
ThemeImage **data_return)
|
||||
{
|
||||
guint token;
|
||||
ThemeImage *data;
|
||||
|
||||
data = NULL;
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != TOKEN_IMAGE)
|
||||
return TOKEN_IMAGE;
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
if (token != G_TOKEN_LEFT_CURLY)
|
||||
return G_TOKEN_LEFT_CURLY;
|
||||
|
||||
data = g_malloc(sizeof(ThemeImage));
|
||||
|
||||
data->refcount = 1;
|
||||
|
||||
data->background = NULL;
|
||||
data->overlay = NULL;
|
||||
data->gap_start = NULL;
|
||||
data->gap = NULL;
|
||||
data->gap_end = NULL;
|
||||
|
||||
data->recolorable = FALSE;
|
||||
|
||||
data->match_data.function = 0;
|
||||
data->match_data.detail = NULL;
|
||||
data->match_data.flags = 0;
|
||||
|
||||
token = g_scanner_peek_next_token(scanner);
|
||||
while (token != G_TOKEN_RIGHT_CURLY)
|
||||
{
|
||||
switch (token)
|
||||
{
|
||||
case TOKEN_FUNCTION:
|
||||
token = theme_parse_function(scanner, data);
|
||||
break;
|
||||
case TOKEN_RECOLORABLE:
|
||||
token = theme_parse_recolorable(scanner, data);
|
||||
break;
|
||||
case TOKEN_DETAIL:
|
||||
token = theme_parse_detail(scanner, data);
|
||||
break;
|
||||
case TOKEN_STATE:
|
||||
token = theme_parse_state(scanner, data);
|
||||
break;
|
||||
case TOKEN_SHADOW:
|
||||
token = theme_parse_shadow(scanner, data);
|
||||
break;
|
||||
case TOKEN_GAP_SIDE:
|
||||
token = theme_parse_gap_side(scanner, data);
|
||||
break;
|
||||
case TOKEN_ARROW_DIRECTION:
|
||||
token = theme_parse_arrow_direction(scanner, data);
|
||||
break;
|
||||
case TOKEN_ORIENTATION:
|
||||
token = theme_parse_orientation(scanner, data);
|
||||
break;
|
||||
case TOKEN_FILE:
|
||||
token = theme_parse_file(settings, scanner, &data->background);
|
||||
break;
|
||||
case TOKEN_BORDER:
|
||||
token = theme_parse_border(scanner, &data->background);
|
||||
break;
|
||||
case TOKEN_STRETCH:
|
||||
token = theme_parse_stretch(scanner, &data->background);
|
||||
break;
|
||||
case TOKEN_GAP_FILE:
|
||||
token = theme_parse_file(settings, scanner, &data->gap);
|
||||
break;
|
||||
case TOKEN_GAP_BORDER:
|
||||
token = theme_parse_border(scanner, &data->gap);
|
||||
break;
|
||||
case TOKEN_GAP_START_FILE:
|
||||
token = theme_parse_file(settings, scanner, &data->gap_start);
|
||||
break;
|
||||
case TOKEN_GAP_START_BORDER:
|
||||
token = theme_parse_border(scanner, &data->gap_start);
|
||||
break;
|
||||
case TOKEN_GAP_END_FILE:
|
||||
token = theme_parse_file(settings, scanner, &data->gap_end);
|
||||
break;
|
||||
case TOKEN_GAP_END_BORDER:
|
||||
token = theme_parse_border(scanner, &data->gap_end);
|
||||
break;
|
||||
case TOKEN_OVERLAY_FILE:
|
||||
token = theme_parse_file(settings, scanner, &data->overlay);
|
||||
break;
|
||||
case TOKEN_OVERLAY_BORDER:
|
||||
token = theme_parse_border(scanner, &data->overlay);
|
||||
break;
|
||||
case TOKEN_OVERLAY_STRETCH:
|
||||
token = theme_parse_stretch(scanner, &data->overlay);
|
||||
break;
|
||||
default:
|
||||
g_scanner_get_next_token(scanner);
|
||||
token = G_TOKEN_RIGHT_CURLY;
|
||||
break;
|
||||
}
|
||||
if (token != G_TOKEN_NONE)
|
||||
{
|
||||
/* error - cleanup for exit */
|
||||
theme_image_unref (data);
|
||||
*data_return = NULL;
|
||||
return token;
|
||||
}
|
||||
token = g_scanner_peek_next_token(scanner);
|
||||
}
|
||||
|
||||
token = g_scanner_get_next_token(scanner);
|
||||
|
||||
if (data->background && !data->background->filename)
|
||||
{
|
||||
g_scanner_warn (scanner, "Background image options specified without filename");
|
||||
theme_pixbuf_destroy (data->background);
|
||||
data->background = NULL;
|
||||
}
|
||||
|
||||
if (data->overlay && !data->overlay->filename)
|
||||
{
|
||||
g_scanner_warn (scanner, "Overlay image options specified without filename");
|
||||
theme_pixbuf_destroy (data->overlay);
|
||||
data->overlay = NULL;
|
||||
}
|
||||
|
||||
if (token != G_TOKEN_RIGHT_CURLY)
|
||||
{
|
||||
/* error - cleanup for exit */
|
||||
theme_image_unref (data);
|
||||
*data_return = NULL;
|
||||
return G_TOKEN_RIGHT_CURLY;
|
||||
}
|
||||
|
||||
/* everything is fine now - insert yer cruft */
|
||||
*data_return = data;
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static guint
|
||||
pixbuf_rc_style_parse (GtkRcStyle *rc_style,
|
||||
GtkSettings *settings,
|
||||
GScanner *scanner)
|
||||
|
||||
{
|
||||
static GQuark scope_id = 0;
|
||||
PixbufRcStyle *pixbuf_style = PIXBUF_RC_STYLE (rc_style);
|
||||
|
||||
guint old_scope;
|
||||
guint token;
|
||||
gint i;
|
||||
ThemeImage *img;
|
||||
|
||||
/* Set up a new scope in this scanner. */
|
||||
|
||||
if (!scope_id)
|
||||
scope_id = g_quark_from_string("pixbuf_theme_engine");
|
||||
|
||||
/* If we bail out due to errors, we *don't* reset the scope, so the
|
||||
* error messaging code can make sense of our tokens.
|
||||
*/
|
||||
old_scope = g_scanner_set_scope(scanner, scope_id);
|
||||
|
||||
/* Now check if we already added our symbols to this scope
|
||||
* (in some previous call to theme_parse_rc_style for the
|
||||
* same scanner.
|
||||
*/
|
||||
|
||||
if (!g_scanner_lookup_symbol(scanner, theme_symbols[0].name))
|
||||
{
|
||||
g_scanner_freeze_symbol_table(scanner);
|
||||
for (i = 0; i < G_N_ELEMENTS (theme_symbols); i++)
|
||||
g_scanner_scope_add_symbol(scanner, scope_id,
|
||||
theme_symbols[i].name,
|
||||
GINT_TO_POINTER(theme_symbols[i].token));
|
||||
g_scanner_thaw_symbol_table(scanner);
|
||||
}
|
||||
|
||||
/* We're ready to go, now parse the top level */
|
||||
|
||||
token = g_scanner_peek_next_token(scanner);
|
||||
while (token != G_TOKEN_RIGHT_CURLY)
|
||||
{
|
||||
switch (token)
|
||||
{
|
||||
case TOKEN_IMAGE:
|
||||
img = NULL;
|
||||
token = theme_parse_image(settings, scanner, pixbuf_style, &img);
|
||||
break;
|
||||
default:
|
||||
g_scanner_get_next_token(scanner);
|
||||
token = G_TOKEN_RIGHT_CURLY;
|
||||
break;
|
||||
}
|
||||
|
||||
if (token != G_TOKEN_NONE)
|
||||
return token;
|
||||
else
|
||||
pixbuf_style->img_list = g_list_append(pixbuf_style->img_list, img);
|
||||
|
||||
token = g_scanner_peek_next_token(scanner);
|
||||
}
|
||||
|
||||
g_scanner_get_next_token(scanner);
|
||||
|
||||
g_scanner_set_scope(scanner, old_scope);
|
||||
|
||||
return G_TOKEN_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_rc_style_merge (GtkRcStyle *dest,
|
||||
GtkRcStyle *src)
|
||||
{
|
||||
if (PIXBUF_IS_RC_STYLE (src))
|
||||
{
|
||||
PixbufRcStyle *pixbuf_dest = PIXBUF_RC_STYLE (dest);
|
||||
PixbufRcStyle *pixbuf_src = PIXBUF_RC_STYLE (src);
|
||||
GList *tmp_list1, *tmp_list2;
|
||||
|
||||
if (pixbuf_src->img_list)
|
||||
{
|
||||
/* Copy src image list and append to dest image list */
|
||||
|
||||
tmp_list2 = g_list_last (pixbuf_dest->img_list);
|
||||
tmp_list1 = pixbuf_src->img_list;
|
||||
|
||||
while (tmp_list1)
|
||||
{
|
||||
if (tmp_list2)
|
||||
{
|
||||
tmp_list2->next = g_list_alloc();
|
||||
tmp_list2->next->data = tmp_list1->data;
|
||||
tmp_list2->next->prev = tmp_list2;
|
||||
|
||||
tmp_list2 = tmp_list2->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixbuf_dest->img_list = g_list_append (NULL, tmp_list1->data);
|
||||
tmp_list2 = pixbuf_dest->img_list;
|
||||
}
|
||||
|
||||
theme_image_ref (tmp_list1->data);
|
||||
tmp_list1 = tmp_list1->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent_class->merge (dest, src);
|
||||
}
|
||||
|
||||
/* Create an empty style suitable to this RC style
|
||||
*/
|
||||
static GtkStyle *
|
||||
pixbuf_rc_style_create_style (GtkRcStyle *rc_style)
|
||||
{
|
||||
return GTK_STYLE (g_object_new (PIXBUF_TYPE_STYLE, NULL));
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/* GTK+ Pixbuf Engine
|
||||
* Copyright (C) 1998-2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Written by Owen Taylor <otaylor@redhat.com>, based on code by
|
||||
* Carsten Haitzler <raster@rasterman.com>
|
||||
*/
|
||||
|
||||
#include <gtk/gtkrc.h>
|
||||
|
||||
typedef struct _PixbufRcStyle PixbufRcStyle;
|
||||
typedef struct _PixbufRcStyleClass PixbufRcStyleClass;
|
||||
|
||||
extern GType pixbuf_type_rc_style;
|
||||
|
||||
#define PIXBUF_TYPE_RC_STYLE pixbuf_type_rc_style
|
||||
#define PIXBUF_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PIXBUF_TYPE_RC_STYLE, PixbufRcStyle))
|
||||
#define PIXBUF_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIXBUF_TYPE_RC_STYLE, PixbufRcStyleClass))
|
||||
#define PIXBUF_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PIXBUF_TYPE_RC_STYLE))
|
||||
#define PIXBUF_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIXBUF_TYPE_RC_STYLE))
|
||||
#define PIXBUF_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIXBUF_TYPE_RC_STYLE, PixbufRcStyleClass))
|
||||
|
||||
struct _PixbufRcStyle
|
||||
{
|
||||
GtkRcStyle parent_instance;
|
||||
|
||||
GList *img_list;
|
||||
};
|
||||
|
||||
struct _PixbufRcStyleClass
|
||||
{
|
||||
GtkRcStyleClass parent_class;
|
||||
};
|
||||
|
||||
void pixbuf_rc_style_register_type (GTypeModule *module);
|
||||
@@ -1,803 +0,0 @@
|
||||
/* GTK+ Pixbuf Engine
|
||||
* Copyright (C) 1998-2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Written by Owen Taylor <otaylor@redhat.com>, based on code by
|
||||
* Carsten Haitzler <raster@rasterman.com>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "pixbuf.h"
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
GCache *pixbuf_cache = NULL;
|
||||
|
||||
static GdkPixbuf *
|
||||
bilinear_gradient (GdkPixbuf *src,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
guint n_channels = gdk_pixbuf_get_n_channels (src);
|
||||
guint src_rowstride = gdk_pixbuf_get_rowstride (src);
|
||||
guchar *src_pixels = gdk_pixbuf_get_pixels (src);
|
||||
guchar *p1, *p2, *p3, *p4;
|
||||
guint dest_rowstride;
|
||||
guchar *dest_pixels;
|
||||
GdkPixbuf *result;
|
||||
int i, j, k;
|
||||
|
||||
p1 = src_pixels + (src_y - 1) * src_rowstride + (src_x - 1) * n_channels;
|
||||
p2 = p1 + n_channels;
|
||||
p3 = src_pixels + src_y * src_rowstride + (src_x - 1) * n_channels;
|
||||
p4 = p3 + n_channels;
|
||||
|
||||
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
|
||||
width, height);
|
||||
dest_rowstride = gdk_pixbuf_get_rowstride (result);
|
||||
dest_pixels = gdk_pixbuf_get_pixels (result);
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
guchar *p = dest_pixels + dest_rowstride *i;
|
||||
guint v[4];
|
||||
gint dv[4];
|
||||
|
||||
for (k = 0; k < n_channels; k++)
|
||||
{
|
||||
guint start = ((height - i) * p1[k] + (1 + i) * p3[k]) / (height + 1);
|
||||
guint end = ((height - i) * p2[k] + (1 + i) * p4[k]) / (height + 1);
|
||||
|
||||
dv[k] = (((gint)end - (gint)start) << 16) / (width + 1);
|
||||
v[k] = (start << 16) + dv[k] + 0x8000;
|
||||
}
|
||||
|
||||
for (j = width; j; j--)
|
||||
{
|
||||
for (k = 0; k < n_channels; k++)
|
||||
{
|
||||
*(p++) = v[k] >> 16;
|
||||
v[k] += dv[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
horizontal_gradient (GdkPixbuf *src,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
guint n_channels = gdk_pixbuf_get_n_channels (src);
|
||||
guint src_rowstride = gdk_pixbuf_get_rowstride (src);
|
||||
guchar *src_pixels = gdk_pixbuf_get_pixels (src);
|
||||
guint dest_rowstride;
|
||||
guchar *dest_pixels;
|
||||
GdkPixbuf *result;
|
||||
int i, j, k;
|
||||
|
||||
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
|
||||
width, height);
|
||||
dest_rowstride = gdk_pixbuf_get_rowstride (result);
|
||||
dest_pixels = gdk_pixbuf_get_pixels (result);
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
guchar *p = dest_pixels + dest_rowstride *i;
|
||||
guchar *p1 = src_pixels + (src_y + i) * src_rowstride + (src_x - 1) * n_channels;
|
||||
guchar *p2 = p1 + n_channels;
|
||||
|
||||
guint v[4];
|
||||
gint dv[4];
|
||||
|
||||
for (k = 0; k < n_channels; k++)
|
||||
{
|
||||
dv[k] = (((gint)p2[k] - (gint)p1[k]) << 16) / (width + 1);
|
||||
v[k] = (p1[k] << 16) + dv[k] + 0x8000;
|
||||
}
|
||||
|
||||
for (j = width; j; j--)
|
||||
{
|
||||
for (k = 0; k < n_channels; k++)
|
||||
{
|
||||
*(p++) = v[k] >> 16;
|
||||
v[k] += dv[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
vertical_gradient (GdkPixbuf *src,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
guint n_channels = gdk_pixbuf_get_n_channels (src);
|
||||
guint src_rowstride = gdk_pixbuf_get_rowstride (src);
|
||||
guchar *src_pixels = gdk_pixbuf_get_pixels (src);
|
||||
guchar *top_pixels, *bottom_pixels;
|
||||
guint dest_rowstride;
|
||||
guchar *dest_pixels;
|
||||
GdkPixbuf *result;
|
||||
int i, j;
|
||||
|
||||
top_pixels = src_pixels + (src_y - 1) * src_rowstride + (src_x) * n_channels;
|
||||
bottom_pixels = top_pixels + src_rowstride;
|
||||
|
||||
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
|
||||
width, height);
|
||||
dest_rowstride = gdk_pixbuf_get_rowstride (result);
|
||||
dest_pixels = gdk_pixbuf_get_pixels (result);
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
guchar *p = dest_pixels + dest_rowstride *i;
|
||||
guchar *p1 = top_pixels;
|
||||
guchar *p2 = bottom_pixels;
|
||||
|
||||
for (j = width * n_channels; j; j--)
|
||||
*(p++) = ((height - i) * *(p1++) + (1 + i) * *(p2++)) / (height + 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
replicate_single (GdkPixbuf *src,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
guint n_channels = gdk_pixbuf_get_n_channels (src);
|
||||
guchar *pixels = (gdk_pixbuf_get_pixels (src) +
|
||||
src_y * gdk_pixbuf_get_rowstride (src) +
|
||||
src_x * n_channels);
|
||||
guchar r = *(pixels++);
|
||||
guchar g = *(pixels++);
|
||||
guchar b = *(pixels++);
|
||||
guint dest_rowstride;
|
||||
guchar *dest_pixels;
|
||||
guchar a = 0;
|
||||
GdkPixbuf *result;
|
||||
int i, j;
|
||||
|
||||
if (n_channels == 4)
|
||||
a = *(pixels++);
|
||||
|
||||
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
|
||||
width, height);
|
||||
dest_rowstride = gdk_pixbuf_get_rowstride (result);
|
||||
dest_pixels = gdk_pixbuf_get_pixels (result);
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
guchar *p = dest_pixels + dest_rowstride *i;
|
||||
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
*(p++) = r;
|
||||
*(p++) = g;
|
||||
*(p++) = b;
|
||||
|
||||
if (n_channels == 4)
|
||||
*(p++) = a;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
replicate_rows (GdkPixbuf *src,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
guint n_channels = gdk_pixbuf_get_n_channels (src);
|
||||
guint src_rowstride = gdk_pixbuf_get_rowstride (src);
|
||||
guchar *pixels = (gdk_pixbuf_get_pixels (src) + src_y * src_rowstride + src_x * n_channels);
|
||||
guchar *dest_pixels;
|
||||
GdkPixbuf *result;
|
||||
guint dest_rowstride;
|
||||
int i;
|
||||
|
||||
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
|
||||
width, height);
|
||||
dest_rowstride = gdk_pixbuf_get_rowstride (result);
|
||||
dest_pixels = gdk_pixbuf_get_pixels (result);
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
memcpy (dest_pixels + dest_rowstride * i, pixels, n_channels * width);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
replicate_cols (GdkPixbuf *src,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
guint n_channels = gdk_pixbuf_get_n_channels (src);
|
||||
guint src_rowstride = gdk_pixbuf_get_rowstride (src);
|
||||
guchar *pixels = (gdk_pixbuf_get_pixels (src) + src_y * src_rowstride + src_x * n_channels);
|
||||
guchar *dest_pixels;
|
||||
GdkPixbuf *result;
|
||||
guint dest_rowstride;
|
||||
int i, j;
|
||||
|
||||
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
|
||||
width, height);
|
||||
dest_rowstride = gdk_pixbuf_get_rowstride (result);
|
||||
dest_pixels = gdk_pixbuf_get_pixels (result);
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
guchar *p = dest_pixels + dest_rowstride * i;
|
||||
guchar *q = pixels + src_rowstride * i;
|
||||
|
||||
guchar r = *(q++);
|
||||
guchar g = *(q++);
|
||||
guchar b = *(q++);
|
||||
guchar a = 0;
|
||||
|
||||
if (n_channels == 4)
|
||||
a = *(q++);
|
||||
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
*(p++) = r;
|
||||
*(p++) = g;
|
||||
*(p++) = b;
|
||||
|
||||
if (n_channels == 4)
|
||||
*(p++) = a;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Scale the rectangle (src_x, src_y, src_width, src_height)
|
||||
* onto the rectangle (dest_x, dest_y, dest_width, dest_height)
|
||||
* of the destination, clip by clip_rect and render
|
||||
*/
|
||||
static void
|
||||
pixbuf_render (GdkPixbuf *src,
|
||||
guint hints,
|
||||
GdkWindow *window,
|
||||
GdkBitmap *mask,
|
||||
GdkRectangle *clip_rect,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_width,
|
||||
gint src_height,
|
||||
gint dest_x,
|
||||
gint dest_y,
|
||||
gint dest_width,
|
||||
gint dest_height)
|
||||
{
|
||||
GdkPixbuf *tmp_pixbuf;
|
||||
GdkRectangle rect;
|
||||
int x_offset, y_offset;
|
||||
gboolean has_alpha = gdk_pixbuf_get_has_alpha (src);
|
||||
gint src_rowstride = gdk_pixbuf_get_rowstride (src);
|
||||
gint src_n_channels = gdk_pixbuf_get_n_channels (src);
|
||||
|
||||
if (dest_width <= 0 || dest_height <= 0)
|
||||
return;
|
||||
|
||||
rect.x = dest_x;
|
||||
rect.y = dest_y;
|
||||
rect.width = dest_width;
|
||||
rect.height = dest_height;
|
||||
|
||||
if (hints & THEME_MISSING)
|
||||
return;
|
||||
|
||||
/* FIXME: Because we use the mask to shape windows, we don't use
|
||||
* clip_rect to clip what we draw to the mask, only to clip
|
||||
* what we actually draw. But this leads to the horrible ineffiency
|
||||
* of scale the whole image to get a little bit of it.
|
||||
*/
|
||||
if (!mask && clip_rect)
|
||||
{
|
||||
if (!gdk_rectangle_intersect (clip_rect, &rect, &rect))
|
||||
return;
|
||||
}
|
||||
|
||||
if (dest_width == src_width && dest_height == src_height)
|
||||
{
|
||||
tmp_pixbuf = g_object_ref (src);
|
||||
|
||||
x_offset = src_x + rect.x - dest_x;
|
||||
y_offset = src_y + rect.y - dest_y;
|
||||
}
|
||||
else if (src_width == 0 && src_height == 0)
|
||||
{
|
||||
tmp_pixbuf = bilinear_gradient (src, src_x, src_y, dest_width, dest_height);
|
||||
|
||||
x_offset = rect.x - dest_x;
|
||||
y_offset = rect.y - dest_y;
|
||||
}
|
||||
else if (src_width == 0 && dest_height == src_height)
|
||||
{
|
||||
tmp_pixbuf = horizontal_gradient (src, src_x, src_y, dest_width, dest_height);
|
||||
|
||||
x_offset = rect.x - dest_x;
|
||||
y_offset = rect.y - dest_y;
|
||||
}
|
||||
else if (src_height == 0 && dest_width == src_width)
|
||||
{
|
||||
tmp_pixbuf = vertical_gradient (src, src_x, src_y, dest_width, dest_height);
|
||||
|
||||
x_offset = rect.x - dest_x;
|
||||
y_offset = rect.y - dest_y;
|
||||
}
|
||||
else if ((hints & THEME_CONSTANT_COLS) && (hints & THEME_CONSTANT_ROWS))
|
||||
{
|
||||
tmp_pixbuf = replicate_single (src, src_x, src_y, dest_width, dest_height);
|
||||
|
||||
x_offset = rect.x - dest_x;
|
||||
y_offset = rect.y - dest_y;
|
||||
}
|
||||
else if (dest_width == src_width && (hints & THEME_CONSTANT_COLS))
|
||||
{
|
||||
tmp_pixbuf = replicate_rows (src, src_x, src_y, dest_width, dest_height);
|
||||
|
||||
x_offset = rect.x - dest_x;
|
||||
y_offset = rect.y - dest_y;
|
||||
}
|
||||
else if (dest_height == src_height && (hints & THEME_CONSTANT_ROWS))
|
||||
{
|
||||
tmp_pixbuf = replicate_cols (src, src_x, src_y, dest_width, dest_height);
|
||||
|
||||
x_offset = rect.x - dest_x;
|
||||
y_offset = rect.y - dest_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
double x_scale = (double)dest_width / src_width;
|
||||
double y_scale = (double)dest_height / src_height;
|
||||
guchar *pixels;
|
||||
GdkPixbuf *partial_src;
|
||||
|
||||
pixels = (gdk_pixbuf_get_pixels (src)
|
||||
+ src_y * src_rowstride
|
||||
+ src_x * src_n_channels);
|
||||
|
||||
partial_src = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB,
|
||||
has_alpha,
|
||||
8, src_width, src_height,
|
||||
src_rowstride,
|
||||
NULL, NULL);
|
||||
|
||||
tmp_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
||||
has_alpha, 8,
|
||||
rect.width, rect.height);
|
||||
|
||||
gdk_pixbuf_scale (partial_src, tmp_pixbuf,
|
||||
0, 0, rect.width, rect.height,
|
||||
dest_x - rect.x, dest_y - rect.y,
|
||||
x_scale, y_scale,
|
||||
GDK_INTERP_BILINEAR);
|
||||
|
||||
gdk_pixbuf_unref (partial_src);
|
||||
|
||||
x_offset = 0;
|
||||
y_offset = 0;
|
||||
}
|
||||
|
||||
if (mask)
|
||||
{
|
||||
gdk_pixbuf_render_threshold_alpha (tmp_pixbuf, mask,
|
||||
x_offset, y_offset,
|
||||
rect.x, rect.y,
|
||||
rect.width, rect.height,
|
||||
128);
|
||||
}
|
||||
|
||||
gdk_pixbuf_render_to_drawable_alpha (tmp_pixbuf, window,
|
||||
x_offset, y_offset,
|
||||
rect.x, rect.y,
|
||||
rect.width, rect.height,
|
||||
GDK_PIXBUF_ALPHA_FULL, 128,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
0, 0);
|
||||
gdk_pixbuf_unref (tmp_pixbuf);
|
||||
}
|
||||
|
||||
ThemePixbuf *
|
||||
theme_pixbuf_new (void)
|
||||
{
|
||||
ThemePixbuf *result = g_new0 (ThemePixbuf, 1);
|
||||
result->filename = NULL;
|
||||
result->pixbuf = NULL;
|
||||
|
||||
result->stretch = TRUE;
|
||||
result->border_left = 0;
|
||||
result->border_right = 0;
|
||||
result->border_bottom = 0;
|
||||
result->border_top = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
theme_pixbuf_destroy (ThemePixbuf *theme_pb)
|
||||
{
|
||||
theme_pixbuf_set_filename (theme_pb, NULL);
|
||||
g_free (theme_pb);
|
||||
}
|
||||
|
||||
void
|
||||
theme_pixbuf_set_filename (ThemePixbuf *theme_pb,
|
||||
const char *filename)
|
||||
{
|
||||
if (theme_pb->pixbuf)
|
||||
{
|
||||
g_cache_remove (pixbuf_cache, theme_pb->pixbuf);
|
||||
theme_pb->pixbuf = NULL;
|
||||
}
|
||||
|
||||
if (theme_pb->filename)
|
||||
g_free (theme_pb->filename);
|
||||
|
||||
if (filename)
|
||||
theme_pb->filename = g_strdup (filename);
|
||||
else
|
||||
theme_pb->filename = NULL;
|
||||
}
|
||||
|
||||
static guint
|
||||
compute_hint (GdkPixbuf *pixbuf,
|
||||
gint x0,
|
||||
gint x1,
|
||||
gint y0,
|
||||
gint y1)
|
||||
{
|
||||
int i, j;
|
||||
int hints = THEME_CONSTANT_ROWS | THEME_CONSTANT_COLS | THEME_MISSING;
|
||||
int n_channels = gdk_pixbuf_get_n_channels (pixbuf);
|
||||
|
||||
guchar *data = gdk_pixbuf_get_pixels (pixbuf);
|
||||
int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
|
||||
if (x0 == x1 || y0 == y1)
|
||||
return 0;
|
||||
|
||||
for (i = y0; i < y1; i++)
|
||||
{
|
||||
guchar *p = data + i * rowstride + x0 * n_channels;
|
||||
guchar r = p[0];
|
||||
guchar g = p[1];
|
||||
guchar b = p[2];
|
||||
guchar a = 0;
|
||||
|
||||
if (n_channels == 4)
|
||||
a = p[3];
|
||||
|
||||
for (j = x0; j < x1 ; j++)
|
||||
{
|
||||
if (n_channels != 4 || p[3] != 0)
|
||||
{
|
||||
hints &= ~THEME_MISSING;
|
||||
if (!(hints & THEME_CONSTANT_ROWS))
|
||||
goto cols;
|
||||
}
|
||||
|
||||
if (r != *(p++) ||
|
||||
g != *(p++) ||
|
||||
b != *(p++) ||
|
||||
(n_channels != 4 && a != *(p++)))
|
||||
{
|
||||
hints &= ~THEME_CONSTANT_ROWS;
|
||||
if (!(hints & THEME_MISSING))
|
||||
goto cols;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cols:
|
||||
for (i = y0 + 1; i < y1; i++)
|
||||
{
|
||||
guchar *base = data + y0 * rowstride + x0 * n_channels;
|
||||
guchar *p = data + i * rowstride + x0 * n_channels;
|
||||
|
||||
if (memcmp (p, base, n_channels * (x1 - x0)) != 0)
|
||||
{
|
||||
hints &= ~THEME_CONSTANT_COLS;
|
||||
return hints;
|
||||
}
|
||||
}
|
||||
|
||||
return hints;
|
||||
}
|
||||
|
||||
static void
|
||||
theme_pixbuf_compute_hints (ThemePixbuf *theme_pb)
|
||||
{
|
||||
int i, j;
|
||||
gint width = gdk_pixbuf_get_width (theme_pb->pixbuf);
|
||||
gint height = gdk_pixbuf_get_height (theme_pb->pixbuf);
|
||||
|
||||
if (theme_pb->border_left + theme_pb->border_right > width ||
|
||||
theme_pb->border_top + theme_pb->border_bottom > height)
|
||||
{
|
||||
g_warning ("Invalid borders specified for theme pixmap:\n"
|
||||
" %s,\n"
|
||||
"borders don't fit within the image", theme_pb->filename);
|
||||
if (theme_pb->border_left + theme_pb->border_right > width)
|
||||
{
|
||||
theme_pb->border_left = width / 2;
|
||||
theme_pb->border_right = (width + 1) / 2;
|
||||
}
|
||||
if (theme_pb->border_bottom + theme_pb->border_top > height)
|
||||
{
|
||||
theme_pb->border_top = height / 2;
|
||||
theme_pb->border_bottom = (height + 1) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
gint y0, y1;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
y0 = 0;
|
||||
y1 = theme_pb->border_top;
|
||||
break;
|
||||
case 1:
|
||||
y0 = theme_pb->border_top;
|
||||
y1 = height - theme_pb->border_bottom;
|
||||
break;
|
||||
default:
|
||||
y0 = height - theme_pb->border_bottom;
|
||||
y1 = height;
|
||||
break;
|
||||
}
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
gint x0, x1;
|
||||
|
||||
switch (j)
|
||||
{
|
||||
case 0:
|
||||
x0 = 0;
|
||||
x1 = theme_pb->border_left;
|
||||
break;
|
||||
case 1:
|
||||
x0 = theme_pb->border_left;
|
||||
x1 = width - theme_pb->border_right;
|
||||
break;
|
||||
default:
|
||||
x0 = width - theme_pb->border_right;
|
||||
x1 = width;
|
||||
break;
|
||||
}
|
||||
|
||||
theme_pb->hints[i][j] = compute_hint (theme_pb->pixbuf, x0, x1, y0, y1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
theme_pixbuf_set_border (ThemePixbuf *theme_pb,
|
||||
gint left,
|
||||
gint right,
|
||||
gint top,
|
||||
gint bottom)
|
||||
{
|
||||
theme_pb->border_left = left;
|
||||
theme_pb->border_right = right;
|
||||
theme_pb->border_top = top;
|
||||
theme_pb->border_bottom = bottom;
|
||||
|
||||
if (theme_pb->pixbuf)
|
||||
theme_pixbuf_compute_hints (theme_pb);
|
||||
}
|
||||
|
||||
void
|
||||
theme_pixbuf_set_stretch (ThemePixbuf *theme_pb,
|
||||
gboolean stretch)
|
||||
{
|
||||
theme_pb->stretch = stretch;
|
||||
|
||||
if (theme_pb->pixbuf)
|
||||
theme_pixbuf_compute_hints (theme_pb);
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
pixbuf_cache_value_new (gchar *filename)
|
||||
{
|
||||
GError *err = NULL;
|
||||
|
||||
GdkPixbuf *result = gdk_pixbuf_new_from_file (filename, &err);
|
||||
if (!result)
|
||||
{
|
||||
g_warning ("Pixbuf theme: Cannot load pixmap file %s: %s\n",
|
||||
filename, err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
theme_pixbuf_get_pixbuf (ThemePixbuf *theme_pb)
|
||||
{
|
||||
if (!theme_pb->pixbuf)
|
||||
{
|
||||
if (!pixbuf_cache)
|
||||
pixbuf_cache = g_cache_new ((GCacheNewFunc)pixbuf_cache_value_new,
|
||||
(GCacheDestroyFunc)gdk_pixbuf_unref,
|
||||
(GCacheDupFunc)g_strdup,
|
||||
(GCacheDestroyFunc)g_free,
|
||||
g_str_hash, g_direct_hash, g_str_equal);
|
||||
|
||||
theme_pb->pixbuf = g_cache_insert (pixbuf_cache, theme_pb->filename);
|
||||
|
||||
if (theme_pb->stretch)
|
||||
theme_pixbuf_compute_hints (theme_pb);
|
||||
}
|
||||
|
||||
return theme_pb->pixbuf;
|
||||
}
|
||||
|
||||
void
|
||||
theme_pixbuf_render (ThemePixbuf *theme_pb,
|
||||
GdkWindow *window,
|
||||
GdkBitmap *mask,
|
||||
GdkRectangle *clip_rect,
|
||||
guint component_mask,
|
||||
gboolean center,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkPixbuf *pixbuf = theme_pixbuf_get_pixbuf (theme_pb);
|
||||
gint src_x[4], src_y[4], dest_x[4], dest_y[4];
|
||||
gint pixbuf_width = gdk_pixbuf_get_width (pixbuf);
|
||||
gint pixbuf_height = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
if (!pixbuf)
|
||||
return;
|
||||
|
||||
if (theme_pb->stretch)
|
||||
{
|
||||
src_x[0] = 0;
|
||||
src_x[1] = theme_pb->border_left;
|
||||
src_x[2] = pixbuf_width - theme_pb->border_right;
|
||||
src_x[3] = pixbuf_width;
|
||||
|
||||
src_y[0] = 0;
|
||||
src_y[1] = theme_pb->border_top;
|
||||
src_y[2] = pixbuf_height - theme_pb->border_bottom;
|
||||
src_y[3] = pixbuf_height;
|
||||
|
||||
dest_x[0] = x;
|
||||
dest_x[1] = x + theme_pb->border_left;
|
||||
dest_x[2] = x + width - theme_pb->border_right;
|
||||
dest_x[3] = x + width;
|
||||
|
||||
dest_y[0] = y;
|
||||
dest_y[1] = y + theme_pb->border_top;
|
||||
dest_y[2] = y + height - theme_pb->border_bottom;
|
||||
dest_y[3] = y + height;
|
||||
|
||||
if (component_mask & COMPONENT_ALL)
|
||||
component_mask = (COMPONENT_ALL - 1) & ~component_mask;
|
||||
|
||||
#define RENDER_COMPONENT(X1,X2,Y1,Y2) \
|
||||
pixbuf_render (pixbuf, theme_pb->hints[Y1][X1], window, mask, clip_rect, \
|
||||
src_x[X1], src_y[Y1], \
|
||||
src_x[X2] - src_x[X1], src_y[Y2] - src_y[Y1], \
|
||||
dest_x[X1], dest_y[Y1], \
|
||||
dest_x[X2] - dest_x[X1], dest_y[Y2] - dest_y[Y1]);
|
||||
|
||||
if (component_mask & COMPONENT_NORTH_WEST)
|
||||
RENDER_COMPONENT (0, 1, 0, 1);
|
||||
|
||||
if (component_mask & COMPONENT_NORTH)
|
||||
RENDER_COMPONENT (1, 2, 0, 1);
|
||||
|
||||
if (component_mask & COMPONENT_NORTH_EAST)
|
||||
RENDER_COMPONENT (2, 3, 0, 1);
|
||||
|
||||
if (component_mask & COMPONENT_WEST)
|
||||
RENDER_COMPONENT (0, 1, 1, 2);
|
||||
|
||||
if (component_mask & COMPONENT_CENTER)
|
||||
RENDER_COMPONENT (1, 2, 1, 2);
|
||||
|
||||
if (component_mask & COMPONENT_EAST)
|
||||
RENDER_COMPONENT (2, 3, 1, 2);
|
||||
|
||||
if (component_mask & COMPONENT_SOUTH_WEST)
|
||||
RENDER_COMPONENT (0, 1, 2, 3);
|
||||
|
||||
if (component_mask & COMPONENT_SOUTH)
|
||||
RENDER_COMPONENT (1, 2, 2, 3);
|
||||
|
||||
if (component_mask & COMPONENT_SOUTH_EAST)
|
||||
RENDER_COMPONENT (2, 3, 2, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (center)
|
||||
{
|
||||
x += (width - pixbuf_width) / 2;
|
||||
y += (height - pixbuf_height) / 2;
|
||||
|
||||
pixbuf_render (pixbuf, 0, window, NULL, clip_rect,
|
||||
0, 0,
|
||||
pixbuf_width, pixbuf_height,
|
||||
x, y,
|
||||
pixbuf_width, pixbuf_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkPixmap *tmp_pixmap;
|
||||
GdkGC *tmp_gc;
|
||||
GdkGCValues gc_values;
|
||||
|
||||
tmp_pixmap = gdk_pixmap_new (window,
|
||||
pixbuf_width,
|
||||
pixbuf_height,
|
||||
-1);
|
||||
tmp_gc = gdk_gc_new (tmp_pixmap);
|
||||
gdk_pixbuf_render_to_drawable (pixbuf, tmp_pixmap, tmp_gc,
|
||||
0, 0,
|
||||
0, 0,
|
||||
pixbuf_width, pixbuf_height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
0, 0);
|
||||
gdk_gc_unref (tmp_gc);
|
||||
|
||||
gc_values.fill = GDK_TILED;
|
||||
gc_values.tile = tmp_pixmap;
|
||||
tmp_gc = gdk_gc_new_with_values (window,
|
||||
&gc_values, GDK_GC_FILL | GDK_GC_TILE);
|
||||
if (clip_rect)
|
||||
gdk_draw_rectangle (window, tmp_gc, TRUE,
|
||||
clip_rect->x, clip_rect->y, clip_rect->width, clip_rect->height);
|
||||
else
|
||||
gdk_draw_rectangle (window, tmp_gc, TRUE, x, y, width, height);
|
||||
|
||||
gdk_gc_unref (tmp_gc);
|
||||
gdk_pixmap_unref (tmp_pixmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/* GTK+ Pixbuf Engine
|
||||
* Copyright (C) 1998-2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Written by Owen Taylor <otaylor@redhat.com>, based on code by
|
||||
* Carsten Haitzler <raster@rasterman.com>
|
||||
*/
|
||||
|
||||
#include <gtk/gtkstyle.h>
|
||||
|
||||
typedef struct _PixbufStyle PixbufStyle;
|
||||
typedef struct _PixbufStyleClass PixbufStyleClass;
|
||||
|
||||
extern GType pixbuf_type_style;
|
||||
|
||||
#define PIXBUF_TYPE_STYLE pixbuf_type_style
|
||||
#define PIXBUF_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PIXBUF_TYPE_STYLE, PixbufStyle))
|
||||
#define PIXBUF_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIXBUF_TYPE_STYLE, PixbufStyleClass))
|
||||
#define PIXBUF_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PIXBUF_TYPE_STYLE))
|
||||
#define PIXBUF_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIXBUF_TYPE_STYLE))
|
||||
#define PIXBUF_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIXBUF_TYPE_STYLE, PixbufStyleClass))
|
||||
|
||||
struct _PixbufStyle
|
||||
{
|
||||
GtkStyle parent_instance;
|
||||
};
|
||||
|
||||
struct _PixbufStyleClass
|
||||
{
|
||||
GtkStyleClass parent_class;
|
||||
};
|
||||
|
||||
void pixbuf_style_register_type (GTypeModule *module);
|
||||
|
||||
|
||||
@@ -1,196 +0,0 @@
|
||||
/* GTK+ Pixbuf Engine
|
||||
* Copyright (C) 1998-2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Written by Owen Taylor <otaylor@redhat.com>, based on code by
|
||||
* Carsten Haitzler <raster@rasterman.com>
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
/* internals */
|
||||
|
||||
typedef struct _ThemeData ThemeData;
|
||||
typedef struct _ThemeImage ThemeImage;
|
||||
typedef struct _ThemeMatchData ThemeMatchData;
|
||||
typedef struct _ThemePixbuf ThemePixbuf;
|
||||
|
||||
enum
|
||||
{
|
||||
TOKEN_IMAGE = G_TOKEN_LAST + 1,
|
||||
TOKEN_FUNCTION,
|
||||
TOKEN_FILE,
|
||||
TOKEN_STRETCH,
|
||||
TOKEN_RECOLORABLE,
|
||||
TOKEN_BORDER,
|
||||
TOKEN_DETAIL,
|
||||
TOKEN_STATE,
|
||||
TOKEN_SHADOW,
|
||||
TOKEN_GAP_SIDE,
|
||||
TOKEN_GAP_FILE,
|
||||
TOKEN_GAP_BORDER,
|
||||
TOKEN_GAP_START_FILE,
|
||||
TOKEN_GAP_START_BORDER,
|
||||
TOKEN_GAP_END_FILE,
|
||||
TOKEN_GAP_END_BORDER,
|
||||
TOKEN_OVERLAY_FILE,
|
||||
TOKEN_OVERLAY_BORDER,
|
||||
TOKEN_OVERLAY_STRETCH,
|
||||
TOKEN_ARROW_DIRECTION,
|
||||
TOKEN_D_HLINE,
|
||||
TOKEN_D_VLINE,
|
||||
TOKEN_D_SHADOW,
|
||||
TOKEN_D_POLYGON,
|
||||
TOKEN_D_ARROW,
|
||||
TOKEN_D_DIAMOND,
|
||||
TOKEN_D_OVAL,
|
||||
TOKEN_D_STRING,
|
||||
TOKEN_D_BOX,
|
||||
TOKEN_D_FLAT_BOX,
|
||||
TOKEN_D_CHECK,
|
||||
TOKEN_D_OPTION,
|
||||
TOKEN_D_CROSS,
|
||||
TOKEN_D_RAMP,
|
||||
TOKEN_D_TAB,
|
||||
TOKEN_D_SHADOW_GAP,
|
||||
TOKEN_D_BOX_GAP,
|
||||
TOKEN_D_EXTENSION,
|
||||
TOKEN_D_FOCUS,
|
||||
TOKEN_D_SLIDER,
|
||||
TOKEN_D_ENTRY,
|
||||
TOKEN_D_HANDLE,
|
||||
TOKEN_D_STEPPER,
|
||||
TOKEN_TRUE,
|
||||
TOKEN_FALSE,
|
||||
TOKEN_TOP,
|
||||
TOKEN_UP,
|
||||
TOKEN_BOTTOM,
|
||||
TOKEN_DOWN,
|
||||
TOKEN_LEFT,
|
||||
TOKEN_RIGHT,
|
||||
TOKEN_NORMAL,
|
||||
TOKEN_ACTIVE,
|
||||
TOKEN_PRELIGHT,
|
||||
TOKEN_SELECTED,
|
||||
TOKEN_INSENSITIVE,
|
||||
TOKEN_NONE,
|
||||
TOKEN_IN,
|
||||
TOKEN_OUT,
|
||||
TOKEN_ETCHED_IN,
|
||||
TOKEN_ETCHED_OUT,
|
||||
TOKEN_ORIENTATION,
|
||||
TOKEN_HORIZONTAL,
|
||||
TOKEN_VERTICAL
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COMPONENT_NORTH_WEST = 1 << 0,
|
||||
COMPONENT_NORTH = 1 << 1,
|
||||
COMPONENT_NORTH_EAST = 1 << 2,
|
||||
COMPONENT_WEST = 1 << 3,
|
||||
COMPONENT_CENTER = 1 << 4,
|
||||
COMPONENT_EAST = 1 << 5,
|
||||
COMPONENT_SOUTH_EAST = 1 << 6,
|
||||
COMPONENT_SOUTH = 1 << 7,
|
||||
COMPONENT_SOUTH_WEST = 1 << 8,
|
||||
COMPONENT_ALL = 1 << 9
|
||||
} ThemePixbufComponent;
|
||||
|
||||
typedef enum {
|
||||
THEME_MATCH_GAP_SIDE = 1 << 0,
|
||||
THEME_MATCH_ORIENTATION = 1 << 1,
|
||||
THEME_MATCH_STATE = 1 << 2,
|
||||
THEME_MATCH_SHADOW = 1 << 3,
|
||||
THEME_MATCH_ARROW_DIRECTION = 1 << 4
|
||||
} ThemeMatchFlags;
|
||||
|
||||
typedef enum {
|
||||
THEME_CONSTANT_ROWS = 1 << 0,
|
||||
THEME_CONSTANT_COLS = 1 << 1,
|
||||
THEME_MISSING = 1 << 2
|
||||
} ThemeRenderHints;
|
||||
|
||||
struct _ThemePixbuf
|
||||
{
|
||||
gchar *filename;
|
||||
GdkPixbuf *pixbuf;
|
||||
gboolean stretch;
|
||||
gint border_left;
|
||||
gint border_right;
|
||||
gint border_bottom;
|
||||
gint border_top;
|
||||
guint hints[3][3];
|
||||
};
|
||||
|
||||
struct _ThemeMatchData
|
||||
{
|
||||
guint function; /* Mandatory */
|
||||
gchar *detail;
|
||||
|
||||
ThemeMatchFlags flags;
|
||||
|
||||
GtkPositionType gap_side;
|
||||
GtkOrientation orientation;
|
||||
GtkStateType state;
|
||||
GtkShadowType shadow;
|
||||
GtkArrowType arrow_direction;
|
||||
};
|
||||
|
||||
struct _ThemeImage
|
||||
{
|
||||
guint refcount;
|
||||
|
||||
ThemePixbuf *background;
|
||||
ThemePixbuf *overlay;
|
||||
ThemePixbuf *gap_start;
|
||||
ThemePixbuf *gap;
|
||||
ThemePixbuf *gap_end;
|
||||
|
||||
gchar recolorable;
|
||||
|
||||
ThemeMatchData match_data;
|
||||
};
|
||||
|
||||
|
||||
ThemePixbuf *theme_pixbuf_new (void);
|
||||
void theme_pixbuf_destroy (ThemePixbuf *theme_pb);
|
||||
void theme_pixbuf_set_filename (ThemePixbuf *theme_pb,
|
||||
const char *filename);
|
||||
GdkPixbuf * theme_pixbuf_get_pixbuf (ThemePixbuf *theme_pb);
|
||||
void theme_pixbuf_set_border (ThemePixbuf *theme_pb,
|
||||
gint left,
|
||||
gint right,
|
||||
gint top,
|
||||
gint bottom);
|
||||
void theme_pixbuf_set_stretch (ThemePixbuf *theme_pb,
|
||||
gboolean stretch);
|
||||
void theme_pixbuf_render (ThemePixbuf *theme_pb,
|
||||
GdkWindow *window,
|
||||
GdkBitmap *mask,
|
||||
GdkRectangle *clip_rect,
|
||||
guint component_mask,
|
||||
gboolean center,
|
||||
gint dest_x,
|
||||
gint dest_y,
|
||||
gint dest_width,
|
||||
gint dest_height);
|
||||
|
||||
|
||||
|
||||
extern GtkStyleClass pixmap_default_class;
|
||||
Reference in New Issue
Block a user