NetSurf
Data Structures | Macros | Enumerations | Functions | Variables
sexy_icon_entry.c File Reference
#include <string.h>
#include <gtk/gtk.h>
#include "gtk/sexy_icon_entry.h"
#include "gtk/compat.h"
Include dependency graph for sexy_icon_entry.c:

Go to the source code of this file.

Data Structures

struct  SexyIconInfo
 
struct  _SexyIconEntryPriv
 

Macros

#define ICON_MARGIN   2
 
#define MAX_ICONS   2
 
#define IS_VALID_ICON_ENTRY_POSITION(pos)
 

Enumerations

enum  { ICON_PRESSED , ICON_RELEASED , LAST_SIGNAL }
 

Functions

static void sexy_icon_entry_editable_init (GtkEditableClass *iface)
 
static void sexy_icon_entry_finalize (GObject *obj)
 
static void sexy_icon_entry_destroy (GtkObject *obj)
 
static void sexy_icon_entry_map (GtkWidget *widget)
 
static void sexy_icon_entry_unmap (GtkWidget *widget)
 
static void sexy_icon_entry_realize (GtkWidget *widget)
 
static void sexy_icon_entry_unrealize (GtkWidget *widget)
 
static void sexy_icon_entry_size_request (GtkWidget *widget, GtkRequisition *requisition)
 
static void sexy_icon_entry_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
 
static gint sexy_icon_entry_expose (GtkWidget *widget, GdkEventExpose *event)
 
static gint sexy_icon_entry_enter_notify (GtkWidget *widget, GdkEventCrossing *event)
 
static gint sexy_icon_entry_leave_notify (GtkWidget *widget, GdkEventCrossing *event)
 
static gint sexy_icon_entry_button_press (GtkWidget *widget, GdkEventButton *event)
 
static gint sexy_icon_entry_button_release (GtkWidget *widget, GdkEventButton *event)
 
 G_DEFINE_TYPE_EXTENDED (SexyIconEntry, sexy_icon_entry, GTK_TYPE_ENTRY, 0, G_IMPLEMENT_INTERFACE(GTK_TYPE_EDITABLE, sexy_icon_entry_editable_init))
 
void sexy_icon_entry_class_init (SexyIconEntryClass *klass)
 
void sexy_icon_entry_init (SexyIconEntry *entry)
 
static gint get_icon_width (SexyIconEntry *entry, SexyIconEntryPosition icon_pos)
 
static void get_borders (SexyIconEntry *entry, gint *xborder, gint *yborder)
 
static void get_text_area_size (SexyIconEntry *entry, GtkAllocation *alloc)
 
static void get_icon_allocation (SexyIconEntry *icon_entry, gboolean left, GtkAllocation *widget_alloc, GtkAllocation *text_area_alloc, GtkAllocation *allocation, SexyIconEntryPosition *icon_pos)
 
static void place_windows (SexyIconEntry *icon_entry, GtkAllocation *widget_alloc)
 
static GdkPixbuf * get_pixbuf_from_icon (SexyIconEntry *entry, SexyIconEntryPosition icon_pos)
 
static void colorshift_pixbuf (GdkPixbuf *dest, GdkPixbuf *src, int shift)
 
static void draw_icon (GtkWidget *widget, SexyIconEntryPosition icon_pos)
 
static void update_icon (GObject *obj, GParamSpec *param, SexyIconEntry *entry)
 
GtkWidget * sexy_icon_entry_new (void)
 
void sexy_icon_entry_set_icon (SexyIconEntry *entry, SexyIconEntryPosition icon_pos, GtkImage *icon)
 
void sexy_icon_entry_set_icon_highlight (SexyIconEntry *entry, SexyIconEntryPosition icon_pos, gboolean highlight)
 
GtkImage * sexy_icon_entry_get_icon (const SexyIconEntry *entry, SexyIconEntryPosition icon_pos)
 
gboolean sexy_icon_entry_get_icon_highlight (const SexyIconEntry *entry, SexyIconEntryPosition icon_pos)
 
static void clear_button_clicked_cb (SexyIconEntry *icon_entry, SexyIconEntryPosition icon_pos, int button)
 
void sexy_icon_entry_add_clear_button (SexyIconEntry *icon_entry)
 

Variables

static GtkEntryClass * parent_class = NULL
 
static guint signals [LAST_SIGNAL] = {0}
 

Macro Definition Documentation

◆ ICON_MARGIN

#define ICON_MARGIN   2

Definition at line 32 of file sexy_icon_entry.c.

◆ IS_VALID_ICON_ENTRY_POSITION

#define IS_VALID_ICON_ENTRY_POSITION (   pos)
Value:
((pos) == SEXY_ICON_ENTRY_PRIMARY || \
@ SEXY_ICON_ENTRY_SECONDARY
@ SEXY_ICON_ENTRY_PRIMARY

Definition at line 35 of file sexy_icon_entry.c.

◆ MAX_ICONS

#define MAX_ICONS   2

Definition at line 33 of file sexy_icon_entry.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ICON_PRESSED 
ICON_RELEASED 
LAST_SIGNAL 

Definition at line 55 of file sexy_icon_entry.c.

Function Documentation

◆ clear_button_clicked_cb()

static void clear_button_clicked_cb ( SexyIconEntry icon_entry,
SexyIconEntryPosition  icon_pos,
int  button 
)
static

Definition at line 939 of file sexy_icon_entry.c.

References SEXY_ICON_ENTRY_SECONDARY.

Referenced by sexy_icon_entry_add_clear_button().

Here is the caller graph for this function:

◆ colorshift_pixbuf()

static void colorshift_pixbuf ( GdkPixbuf *  dest,
GdkPixbuf *  src,
int  shift 
)
static

Definition at line 510 of file sexy_icon_entry.c.

References height, and width.

Referenced by draw_icon().

Here is the caller graph for this function:

◆ draw_icon()

static void draw_icon ( GtkWidget *  widget,
SexyIconEntryPosition  icon_pos 
)
static

Definition at line 556 of file sexy_icon_entry.c.

References colorshift_pixbuf(), get_pixbuf_from_icon(), height, SexyIconInfo::hovered, SexyIconInfo::icon, ICON_MARGIN, _SexyIconEntryPriv::icons, nsgtk_widget_get_realized(), _SexyIconEntry::priv, SEXY_ICON_ENTRY, width, and SexyIconInfo::window.

Referenced by sexy_icon_entry_expose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ G_DEFINE_TYPE_EXTENDED()

G_DEFINE_TYPE_EXTENDED ( SexyIconEntry  ,
sexy_icon_entry  ,
GTK_TYPE_ENTRY  ,
,
G_IMPLEMENT_INTERFACE(GTK_TYPE_EDITABLE, sexy_icon_entry_editable_init  
)

◆ get_borders()

static void get_borders ( SexyIconEntry entry,
gint *  xborder,
gint *  yborder 
)
static

Definition at line 267 of file sexy_icon_entry.c.

Referenced by get_text_area_size().

Here is the caller graph for this function:

◆ get_icon_allocation()

static void get_icon_allocation ( SexyIconEntry icon_entry,
gboolean  left,
GtkAllocation *  widget_alloc,
GtkAllocation *  text_area_alloc,
GtkAllocation *  allocation,
SexyIconEntryPosition icon_pos 
)
static

Definition at line 313 of file sexy_icon_entry.c.

References get_icon_width(), ICON_MARGIN, SEXY_ICON_ENTRY_PRIMARY, and SEXY_ICON_ENTRY_SECONDARY.

Referenced by place_windows().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_icon_width()

static gint get_icon_width ( SexyIconEntry entry,
SexyIconEntryPosition  icon_pos 
)
static

Definition at line 248 of file sexy_icon_entry.c.

References SexyIconInfo::icon, _SexyIconEntryPriv::icons, _SexyIconEntry::priv, and width.

Referenced by get_icon_allocation(), and sexy_icon_entry_size_request().

Here is the caller graph for this function:

◆ get_pixbuf_from_icon()

static GdkPixbuf * get_pixbuf_from_icon ( SexyIconEntry entry,
SexyIconEntryPosition  icon_pos 
)
static

Definition at line 481 of file sexy_icon_entry.c.

References SexyIconInfo::icon, _SexyIconEntryPriv::icons, and _SexyIconEntry::priv.

Referenced by draw_icon().

Here is the caller graph for this function:

◆ get_text_area_size()

static void get_text_area_size ( SexyIconEntry entry,
GtkAllocation *  alloc 
)
static

Definition at line 297 of file sexy_icon_entry.c.

References get_borders().

Referenced by place_windows(), and sexy_icon_entry_expose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ place_windows()

static void place_windows ( SexyIconEntry icon_entry,
GtkAllocation *  widget_alloc 
)
static

Definition at line 428 of file sexy_icon_entry.c.

References get_icon_allocation(), get_text_area_size(), ICON_MARGIN, _SexyIconEntryPriv::icons, _SexyIconEntry::priv, and SexyIconInfo::window.

Referenced by sexy_icon_entry_size_allocate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_add_clear_button()

void sexy_icon_entry_add_clear_button ( SexyIconEntry icon_entry)

Definition at line 957 of file sexy_icon_entry.c.

References clear_button_clicked_cb(), _SexyIconEntryPriv::icon_released_id, nsgtk_image_new_from_stock(), NSGTK_STOCK_CLEAR, _SexyIconEntry::priv, SEXY_ICON_ENTRY, SEXY_ICON_ENTRY_SECONDARY, sexy_icon_entry_set_icon(), sexy_icon_entry_set_icon_highlight(), and SEXY_IS_ICON_ENTRY.

Here is the call graph for this function:

◆ sexy_icon_entry_button_press()

static gint sexy_icon_entry_button_press ( GtkWidget *  widget,
GdkEventButton *  event 
)
static

Definition at line 729 of file sexy_icon_entry.c.

References SexyIconInfo::hovered, ICON_PRESSED, _SexyIconEntryPriv::icons, MAX_ICONS, parent_class, _SexyIconEntry::priv, SEXY_ICON_ENTRY, sexy_icon_entry_get_icon_highlight(), signals, update_icon(), and SexyIconInfo::window.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_button_release()

static gint sexy_icon_entry_button_release ( GtkWidget *  widget,
GdkEventButton *  event 
)
static

Definition at line 760 of file sexy_icon_entry.c.

References height, SexyIconInfo::hovered, ICON_RELEASED, _SexyIconEntryPriv::icons, MAX_ICONS, parent_class, _SexyIconEntry::priv, SEXY_ICON_ENTRY, sexy_icon_entry_get_icon_highlight(), signals, update_icon(), width, and SexyIconInfo::window.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_class_init()

void sexy_icon_entry_class_init ( SexyIconEntryClass klass)

◆ sexy_icon_entry_destroy()

static void sexy_icon_entry_destroy ( GtkObject *  obj)
static

Definition at line 198 of file sexy_icon_entry.c.

References parent_class, SEXY_ICON_ENTRY, SEXY_ICON_ENTRY_PRIMARY, SEXY_ICON_ENTRY_SECONDARY, and sexy_icon_entry_set_icon().

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_editable_init()

static void sexy_icon_entry_editable_init ( GtkEditableClass *  iface)
static

Definition at line 171 of file sexy_icon_entry.c.

◆ sexy_icon_entry_enter_notify()

static gint sexy_icon_entry_enter_notify ( GtkWidget *  widget,
GdkEventCrossing *  event 
)
static

Definition at line 681 of file sexy_icon_entry.c.

References SexyIconInfo::hovered, _SexyIconEntryPriv::icons, MAX_ICONS, _SexyIconEntry::priv, SEXY_ICON_ENTRY, sexy_icon_entry_get_icon_highlight(), update_icon(), and SexyIconInfo::window.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_expose()

static gint sexy_icon_entry_expose ( GtkWidget *  widget,
GdkEventExpose *  event 
)
static

Definition at line 618 of file sexy_icon_entry.c.

References draw_icon(), get_text_area_size(), _SexyIconEntryPriv::icons, MAX_ICONS, nsgtk_widget_get_state(), nsgtk_widget_is_drawable(), parent_class, _SexyIconEntry::priv, SEXY_ICON_ENTRY, SEXY_IS_ICON_ENTRY, width, and SexyIconInfo::window.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_finalize()

static void sexy_icon_entry_finalize ( GObject *  obj)
static

Definition at line 182 of file sexy_icon_entry.c.

References parent_class, _SexyIconEntry::priv, SEXY_ICON_ENTRY, and SEXY_IS_ICON_ENTRY.

Referenced by sexy_icon_entry_class_init().

Here is the caller graph for this function:

◆ sexy_icon_entry_get_icon()

GtkImage * sexy_icon_entry_get_icon ( const SexyIconEntry entry,
SexyIconEntryPosition  icon_pos 
)

◆ sexy_icon_entry_get_icon_highlight()

gboolean sexy_icon_entry_get_icon_highlight ( const SexyIconEntry entry,
SexyIconEntryPosition  icon_pos 
)

Definition at line 928 of file sexy_icon_entry.c.

References SexyIconInfo::highlight, _SexyIconEntryPriv::icons, IS_VALID_ICON_ENTRY_POSITION, _SexyIconEntry::priv, and SEXY_IS_ICON_ENTRY.

Referenced by sexy_icon_entry_button_press(), sexy_icon_entry_button_release(), sexy_icon_entry_enter_notify(), and sexy_icon_entry_leave_notify().

Here is the caller graph for this function:

◆ sexy_icon_entry_init()

void sexy_icon_entry_init ( SexyIconEntry entry)

Definition at line 176 of file sexy_icon_entry.c.

References _SexyIconEntry::priv.

◆ sexy_icon_entry_leave_notify()

static gint sexy_icon_entry_leave_notify ( GtkWidget *  widget,
GdkEventCrossing *  event 
)
static

Definition at line 705 of file sexy_icon_entry.c.

References SexyIconInfo::hovered, _SexyIconEntryPriv::icons, MAX_ICONS, _SexyIconEntry::priv, SEXY_ICON_ENTRY, sexy_icon_entry_get_icon_highlight(), update_icon(), and SexyIconInfo::window.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_map()

static void sexy_icon_entry_map ( GtkWidget *  widget)
static

Definition at line 212 of file sexy_icon_entry.c.

References SexyIconInfo::icon, _SexyIconEntryPriv::icons, MAX_ICONS, nsgtk_widget_get_mapped(), nsgtk_widget_get_realized(), parent_class, _SexyIconEntry::priv, SEXY_ICON_ENTRY, and SexyIconInfo::window.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_new()

GtkWidget * sexy_icon_entry_new ( void  )

Definition at line 805 of file sexy_icon_entry.c.

References SEXY_TYPE_ICON_ENTRY.

Referenced by nsgtk_entry_new().

Here is the caller graph for this function:

◆ sexy_icon_entry_realize()

static void sexy_icon_entry_realize ( GtkWidget *  widget)
static

Definition at line 344 of file sexy_icon_entry.c.

References _SexyIconEntryPriv::icons, MAX_ICONS, nsgtk_widget_get_state(), parent_class, _SexyIconEntry::priv, SEXY_ICON_ENTRY, and SexyIconInfo::window.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_set_icon()

void sexy_icon_entry_set_icon ( SexyIconEntry entry,
SexyIconEntryPosition  icon_pos,
GtkImage *  icon 
)

Definition at line 819 of file sexy_icon_entry.c.

References SexyIconInfo::icon, _SexyIconEntryPriv::icon_released_id, _SexyIconEntryPriv::icons, IS_VALID_ICON_ENTRY_POSITION, _SexyIconEntry::priv, SEXY_ICON_ENTRY_SECONDARY, SEXY_IS_ICON_ENTRY, update_icon(), and SexyIconInfo::window.

Referenced by nsgtk_entry_set_icon_from_icon_name(), nsgtk_entry_set_icon_from_pixbuf(), sexy_icon_entry_add_clear_button(), and sexy_icon_entry_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_set_icon_highlight()

void sexy_icon_entry_set_icon_highlight ( SexyIconEntry entry,
SexyIconEntryPosition  icon_pos,
gboolean  highlight 
)

Definition at line 880 of file sexy_icon_entry.c.

References SexyIconInfo::highlight, _SexyIconEntryPriv::icons, IS_VALID_ICON_ENTRY_POSITION, _SexyIconEntry::priv, and SEXY_IS_ICON_ENTRY.

Referenced by sexy_icon_entry_add_clear_button().

Here is the caller graph for this function:

◆ sexy_icon_entry_size_allocate()

static void sexy_icon_entry_size_allocate ( GtkWidget *  widget,
GtkAllocation *  allocation 
)
static

Definition at line 467 of file sexy_icon_entry.c.

References nsgtk_widget_get_realized(), parent_class, place_windows(), SEXY_ICON_ENTRY, and SEXY_IS_ICON_ENTRY.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_size_request()

static void sexy_icon_entry_size_request ( GtkWidget *  widget,
GtkRequisition *  requisition 
)
static

Definition at line 403 of file sexy_icon_entry.c.

References get_icon_width(), ICON_MARGIN, MAX_ICONS, parent_class, and SEXY_ICON_ENTRY.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_unmap()

static void sexy_icon_entry_unmap ( GtkWidget *  widget)
static

Definition at line 230 of file sexy_icon_entry.c.

References SexyIconInfo::icon, _SexyIconEntryPriv::icons, MAX_ICONS, nsgtk_widget_get_mapped(), parent_class, _SexyIconEntry::priv, SEXY_ICON_ENTRY, and SexyIconInfo::window.

Referenced by sexy_icon_entry_class_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sexy_icon_entry_unrealize()

static void sexy_icon_entry_unrealize ( GtkWidget *  widget)
static

Definition at line 386 of file sexy_icon_entry.c.

References _SexyIconEntryPriv::icons, MAX_ICONS, parent_class, _SexyIconEntry::priv, SEXY_ICON_ENTRY, and SexyIconInfo::window.

Referenced by sexy_icon_entry_class_init().

Here is the caller graph for this function:

◆ update_icon()

static void update_icon ( GObject *  obj,
GParamSpec *  param,
SexyIconEntry entry 
)
static

Definition at line 663 of file sexy_icon_entry.c.

Referenced by sexy_icon_entry_button_press(), sexy_icon_entry_button_release(), sexy_icon_entry_enter_notify(), sexy_icon_entry_leave_notify(), and sexy_icon_entry_set_icon().

Here is the caller graph for this function:

Variable Documentation

◆ parent_class

GtkEntryClass* parent_class = NULL
static

◆ signals

guint signals[LAST_SIGNAL] = {0}
static