/*
* =====================================================================================
*
* Filename: BuddyView.cpp
*
* Description: 显示好友列表的控件
*
* Version: 1.0
* Created: 2007年06月28日 19时26分39秒 CST
* Revision: none
* Compiler: gcc
*
* Author: wind (xihe), xihels@gmail.com
* Company: cyclone
*
* 纪念5.12汶川地震中消逝的那些生命
* =====================================================================================
*/
#include <glib/gi18n.h>
#include <fstream>
#include <unistd.h>
#include "BuddyView.h"
#include "BuddyList.h"
#include "Bodies.h"
#include "Unit.h"
#include "pixmaps.h"
#include "sounds.h"
#include "Unit.h"
#include "TreeViewTooltips.h"
#include "RoomItem.h"
#include "Buddy.h"
BuddyView::BuddyView(MainWindow & f_parent):
m_parent(f_parent)
, SHOWALL(false)
, EXPAND(false)
, m_filterText("")
{
set_headers_visible(false);
set_border_width(5);
set_name("icalk_blist_treeview");
add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_MOTION_MASK |
Gdk::BUTTON_PRESS_MASK | Gdk::
BUTTON_RELEASE_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::
LEAVE_NOTIFY_MASK);
m_tooltips = new TreeViewTooltips(this);
m_treestore = TreeModelDnd::create(buddyColumns);
//set_model(m_treestore);
m_treemodelfilter = Gtk::TreeModelFilter::create(m_treestore);
m_treemodelfilter->set_visible_func(sigc::mem_fun(*this, &BuddyView::
list_visible_func));
set_model(m_treemodelfilter);
append_column("ICON", buddyColumns.icon);
//set_show_expanders(false); //gtkmm 2.12
/*
Gtk::TreeView::Column * col =
Gtk::manage(new Gtk::TreeView::Column("iCalk"));
col->pack_start(buddyColumns.nickname, false); //false = don't expand
vector < Gtk::CellRenderer * >rends = col->get_cell_renderers();
col->clear_attributes(*rends[0]);
col->add_attribute(*rends[0], "markup", 1);
*/
Gtk::TreeView::Column * col =
Gtk::manage(new Gtk::TreeView::Column("iCalk"));
col->pack_start(m_rendtext);
//Tell the view column how to render the model values:
//将ViewColumn控件和Model values关联起来
col->set_cell_data_func(m_rendtext,
sigc::mem_fun(*this,
&BuddyView::
tvc_connect_cell_data));
//make the cellrenderer ellipsize
#ifdef GLIBMM_PROPERTIES_ENABLED
//m_rendtext.property_editable()=true;
m_rendtext.property_ellipsize() = Pango::ELLIPSIZE_END;
#else
m_rendtext.set_property("editable", ture);
#endif
m_rendtext.signal_editing_started().
connect(sigc::
mem_fun(*this,
&BuddyView::cellrender_on_editing_start));
m_rendtext.signal_edited().
connect(sigc::
mem_fun(*this, &BuddyView::cellrender_on_edited));
col->add_attribute(m_rendtext.property_markup(),
buddyColumns.nickname);
col->set_resizable(true);
col->set_expand();
this->append_column(*col);
this->append_column("Voip", buddyColumns.audioicon);
m_treestore->
set_default_sort_func(sigc::
mem_fun(*this,
&BuddyView::on_sort_compare));
m_treestore->
set_sort_column_id(Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID,
Gtk::SORT_ASCENDING);
//设置可托拽
this->enable_model_drag_source();
this->enable_model_drag_dest();
this->set_tooltip_window( *m_tooltips);
this->set_has_tooltip();
this->signal_query_tooltip().connect(sigc::mem_fun(*this,
&BuddyView::on_tooltip_show));
/*
this->signal_motion_notify_event().
connect(sigc::mem_fun(*this, &BuddyView::on_motion_event),
false);
this->signal_leave_notify_event().
connect(sigc::mem_fun(*this, &BuddyView::on_leave_event),
false);
*/
/*
this->signal_enter_notify_event().connect(sigc::mem_fun(
*this,&BuddyView::on_enter_event));
*/
show_all_children();
}
BuddyView::~BuddyView()
{
delete m_tooltips;
}
int BuddyView::on_sort_compare(const Gtk::TreeModel::iterator & a,
const Gtk::TreeModel::iterator & b)
{
int result;
if ((result =
(*a)[buddyColumns.status] - (*b)[buddyColumns.status]) == 0) {
Glib::ustring an = (*a)[buddyColumns.nickname];
Glib::ustring bn = (*b)[buddyColumns.nickname];
result = an.lowercase().compare(bn.lowercase());
}
return result;
}
bool BuddyView::on_motion_event(GdkEventMotion * ev)
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn * column;
int cell_x, cell_y;
if (m_tipTimeout.connected()) {
m_tipTimeout.disconnect();
m_tooltips->hideTooltip();
}
if (this->
get_path_at_pos((int) ev->x, (int) ev->y, path, column, cell_x,
cell_y)) {
Gtk::TreeModel::iterator iter =
this->get_model()->get_iter(path);
int type = (*iter)[buddyColumns.status];
int delay = 600;
if (STATUS_GROUP != type)
m_tipTimeout =
Glib::signal_timeout().connect(sigc::bind <
GdkEventMotion *
> (sigc::
mem_fun(*this,
&BuddyView::
tooltip_timeout),
ev), delay);
else
m_tooltips->hideTooltip();
} else
m_tooltips->hideTooltip();
return true;
}
bool BuddyView::on_tooltip_show(int x,int y, bool key_mode,const Glib::RefPtr<Gtk::Tooltip>& tooltip)
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn * column;
int cell_x, cell_y;
if (this->get_path_at_pos(x, y, path, column, cell_x,cell_y)){
Gtk::TreeModel::iterator iter =
this->get_model()->get_iter(path);
if (!iter)
return false;
int type = (*iter)[buddyColumns.status];
Glib::ustring jid = (*iter)[buddyColumns.id];
Glib::ustring text_, status_, status_sub, msg_;
if (STATUS_ROOM != type) {
Buddy *buddy =
Bodies::Get_Bodies().get_buddy_list().
find_buddy(jid);
if (NULL == buddy)
return false;
SubscriptionType substrEnum =
buddy->getSubscription();
status_sub = "<span weight='bold'>";
if (S10nBoth == substrEnum)
status_sub =
status_sub +
_("subscribed: </span>Both \n");
else
status_sub =
status_sub
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论



























收起资源包目录





































































































共 319 条
- 1
- 2
- 3
- 4
资源评论

- #完美解决问题
- #运行顺畅
- #内容详尽
- #全网独家
- #注释完整

处处清欢
- 粉丝: 2410
- 资源: 2904

下载权益

C知道特权

VIP文章

课程特权

开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- Tipszotero搜索引擎的设置,更好地抓取论文信息
- ,,MD500E源码和代码解析文档 代码包含了同步机FOC控制算法、电阻、电感、磁链、反电动势、死区补偿、过调制限制、弱磁等算法,支持无感和有感,亲自带电机运行过 ,关键词:MD500E源码; 代
- 基于 Java AIO 和 T-IO: 利用 Java 异步 I/O 和 T-IO 提供高效性能 支持常用的 Spring-Boot 注解,但不使用 Spring 的 IOC 和 AOP
- PyTorch开源机器学习库简介与入门教程-适用于AI开发
- Nova for mac 代码编辑工具
- ,,FOC 无感 混合磁链观测器 电机控制 代码 PMSM MiniDD(直驱)电机变频无感程序,包含偏心,重量,共振等感知算法,所有算法都不基于库函数,MCU底层配置完全手写 ,核心关键词:FO
- 5G+AI+物联网智慧医院信息化顶层设计解决方案 (1).ppt
- 大数据湖总体规划及一体化运营管理建设方案.ppt
- 大数据集群治理与数据治理解决方案.ppt
- ,,流水线贴膜机完成项目程序,包含PLC程序和触摸屏程序,程序内 包含上下气缸控制,夹紧气缸控制,输送带电机控制,贴膜伺服控制,旋转电机控制等类容,非常适合学习简单控制工艺及运动控制初学者学习,该程序
- Dynatrace资料视频,介绍如何使用Dynatrace
- 大数据平台应用功能蓝图、大数据平台数据治理解决方案.ppt
- 大数据平台数据治理体系与大数据架构技术方案.ppt
- 大数据平台应用功能蓝图与数据治理解决方案.ppt
- ,,国内新能源汽车巨头某车型电机控制器软件源代码 ,基于TI 28x平台,含核心算法,全部开源,注释详细,程序规范,包含永磁同步电机FOC矢量控制算法、坡起辅助 、怠速蠕行、刹车油门扭矩协调、缺相诊断
- 大数据治理平台总体架构、技术架构、功能架构及数据应用解决方案.ppt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
