Don't draw with GTK_STATE_ACTIVE.

2001-09-18  Alex Larsson  <alexl@redhat.com>

        * gtk/gtkcheckbutton.c:
	* gtk/gtkradiobutton.c:
	Don't draw with GTK_STATE_ACTIVE.

	* gtk/gtkclist.c:
	* gtk/gtkctree.c:
	Draw lines between rows with base_gc[GTK_STATE_NORMAL].

	* gtk/gtktextdisplay.c:
	Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
	unfocused with base_gc [GTK_STATE_ACTIVE].

	* gtk/gtkentry.c:
	Add select all menu-item.
	Default cursor color is red.
	Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
	unfocused with base_gc [GTK_STATE_ACTIVE].

	* gtk/gtklabel.[ch]:
	Add keynav + menu to selectable lables.
	Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
	unfocused with base_gc [GTK_STATE_ACTIVE].

	* gtk/gtkfilesel.c:
	Add drag and drop support.

	* gtk/gtkstyle.c:
	(This was checked in earlier)
	New default values for text/base SELECTED and ACTIVE
This commit is contained in:
Alex Larsson 2001-09-19 00:49:52 +00:00 committed by Alexander Larsson
parent 07fd245421
commit 1a46d3d534
16 changed files with 1404 additions and 97 deletions

View File

@ -1,3 +1,35 @@
2001-09-18 Alex Larsson <alexl@redhat.com>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
Don't draw with GTK_STATE_ACTIVE.
* gtk/gtkclist.c:
* gtk/gtkctree.c:
Draw lines between rows with base_gc[GTK_STATE_NORMAL].
* gtk/gtktextdisplay.c:
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkentry.c:
Add select all menu-item.
Default cursor color is red.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtklabel.[ch]:
Add keynav + menu to selectable lables.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkfilesel.c:
Add drag and drop support.
* gtk/gtkstyle.c:
(This was checked in earlier)
New default values for text/base SELECTED and ACTIVE
Tue Sep 18 23:51:49 2001 Tim Janik <timj@gtk.org>
* configure.in: up version to 1.3.8, interface age 0,

View File

@ -1,3 +1,35 @@
2001-09-18 Alex Larsson <alexl@redhat.com>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
Don't draw with GTK_STATE_ACTIVE.
* gtk/gtkclist.c:
* gtk/gtkctree.c:
Draw lines between rows with base_gc[GTK_STATE_NORMAL].
* gtk/gtktextdisplay.c:
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkentry.c:
Add select all menu-item.
Default cursor color is red.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtklabel.[ch]:
Add keynav + menu to selectable lables.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkfilesel.c:
Add drag and drop support.
* gtk/gtkstyle.c:
(This was checked in earlier)
New default values for text/base SELECTED and ACTIVE
Tue Sep 18 23:51:49 2001 Tim Janik <timj@gtk.org>
* configure.in: up version to 1.3.8, interface age 0,

View File

@ -1,3 +1,35 @@
2001-09-18 Alex Larsson <alexl@redhat.com>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
Don't draw with GTK_STATE_ACTIVE.
* gtk/gtkclist.c:
* gtk/gtkctree.c:
Draw lines between rows with base_gc[GTK_STATE_NORMAL].
* gtk/gtktextdisplay.c:
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkentry.c:
Add select all menu-item.
Default cursor color is red.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtklabel.[ch]:
Add keynav + menu to selectable lables.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkfilesel.c:
Add drag and drop support.
* gtk/gtkstyle.c:
(This was checked in earlier)
New default values for text/base SELECTED and ACTIVE
Tue Sep 18 23:51:49 2001 Tim Janik <timj@gtk.org>
* configure.in: up version to 1.3.8, interface age 0,

View File

@ -1,3 +1,35 @@
2001-09-18 Alex Larsson <alexl@redhat.com>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
Don't draw with GTK_STATE_ACTIVE.
* gtk/gtkclist.c:
* gtk/gtkctree.c:
Draw lines between rows with base_gc[GTK_STATE_NORMAL].
* gtk/gtktextdisplay.c:
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkentry.c:
Add select all menu-item.
Default cursor color is red.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtklabel.[ch]:
Add keynav + menu to selectable lables.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkfilesel.c:
Add drag and drop support.
* gtk/gtkstyle.c:
(This was checked in earlier)
New default values for text/base SELECTED and ACTIVE
Tue Sep 18 23:51:49 2001 Tim Janik <timj@gtk.org>
* configure.in: up version to 1.3.8, interface age 0,

View File

@ -1,3 +1,35 @@
2001-09-18 Alex Larsson <alexl@redhat.com>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
Don't draw with GTK_STATE_ACTIVE.
* gtk/gtkclist.c:
* gtk/gtkctree.c:
Draw lines between rows with base_gc[GTK_STATE_NORMAL].
* gtk/gtktextdisplay.c:
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkentry.c:
Add select all menu-item.
Default cursor color is red.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtklabel.[ch]:
Add keynav + menu to selectable lables.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkfilesel.c:
Add drag and drop support.
* gtk/gtkstyle.c:
(This was checked in earlier)
New default values for text/base SELECTED and ACTIVE
Tue Sep 18 23:51:49 2001 Tim Janik <timj@gtk.org>
* configure.in: up version to 1.3.8, interface age 0,

View File

@ -1,3 +1,35 @@
2001-09-18 Alex Larsson <alexl@redhat.com>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
Don't draw with GTK_STATE_ACTIVE.
* gtk/gtkclist.c:
* gtk/gtkctree.c:
Draw lines between rows with base_gc[GTK_STATE_NORMAL].
* gtk/gtktextdisplay.c:
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkentry.c:
Add select all menu-item.
Default cursor color is red.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtklabel.[ch]:
Add keynav + menu to selectable lables.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkfilesel.c:
Add drag and drop support.
* gtk/gtkstyle.c:
(This was checked in earlier)
New default values for text/base SELECTED and ACTIVE
Tue Sep 18 23:51:49 2001 Tim Janik <timj@gtk.org>
* configure.in: up version to 1.3.8, interface age 0,

View File

@ -1,3 +1,35 @@
2001-09-18 Alex Larsson <alexl@redhat.com>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
Don't draw with GTK_STATE_ACTIVE.
* gtk/gtkclist.c:
* gtk/gtkctree.c:
Draw lines between rows with base_gc[GTK_STATE_NORMAL].
* gtk/gtktextdisplay.c:
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkentry.c:
Add select all menu-item.
Default cursor color is red.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtklabel.[ch]:
Add keynav + menu to selectable lables.
Focused selection is drawn with base_gc [GTK_STATE_SELECTED] and
unfocused with base_gc [GTK_STATE_ACTIVE].
* gtk/gtkfilesel.c:
Add drag and drop support.
* gtk/gtkstyle.c:
(This was checked in earlier)
New default values for text/base SELECTED and ACTIVE
Tue Sep 18 23:51:49 2001 Tim Janik <timj@gtk.org>
* configure.in: up version to 1.3.8, interface age 0,

View File

@ -404,21 +404,13 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
width = indicator_size;
height = indicator_size;
if (GTK_TOGGLE_BUTTON (widget)->inconsistent)
{
state_type = GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE ? GTK_STATE_NORMAL : GTK_WIDGET_STATE (widget);
if (GTK_TOGGLE_BUTTON (widget)->inconsistent)
shadow_type = GTK_SHADOW_ETCHED_IN;
}
else if (GTK_TOGGLE_BUTTON (widget)->active)
{
state_type = GTK_STATE_ACTIVE;
shadow_type = GTK_SHADOW_IN;
}
else
{
shadow_type = GTK_SHADOW_OUT;
state_type = GTK_WIDGET_STATE (widget);
}
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
x = widget->allocation.x + widget->allocation.width - (width + x - widget->allocation.x);

View File

@ -5661,7 +5661,7 @@ draw_row (GtkCList *clist,
if (gdk_rectangle_intersect (area, &cell_rectangle,
&intersect_rectangle))
gdk_draw_rectangle (clist->clist_window,
widget->style->base_gc[GTK_STATE_ACTIVE],
widget->style->base_gc[GTK_STATE_NORMAL],
TRUE,
intersect_rectangle.x,
intersect_rectangle.y,
@ -5676,7 +5676,7 @@ draw_row (GtkCList *clist,
if (gdk_rectangle_intersect (area, &cell_rectangle,
&intersect_rectangle))
gdk_draw_rectangle (clist->clist_window,
widget->style->base_gc[GTK_STATE_ACTIVE],
widget->style->base_gc[GTK_STATE_NORMAL],
TRUE,
intersect_rectangle.x,
intersect_rectangle.y,
@ -5692,7 +5692,7 @@ draw_row (GtkCList *clist,
{
rect = &clip_rectangle;
gdk_draw_rectangle (clist->clist_window,
widget->style->base_gc[GTK_STATE_ACTIVE],
widget->style->base_gc[GTK_STATE_NORMAL],
TRUE,
cell_rectangle.x,
cell_rectangle.y,
@ -5705,7 +5705,7 @@ draw_row (GtkCList *clist,
cell_rectangle.y += clist->row_height + CELL_SPACING;
gdk_draw_rectangle (clist->clist_window,
widget->style->base_gc[GTK_STATE_ACTIVE],
widget->style->base_gc[GTK_STATE_NORMAL],
TRUE,
cell_rectangle.x,
cell_rectangle.y,

View File

@ -1705,7 +1705,7 @@ draw_row (GtkCList *clist,
if (gdk_rectangle_intersect (area, &cell_rectangle, crect))
gdk_draw_rectangle (clist->clist_window,
widget->style->base_gc[GTK_STATE_ACTIVE], TRUE,
widget->style->base_gc[GTK_STATE_NORMAL], TRUE,
crect->x, crect->y, crect->width, crect->height);
}
else
@ -1714,7 +1714,7 @@ draw_row (GtkCList *clist,
crect = &cell_rectangle;
gdk_draw_rectangle (clist->clist_window,
widget->style->base_gc[GTK_STATE_ACTIVE], TRUE,
widget->style->base_gc[GTK_STATE_NORMAL], TRUE,
crect->x, crect->y, crect->width, crect->height);
}
@ -1761,7 +1761,7 @@ draw_row (GtkCList *clist,
if (!area || gdk_rectangle_intersect (area, &cell_rectangle, crect))
{
gdk_draw_rectangle (clist->clist_window,
widget->style->base_gc[GTK_STATE_ACTIVE], TRUE,
widget->style->base_gc[GTK_STATE_NORMAL], TRUE,
crect->x, crect->y, crect->width, crect->height);
/* horizontal black lines */

View File

@ -211,6 +211,7 @@ static void gtk_entry_cut_clipboard (GtkEntry *entry);
static void gtk_entry_copy_clipboard (GtkEntry *entry);
static void gtk_entry_paste_clipboard (GtkEntry *entry);
static void gtk_entry_toggle_overwrite (GtkEntry *entry);
static void gtk_entry_select_all (GtkEntry *entry);
static void gtk_entry_real_activate (GtkEntry *entry);
static void gtk_entry_popup_menu (GtkWidget *widget);
@ -932,18 +933,17 @@ static void
gtk_entry_realize_cursor_gc (GtkEntry *entry)
{
GdkColor *cursor_color;
GdkColor red = {0, 0xffff, 0x0000, 0x0000};
if (entry->cursor_gc)
gdk_gc_unref (entry->cursor_gc);
gtk_widget_style_get (GTK_WIDGET (entry), "cursor_color", &cursor_color, NULL);
if (cursor_color)
{
entry->cursor_gc = gdk_gc_new (entry->text_area);
if (cursor_color)
gdk_gc_set_rgb_fg_color (entry->cursor_gc, cursor_color);
}
else
entry->cursor_gc = gdk_gc_ref (GTK_WIDGET (entry)->style->base_gc[GTK_STATE_SELECTED]);
gdk_gc_set_rgb_fg_color (entry->cursor_gc, &red);
}
static void
@ -2121,6 +2121,12 @@ gtk_entry_toggle_overwrite (GtkEntry *entry)
entry->overwrite_mode = !entry->overwrite_mode;
}
static void
gtk_entry_select_all (GtkEntry *entry)
{
gtk_entry_select_line (entry);
}
static void
gtk_entry_real_activate (GtkEntry *entry)
{
@ -2516,6 +2522,8 @@ gtk_entry_draw_text (GtkEntry *entry)
gint start_index = g_utf8_offset_to_pointer (entry->text, start_pos) - entry->text;
gint end_index = g_utf8_offset_to_pointer (entry->text, end_pos) - entry->text;
GdkRegion *clip_region = gdk_region_new ();
GdkGC *text_gc;
GdkGC *selection_gc;
line = pango_layout_get_lines (layout)->data;
@ -2523,6 +2531,17 @@ gtk_entry_draw_text (GtkEntry *entry)
pango_layout_get_extents (layout, NULL, &logical_rect);
if (GTK_WIDGET_HAS_FOCUS (entry))
{
selection_gc = widget->style->base_gc [GTK_STATE_SELECTED];
text_gc = widget->style->text_gc [GTK_STATE_SELECTED];
}
else
{
selection_gc = widget->style->base_gc [GTK_STATE_ACTIVE];
text_gc = widget->style->text_gc [GTK_STATE_ACTIVE];
}
for (i=0; i < n_ranges; i++)
{
GdkRectangle rect;
@ -2532,17 +2551,17 @@ gtk_entry_draw_text (GtkEntry *entry)
rect.width = (ranges[2*i + 1] - ranges[2*i]) / PANGO_SCALE;
rect.height = logical_rect.height / PANGO_SCALE;
gdk_draw_rectangle (entry->text_area, widget->style->base_gc [GTK_STATE_SELECTED], TRUE,
gdk_draw_rectangle (entry->text_area, selection_gc, TRUE,
rect.x, rect.y, rect.width, rect.height);
gdk_region_union_with_rect (clip_region, &rect);
}
gdk_gc_set_clip_region (widget->style->text_gc [GTK_STATE_SELECTED], clip_region);
gdk_draw_layout (entry->text_area, widget->style->text_gc [GTK_STATE_SELECTED],
gdk_gc_set_clip_region (text_gc, clip_region);
gdk_draw_layout (entry->text_area, text_gc,
x, y,
layout);
gdk_gc_set_clip_region (widget->style->text_gc [GTK_STATE_SELECTED], NULL);
gdk_gc_set_clip_region (text_gc, NULL);
gdk_region_destroy (clip_region);
g_free (ranges);
@ -3664,6 +3683,12 @@ gtk_entry_do_popup (GtkEntry *entry,
append_action_signal (entry, entry->popup_menu, _("Paste"), "paste_clipboard",
TRUE);
menuitem = gtk_menu_item_new_with_label (_("Select All"));
gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (gtk_entry_select_all), entry);
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (entry->popup_menu), menuitem);
menuitem = gtk_separator_menu_item_new ();
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (entry->popup_menu), menuitem);

View File

@ -68,6 +68,8 @@
#include "gtkdialog.h"
#include "gtkmessagedialog.h"
#include "gtkintl.h"
#include "gtkdnd.h"
#include "gtkeventbox.h"
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
#define STRICT
@ -588,6 +590,7 @@ gtk_file_selection_init (GtkFileSelection *filesel)
GtkWidget *confirm_area;
GtkWidget *pulldown_hbox;
GtkWidget *scrolled_win;
GtkWidget *eventbox;
GtkDialog *dialog;
char *dir_title [2];
@ -693,10 +696,13 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_box_pack_end (GTK_BOX (filesel->main_vbox), entry_vbox, FALSE, FALSE, 2);
gtk_widget_show (entry_vbox);
eventbox = gtk_event_box_new ();
filesel->selection_text = label = gtk_label_new ("");
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (entry_vbox), label, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (eventbox), label);
gtk_box_pack_start (GTK_BOX (entry_vbox), eventbox, FALSE, FALSE, 0);
gtk_widget_show (label);
gtk_widget_show (eventbox);
filesel->selection_entry = gtk_entry_new ();
gtk_signal_connect (GTK_OBJECT (filesel->selection_entry), "key_press_event",
@ -728,6 +734,224 @@ gtk_file_selection_init (GtkFileSelection *filesel)
gtk_widget_grab_focus (filesel->selection_entry);
}
static gchar *
uri_list_extract_first_uri (const gchar* uri_list)
{
const gchar *p, *q;
g_return_val_if_fail (uri_list != NULL, NULL);
p = uri_list;
/* We don't actually try to validate the URI according to RFC
* 2396, or even check for allowed characters - we just ignore
* comments and trim whitespace off the ends. We also
* allow LF delimination as well as the specified CRLF.
*
* We do allow comments like specified in RFC 2483.
*/
while (p)
{
if (*p != '#')
{
while (g_ascii_isspace(*p))
p++;
q = p;
while (*q && (*q != '\n') && (*q != '\r'))
q++;
if (q > p)
{
q--;
while (q > p && g_ascii_isspace (*q))
q--;
if (q > p)
return g_strndup (p, q - p + 1);
}
}
p = strchr (p, '\n');
if (p)
p++;
}
return NULL;
}
static void
dnd_really_drop (GtkWidget *dialog, gint response_id, GtkFileSelection *fs)
{
gchar *filename;
if (response_id == GTK_RESPONSE_YES)
{
filename = g_object_get_data (G_OBJECT (dialog), "gtk-fs-dnd-filename");
gtk_file_selection_set_filename (fs, filename);
}
gtk_widget_destroy (dialog);
}
static void
filenames_dropped (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint time)
{
char *uri = NULL;
char *filename = NULL;
char *hostname;
char this_hostname[257];
int res;
GError *error = NULL;
if (!selection_data->data)
return;
uri = uri_list_extract_first_uri ((char *)selection_data->data);
if (!uri)
return;
filename = g_filename_from_uri (uri, &hostname, &error);
g_free (uri);
if (!filename)
{
g_warning ("Error getting dropped filename: %s\n",
error->message);
g_error_free (error);
return;
}
res = gethostname (this_hostname, 256);
this_hostname[256] = 0;
if ((hostname == NULL) ||
(res == 0 && strcmp (hostname, this_hostname) == 0) ||
(strcmp (hostname, "localhost") == 0))
gtk_file_selection_set_filename (GTK_FILE_SELECTION (widget),
filename);
else
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (widget),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
_("The file \"%s\" resides on another machine (called %s) and may not be availible to this program.\n"
"Are you sure that you want to select it?"), filename, hostname);
g_object_set_data_full (G_OBJECT (dialog), "gtk-fs-dnd-filename", g_strdup (filename), g_free);
g_signal_connect_data (dialog, "response",
(GCallback) dnd_really_drop,
widget, NULL, 0);
gtk_widget_show (dialog);
}
g_free (hostname);
g_free (filename);
}
enum
{
TARGET_URILIST,
TARGET_UTF8_STRING,
TARGET_STRING,
TARGET_TEXT,
TARGET_COMPOUND_TEXT
};
static void
filenames_drag_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection_data,
guint info,
guint time,
GtkFileSelection *filesel)
{
gchar *file;
gchar *uri_list;
char hostname[256];
int res;
GError *error;
file = gtk_file_selection_get_filename (filesel);
if (file)
{
if (info == TARGET_URILIST)
{
res = gethostname (hostname, 256);
error = NULL;
uri_list = g_filename_to_uri (file, (!res)?hostname:NULL, &error);
if (!uri_list)
{
g_warning ("Error getting filename: %s\n",
error->message);
g_error_free (error);
return;
}
gtk_selection_data_set (selection_data,
selection_data->target, 8,
(void *)uri_list, strlen((char *)uri_list));
g_free (uri_list);
}
else
{
g_print ("Setting text: '%s'\n", file);
gtk_selection_data_set_text (selection_data, file);
}
}
}
static void
file_selection_setup_dnd (GtkFileSelection *filesel)
{
GtkWidget *eventbox;
static GtkTargetEntry drop_types[] = {
{ "text/uri-list", 0, TARGET_URILIST}
};
static gint n_drop_types = sizeof(drop_types)/sizeof(drop_types[0]);
static GtkTargetEntry drag_types[] = {
{ "text/uri-list", 0, TARGET_URILIST},
{ "UTF8_STRING", 0, TARGET_UTF8_STRING },
{ "STRING", 0, 0 },
{ "TEXT", 0, 0 },
{ "COMPOUND_TEXT", 0, 0 }
};
static gint n_drag_types = sizeof(drag_types)/sizeof(drag_types[0]);
gtk_drag_dest_set (GTK_WIDGET (filesel),
GTK_DEST_DEFAULT_ALL,
drop_types, n_drop_types,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT(filesel), "drag_data_received",
GTK_SIGNAL_FUNC(filenames_dropped), NULL);
eventbox = gtk_widget_get_parent (filesel->selection_text);
gtk_drag_source_set (eventbox,
GDK_BUTTON1_MASK,
drag_types, n_drag_types,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (eventbox),
"drag_data_get",
GTK_SIGNAL_FUNC (filenames_drag_get),
filesel);
}
GtkWidget*
gtk_file_selection_new (const gchar *title)
{
@ -737,6 +961,8 @@ gtk_file_selection_new (const gchar *title)
gtk_window_set_title (GTK_WINDOW (filesel), title);
gtk_dialog_set_has_separator (GTK_DIALOG (filesel), FALSE);
file_selection_setup_dnd (filesel);
return GTK_WIDGET (filesel);
}

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
#include <gdk/gdk.h>
#include <gtk/gtkmisc.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkmenu.h>
#ifdef __cplusplus
extern "C" {
@ -78,6 +78,17 @@ struct _GtkLabel
struct _GtkLabelClass
{
GtkMiscClass parent_class;
void (* move_cursor) (GtkLabel *label,
GtkMovementStep step,
gint count,
gboolean extend_selection);
void (* copy_clipboard) (GtkLabel *label);
void (* select_all) (GtkLabel *label);
/* Hook to customize right-click popup for selectable labels */
void (* populate_popup) (GtkLabel *label,
GtkMenu *menu);
};
GtkType gtk_label_get_type (void) G_GNUC_CONST;

View File

@ -463,7 +463,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
gtk_paint_option (widget->style, widget->window,
GTK_WIDGET_STATE (widget), shadow_type,
state_type, shadow_type,
area, widget, "radiobutton",
x, y, indicator_size, indicator_size);
}

View File

@ -250,7 +250,10 @@ render_layout_line (GdkDrawable *drawable,
if (selected)
{
if (GTK_WIDGET_HAS_FOCUS (render_state->widget))
fg_gc = render_state->widget->style->text_gc[GTK_STATE_SELECTED];
else
fg_gc = render_state->widget->style->text_gc [GTK_STATE_ACTIVE];
}
else
{
@ -494,6 +497,8 @@ render_para (GdkDrawable *drawable,
PangoLayoutIter *iter;
PangoRectangle layout_logical;
int screen_width;
GdkGC *fg_gc, *bg_gc;
gint state;
gboolean first = TRUE;
@ -508,6 +513,14 @@ render_para (GdkDrawable *drawable,
screen_width = line_display->total_width;
if (GTK_WIDGET_HAS_FOCUS (render_state->widget))
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_ACTIVE;
fg_gc = render_state->widget->style->text_gc [state];
bg_gc = render_state->widget->style->base_gc [state];
do
{
PangoLayoutLine *line = pango_layout_iter_get_line (iter);
@ -547,7 +560,7 @@ render_para (GdkDrawable *drawable,
selection_end_index > line->length + byte_offset) /* All selected */
{
gdk_draw_rectangle (drawable,
render_state->widget->style->base_gc[GTK_STATE_SELECTED],
bg_gc,
TRUE,
x + line_display->left_margin,
selection_y,
@ -577,12 +590,11 @@ render_para (GdkDrawable *drawable,
selection_y,
selection_height,
selection_start_index, selection_end_index);
gdk_gc_set_clip_region (render_state->widget->style->text_gc [GTK_STATE_SELECTED], clip_region);
gdk_gc_set_clip_region (render_state->widget->style->base_gc [GTK_STATE_SELECTED], clip_region);
gdk_gc_set_clip_region (fg_gc, clip_region);
gdk_gc_set_clip_region (bg_gc, clip_region);
gdk_draw_rectangle (drawable,
render_state->widget->style->base_gc[GTK_STATE_SELECTED],
bg_gc,
TRUE,
x + PANGO_PIXELS (line_rect.x),
selection_y,
@ -594,8 +606,8 @@ render_para (GdkDrawable *drawable,
y + PANGO_PIXELS (baseline),
TRUE);
gdk_gc_set_clip_region (render_state->widget->style->text_gc [GTK_STATE_SELECTED], NULL);
gdk_gc_set_clip_region (render_state->widget->style->base_gc [GTK_STATE_SELECTED], NULL);
gdk_gc_set_clip_region (fg_gc, NULL);
gdk_gc_set_clip_region (bg_gc, NULL);
gdk_region_destroy (clip_region);
@ -605,7 +617,7 @@ render_para (GdkDrawable *drawable,
(line_display->direction == GTK_TEXT_DIR_RTL && selection_end_index > byte_offset + line->length)))
{
gdk_draw_rectangle (drawable,
render_state->widget->style->base_gc[GTK_STATE_SELECTED],
bg_gc,
TRUE,
x + line_display->left_margin,
selection_y,
@ -625,7 +637,7 @@ render_para (GdkDrawable *drawable,
PANGO_PIXELS (line_rect.x) - PANGO_PIXELS (line_rect.width);
gdk_draw_rectangle (drawable,
render_state->widget->style->base_gc[GTK_STATE_SELECTED],
bg_gc,
TRUE,
x + PANGO_PIXELS (line_rect.x) + PANGO_PIXELS (line_rect.width),
selection_y,