Revision 1514 src/gtkutils.c
| gtkutils.c (revision 1514) | ||
|---|---|---|
| 1 | 1 |
/* |
| 2 | 2 |
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client |
| 3 |
* Copyright (C) 1999-2006 Hiroyuki Yamamoto
|
|
| 3 |
* Copyright (C) 1999-2007 Hiroyuki Yamamoto
|
|
| 4 | 4 |
* |
| 5 | 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 | 6 |
* it under the terms of the GNU General Public License as published by |
| ... | ... | |
| 47 | 47 |
#include "codeconv.h" |
| 48 | 48 |
#include "menu.h" |
| 49 | 49 |
|
| 50 |
gboolean gtkut_get_font_size(GtkWidget *widget, gint *width, gint *height) |
|
| 50 |
gboolean gtkut_get_str_size(GtkWidget *widget, const gchar *str, |
|
| 51 |
gint *width, gint *height) |
|
| 51 | 52 |
{
|
| 52 | 53 |
PangoLayout *layout; |
| 53 |
const gchar *str = "Abcdef"; |
|
| 54 | 54 |
|
| 55 | 55 |
g_return_val_if_fail(GTK_IS_WIDGET(widget), FALSE); |
| 56 | 56 |
|
| 57 | 57 |
layout = gtk_widget_create_pango_layout(widget, str); |
| 58 | 58 |
g_return_val_if_fail(layout, FALSE); |
| 59 | 59 |
pango_layout_get_pixel_size(layout, width, height); |
| 60 |
if (width) |
|
| 61 |
*width = *width / g_utf8_strlen(str, -1); |
|
| 62 | 60 |
g_object_unref(layout); |
| 63 | 61 |
|
| 64 | 62 |
return TRUE; |
| 65 | 63 |
} |
| 66 | 64 |
|
| 65 |
gboolean gtkut_get_font_size(GtkWidget *widget, gint *width, gint *height) |
|
| 66 |
{
|
|
| 67 |
const gchar *str = "Abcdef"; |
|
| 68 |
gboolean ret; |
|
| 69 |
|
|
| 70 |
ret = gtkut_get_str_size(widget, str, width, height); |
|
| 71 |
if (ret && width) |
|
| 72 |
*width = *width / g_utf8_strlen(str, -1); |
|
| 73 |
|
|
| 74 |
return ret; |
|
| 75 |
} |
|
| 76 |
|
|
| 67 | 77 |
PangoFontDescription *gtkut_get_default_font_desc(void) |
| 68 | 78 |
{
|
| 69 | 79 |
static PangoFontDescription *font_desc = NULL; |
| ... | ... | |
| 262 | 272 |
|
| 263 | 273 |
g_signal_connect(G_OBJECT(combo->button), "size_request", |
| 264 | 274 |
G_CALLBACK(combo_button_size_request), combo); |
| 275 |
#if 0 |
|
| 265 | 276 |
g_signal_connect(G_OBJECT(combo->button), "enter", |
| 266 | 277 |
G_CALLBACK(combo_button_enter), combo); |
| 267 | 278 |
g_signal_connect(G_OBJECT(combo->button), "leave", |
| 268 | 279 |
G_CALLBACK(combo_button_leave), combo); |
| 280 |
#endif |
|
| 269 | 281 |
g_signal_connect(G_OBJECT(combo->arrow), "enter", |
| 270 | 282 |
G_CALLBACK(combo_button_enter), combo); |
| 271 | 283 |
g_signal_connect(G_OBJECT(combo->arrow), "leave", |
Also available in: Unified diff