本文整理汇总了C++中GNT_WIDGET函数的典型用法代码示例。如果您正苦于以下问题:C++ GNT_WIDGET函数的具体用法?C++ GNT_WIDGET怎么用?C++ GNT_WIDGET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GNT_WIDGET函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: readjust_columns
static void
readjust_columns(GntTree *tree)
{
int i, col, total;
int width;
#define WIDTH(i) (tree->columns[i].width_ratio ? tree->columns[i].width_ratio : tree->columns[i].width)
gnt_widget_get_size(GNT_WIDGET(tree), &width, NULL);
if (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_NO_BORDER))
width -= 2;
width -= 1; /* Exclude the scrollbar from the calculation */
for (i = 0, total = 0; i < tree->ncol ; i++) {
if (tree->columns[i].flags & GNT_TREE_COLUMN_INVISIBLE)
continue;
if (tree->columns[i].flags & GNT_TREE_COLUMN_FIXED_SIZE)
width -= WIDTH(i) + (tree->priv->lastvisible != i);
else
total += WIDTH(i) + (tree->priv->lastvisible != i);
}
if (total == 0)
return;
for (i = 0; i < tree->ncol; i++) {
if (tree->columns[i].flags & GNT_TREE_COLUMN_INVISIBLE)
continue;
if (tree->columns[i].flags & GNT_TREE_COLUMN_FIXED_SIZE)
col = WIDTH(i);
else
col = (WIDTH(i) * width) / total;
gnt_tree_set_col_width(GNT_TREE(tree), i, col);
}
}
开发者ID:crodjer,项目名称:pidgin_whiteboard,代码行数:32,代码来源:gnttree.c
示例2: menuitem_activate
static void
menuitem_activate(GntMenu *menu, GntMenuItem *item)
{
if (!item)
return;
if (gnt_menuitem_activate(item)) {
menu_hide_all(menu);
} else {
if (item->submenu) {
GntMenu *sub = GNT_MENU(item->submenu);
menu->submenu = sub;
sub->type = GNT_MENU_POPUP; /* Submenus are *never* toplevel */
sub->parentmenu = menu;
if (menu->type != GNT_MENU_TOPLEVEL) {
GntWidget *widget = GNT_WIDGET(menu);
item->priv.x = widget->priv.x + widget->priv.width - 1;
item->priv.y = widget->priv.y + gnt_tree_get_selection_visible_line(GNT_TREE(menu));
}
gnt_widget_set_position(GNT_WIDGET(sub), item->priv.x, item->priv.y);
GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(sub), GNT_WIDGET_INVISIBLE);
gnt_widget_draw(GNT_WIDGET(sub));
} else {
menu_hide_all(menu);
}
}
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:27,代码来源:gntmenu.c
示例3: gnt_text_view_reflow
static void
gnt_text_view_reflow(GntTextView *view)
{
/* This is pretty ugly, and inefficient. Someone do something about it. */
GntTextLine *line;
GList *back, *iter, *list;
GString *string;
int pos = 0; /* no. of 'real' lines */
list = view->list;
while (list->prev) {
line = list->data;
if (!line->soft)
pos++;
list = list->prev;
}
back = g_list_last(view->list);
view->list = NULL;
string = view->string;
view->string = NULL;
reset_text_view(view);
view->string = g_string_set_size(view->string, string->len);
view->string->len = 0;
GNT_WIDGET_SET_FLAGS(GNT_WIDGET(view), GNT_WIDGET_DRAWING);
for (; back; back = back->prev) {
line = back->data;
if (back->next && !line->soft) {
gnt_text_view_append_text_with_flags(view, "\n", GNT_TEXT_FLAG_NORMAL);
}
for (iter = line->segments; iter; iter = iter->next) {
GntTextSegment *seg = iter->data;
char *start = string->str + seg->start;
char *end = string->str + seg->end;
char back = *end;
*end = '\0';
gnt_text_view_append_text_with_flags(view, start, seg->tvflag);
*end = back;
}
free_text_line(line, NULL);
}
g_list_free(list);
list = view->list = g_list_first(view->list);
/* Go back to the line that was in view before resizing started */
while (pos--) {
while (((GntTextLine*)list->data)->soft)
list = list->next;
list = list->next;
}
view->list = list;
GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(view), GNT_WIDGET_DRAWING);
if (GNT_WIDGET(view)->window)
gnt_widget_draw(GNT_WIDGET(view));
g_string_free(string, TRUE);
}
开发者ID:Distrotech,项目名称:pidgin,代码行数:60,代码来源:gnttextview.c
示例4: location_changed
static gboolean
location_changed(GntFileSel *sel, GError **err)
{
GList *files, *iter;
gboolean success;
if (!sel->dirs)
return TRUE;
gnt_tree_remove_all(GNT_TREE(sel->dirs));
if (sel->files)
gnt_tree_remove_all(GNT_TREE(sel->files));
gnt_entry_set_text(GNT_ENTRY(sel->location), NULL);
if (sel->current == NULL) {
if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(sel), GNT_WIDGET_MAPPED))
gnt_widget_draw(GNT_WIDGET(sel));
return TRUE;
}
/* XXX:\
* XXX: This is blocking.
* XXX:/
*/
files = NULL;
if (sel->read_fn)
success = sel->read_fn(sel->current, &files, err);
else
success = local_read_fn(sel->current, &files, err);
if (!success || *err) {
gnt_warning("error opening location %s (%s)",
sel->current, *err ? (*err)->message : "reason unknown");
return FALSE;
}
for (iter = files; iter; iter = iter->next) {
GntFile *file = iter->data;
char *str = file->basename;
if (file->type == GNT_FILE_DIR) {
gnt_tree_add_row_after(GNT_TREE(sel->dirs), g_strdup(str),
gnt_tree_create_row(GNT_TREE(sel->dirs), str), NULL, NULL);
if (sel->multiselect && sel->dirsonly && is_tagged(sel, str))
gnt_tree_set_row_flags(GNT_TREE(sel->dirs), (gpointer)str, GNT_TEXT_FLAG_BOLD);
} else if (!sel->dirsonly) {
char size[128];
snprintf(size, sizeof(size), "%ld", file->size);
gnt_tree_add_row_after(GNT_TREE(sel->files), g_strdup(str),
gnt_tree_create_row(GNT_TREE(sel->files), str, size, ""), NULL, NULL);
if (sel->multiselect && is_tagged(sel, str))
gnt_tree_set_row_flags(GNT_TREE(sel->files), (gpointer)str, GNT_TEXT_FLAG_BOLD);
}
}
g_list_foreach(files, (GFunc)gnt_file_free, NULL);
g_list_free(files);
if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(sel), GNT_WIDGET_MAPPED))
gnt_widget_draw(GNT_WIDGET(sel));
return TRUE;
}
开发者ID:bf4,项目名称:pidgin-mac,代码行数:59,代码来源:gntfilesel.c
示例5: move_end
static gboolean
move_end(GntBindable *bind, GList *null)
{
GntEntry *entry = GNT_ENTRY(bind);
entry->cursor = entry->end;
/* This should be better than this */
while (gnt_util_onscreen_width(entry->scroll, entry->cursor) >= GNT_WIDGET(entry)->priv.width)
entry->scroll = g_utf8_find_next_char(entry->scroll, NULL);
entry_redraw(GNT_WIDGET(entry));
update_kill_ring(entry, ENTRY_JAIL, NULL, 0);
return TRUE;
}
开发者ID:mclarkelauer,项目名称:HoneyIM,代码行数:12,代码来源:gntentry.c
示例6: move_forward
static gboolean
move_forward(GntBindable *bind, GList *list)
{
GntEntry *entry = GNT_ENTRY(bind);
if (entry->cursor >= entry->end)
return FALSE;
entry->cursor = g_utf8_find_next_char(entry->cursor, NULL);
while (gnt_util_onscreen_width(entry->scroll, entry->cursor) >= GNT_WIDGET(entry)->priv.width)
entry->scroll = g_utf8_find_next_char(entry->scroll, NULL);
update_kill_ring(entry, ENTRY_JAIL, NULL, 0);
entry_redraw(GNT_WIDGET(entry));
return TRUE;
}
开发者ID:mclarkelauer,项目名称:HoneyIM,代码行数:13,代码来源:gntentry.c
示例7: set_selection
static void
set_selection(GntComboBox *box, gpointer key)
{
if (box->selected != key)
{
/* XXX: make sure the key actually does exist */
gpointer old = box->selected;
box->selected = key;
if (GNT_WIDGET(box)->window)
gnt_widget_draw(GNT_WIDGET(box));
if (box->dropdown)
gnt_tree_set_selected(GNT_TREE(box->dropdown), key);
g_signal_emit(box, signals[SIG_SELECTION_CHANGED], 0, old, key);
}
}
开发者ID:Distrotech,项目名称:pidgin,代码行数:15,代码来源:gntcombobox.c
示例8: menu_hide_all
static void
menu_hide_all(GntMenu *menu)
{
while (menu->parentmenu)
menu = menu->parentmenu;
gnt_widget_hide(GNT_WIDGET(menu));
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:7,代码来源:gntmenu.c
示例9: complete_suggest
static gboolean
complete_suggest(GntEntry *entry, const char *text)
{
int offstart = 0, offend = 0;
if (entry->word) {
char *s = get_beginning_of_word(entry);
const char *iter = text;
offstart = g_utf8_pointer_to_offset(entry->start, s);
while (*iter && toupper(*s) == toupper(*iter)) {
*s++ = *iter++;
}
if (*iter) {
gnt_entry_key_pressed(GNT_WIDGET(entry), iter);
}
offend = g_utf8_pointer_to_offset(entry->start, entry->cursor);
} else {
offstart = 0;
gnt_entry_set_text_internal(entry, text);
offend = g_utf8_strlen(text, -1);
}
g_signal_emit(G_OBJECT(entry), signals[SIG_COMPLETION], 0,
entry->start + offstart, entry->start + offend);
update_kill_ring(entry, ENTRY_JAIL, NULL, 0);
return TRUE;
}
开发者ID:mclarkelauer,项目名称:HoneyIM,代码行数:27,代码来源:gntentry.c
示例10: redraw_slider
static void
redraw_slider(GntSlider *slider)
{
GntWidget *widget = GNT_WIDGET(slider);
if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED))
gnt_widget_draw(widget);
}
开发者ID:bf4,项目名称:pidgin-mac,代码行数:7,代码来源:gntslider.c
示例11: entry_yank
static gboolean
entry_yank(GntBindable *bind, GList *null)
{
GntEntry *entry = GNT_ENTRY(bind);
gnt_entry_key_pressed(GNT_WIDGET(entry), entry->killring->buffer->str);
return TRUE;
}
开发者ID:mclarkelauer,项目名称:HoneyIM,代码行数:7,代码来源:gntentry.c
示例12: transpose_chars
static gboolean
transpose_chars(GntBindable *bind, GList *null)
{
GntEntry *entry = GNT_ENTRY(bind);
char *current, *prev;
char hold[8]; /* that's right */
if (entry->cursor <= entry->start)
return FALSE;
if (!*entry->cursor)
entry->cursor = g_utf8_find_prev_char(entry->start, entry->cursor);
current = entry->cursor;
prev = g_utf8_find_prev_char(entry->start, entry->cursor);
move_forward(bind, null);
/* Let's do this dance! */
memcpy(hold, prev, current - prev);
memmove(prev, current, entry->cursor - current);
memcpy(prev + (entry->cursor - current), hold, current - prev);
update_kill_ring(entry, ENTRY_JAIL, NULL, 0);
entry_redraw(GNT_WIDGET(entry));
entry_text_changed(entry);
return TRUE;
}
开发者ID:mclarkelauer,项目名称:HoneyIM,代码行数:27,代码来源:gntentry.c
示例13: del_prev_word
static gboolean
del_prev_word(GntBindable *bind, GList *null)
{
GntWidget *widget = GNT_WIDGET(bind);
GntEntry *entry = GNT_ENTRY(bind);
char *iter = g_utf8_find_prev_char(entry->start, entry->cursor);
int count;
if (iter < entry->start)
return TRUE;
iter = (char*)begin_word(iter, entry->start);
count = entry->cursor - iter;
update_kill_ring(entry, ENTRY_DEL_BWD_WORD, iter, count);
memmove(iter, entry->cursor, entry->end - entry->cursor);
entry->end -= count;
entry->cursor = iter;
if (entry->cursor <= entry->scroll) {
entry->scroll = entry->cursor - widget->priv.width + 2;
if (entry->scroll < entry->start)
entry->scroll = entry->start;
}
memset(entry->end, '\0', entry->buffer - (entry->end - entry->start));
entry_redraw(widget);
entry_text_changed(entry);
return TRUE;
}
开发者ID:mclarkelauer,项目名称:HoneyIM,代码行数:27,代码来源:gntentry.c
示例14: check_for_trigger
static gboolean
check_for_trigger(GntMenu *menu, char trigger)
{
/* check for a trigger key */
GList *iter;
GList *find;
GList *nth = g_list_find(menu->list, gnt_tree_get_selection_data(GNT_TREE(menu)));
if (nth == NULL)
return FALSE;
find = find_item_with_trigger(nth->next, NULL, trigger);
if (!find)
find = find_item_with_trigger(menu->list, nth->next, trigger);
if (!find)
return FALSE;
if (find != nth) {
gnt_tree_set_selected(GNT_TREE(menu), find->data);
iter = find_item_with_trigger(find->next, NULL, trigger);
if (iter != NULL && iter != find)
return TRUE;
iter = find_item_with_trigger(menu->list, nth, trigger);
if (iter != NULL && iter != find)
return TRUE;
}
gnt_widget_activate(GNT_WIDGET(menu));
return TRUE;
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:28,代码来源:gntmenu.c
示例15: backspace
static gboolean
backspace(GntBindable *bind, GList *null)
{
int len;
GntEntry *entry = GNT_ENTRY(bind);
if (entry->cursor <= entry->start)
return TRUE;
len = entry->cursor - g_utf8_find_prev_char(entry->start, entry->cursor);
update_kill_ring(entry, ENTRY_JAIL, entry->cursor, -len);
entry->cursor -= len;
memmove(entry->cursor, entry->cursor + len, entry->end - entry->cursor);
entry->end -= len;
if (entry->scroll > entry->start)
entry->scroll = g_utf8_find_prev_char(entry->start, entry->scroll);
entry_redraw(GNT_WIDGET(entry));
if (entry->ddown)
show_suggest_dropdown(entry);
entry_text_changed(entry);
return TRUE;
}
开发者ID:mclarkelauer,项目名称:HoneyIM,代码行数:25,代码来源:gntentry.c
示例16: gnt_box_size_request
static void
gnt_box_size_request(GntWidget *widget)
{
GntBox *box = GNT_BOX(widget);
GList *iter;
int maxw = 0, maxh = 0;
g_list_foreach(box->list, (GFunc)gnt_widget_size_request, NULL);
for (iter = box->list; iter; iter = iter->next)
{
int w, h;
gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h);
if (maxh < h)
maxh = h;
if (maxw < w)
maxw = w;
}
for (iter = box->list; iter; iter = iter->next)
{
int w, h;
GntWidget *wid = GNT_WIDGET(iter->data);
gnt_widget_get_size(wid, &w, &h);
if (box->homogeneous)
{
if (box->vertical)
h = maxh;
else
w = maxw;
}
if (box->fill)
{
if (box->vertical)
w = maxw;
else
h = maxh;
}
gnt_widget_confirm_size(wid, w, h);
gnt_widget_set_size(wid, w, h);
}
reposition_children(widget);
}
开发者ID:wosigh,项目名称:messaging-plugins,代码行数:47,代码来源:gntbox.c
示例17: gnt_screen_menu_show
gboolean gnt_screen_menu_show(gpointer newmenu)
{
if (wm->menu) {
/* For now, if a menu is being displayed, then another menu
* can NOT take over. */
return FALSE;
}
wm->menu = newmenu;
GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(wm->menu), GNT_WIDGET_INVISIBLE);
gnt_widget_draw(GNT_WIDGET(wm->menu));
g_signal_connect(G_OBJECT(wm->menu), "hide", G_CALLBACK(reset_menu), NULL);
g_signal_connect(G_OBJECT(wm->menu), "destroy", G_CALLBACK(reset_menu), NULL);
return TRUE;
}
开发者ID:Lilitana,项目名称:Pidgin,代码行数:17,代码来源:gntmain.c
示例18: move_start
static gboolean
move_start(GntBindable *bind, GList *null)
{
GntEntry *entry = GNT_ENTRY(bind);
entry->scroll = entry->cursor = entry->start;
entry_redraw(GNT_WIDGET(entry));
update_kill_ring(entry, ENTRY_JAIL, NULL, 0);
return TRUE;
}
开发者ID:mclarkelauer,项目名称:HoneyIM,代码行数:9,代码来源:gntentry.c
示例19: finch_notify_userinfo
static void *
finch_notify_userinfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info)
{
char *primary;
char *info;
void *ui_handle;
char *key = userinfo_hash(purple_connection_get_account(gc), who);
info = purple_notify_user_info_get_xhtml(user_info);
ui_handle = g_hash_table_lookup(userinfo, key);
if (ui_handle != NULL) {
GntTextView *msg = GNT_TEXT_VIEW(g_object_get_data(G_OBJECT(ui_handle), "info-widget"));
char *strip = purple_markup_strip_html(info);
int tvw, tvh, width, height, ntvw, ntvh;
while (GNT_WIDGET(ui_handle)->parent)
ui_handle = GNT_WIDGET(ui_handle)->parent;
gnt_widget_get_size(GNT_WIDGET(ui_handle), &width, &height);
gnt_widget_get_size(GNT_WIDGET(msg), &tvw, &tvh);
gnt_text_view_clear(msg);
if (!gnt_util_parse_xhtml_to_textview(info, msg))
gnt_text_view_append_text_with_flags(msg, strip, GNT_TEXT_FLAG_NORMAL);
gnt_text_view_scroll(msg, 0);
gnt_util_get_text_bound(strip, &ntvw, &ntvh);
ntvw += 3;
ntvh++;
gnt_screen_resize_widget(GNT_WIDGET(ui_handle), width + MAX(0, ntvw - tvw), height + MAX(0, ntvh - tvh));
g_free(strip);
g_free(key);
} else {
primary = g_strdup_printf(_("Info for %s"), who);
ui_handle = finch_notify_formatted(_("Buddy Information"), primary, NULL, info);
g_hash_table_insert(userinfo, key, ui_handle);
g_free(primary);
g_signal_connect(G_OBJECT(ui_handle), "destroy", G_CALLBACK(remove_userinfo), key);
}
g_free(info);
return ui_handle;
}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:43,代码来源:gntnotify.c
示例20: gnt_menu_hide
static void
gnt_menu_hide(GntWidget *widget)
{
GntMenu *sub, *menu = GNT_MENU(widget);
while ((sub = menu->submenu))
gnt_widget_hide(GNT_WIDGET(sub));
if (menu->parentmenu)
menu->parentmenu->submenu = NULL;
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:10,代码来源:gntmenu.c
注:本文中的GNT_WIDGET函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论