WindowLevelToolButton::WindowLevelToolButton() {
	Gtk::HBox* hbox = manage(new Gtk::HBox);

	Gtk::Image* image = manage(new Gtk::Image);
	Glib::RefPtr<Gdk::Pixbuf> p = Aeskulap::IconFactory::load_from_file("cursor_windowlevel.png");
	if(p) {
		image->set(p);
	}
	image->show();
	//image->set_padding(6, 0);

	m_invert = manage(new Gtk::ToggleToolButton(*image));
	m_invert->set_size_request(32, 32);
	m_invert->set_tooltip(m_tooltips, gettext("Invert windowlevel"));
	m_invert->show();
	m_invert->signal_toggled().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_invert));

	Gtk::VBox* vbox = manage(new Gtk::VBox);

	vbox->pack_start(*m_invert, true, false);
	vbox->show();

	hbox->pack_start(*vbox, Gtk::PACK_SHRINK);

	vbox = manage(new Gtk::VBox);
	vbox->show();

	m_combo = manage(new Gtk::ComboBoxText);
	m_combo->set_size_request(-1, 32);
	m_combo->show();
	m_combo->signal_changed().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_changed));

	vbox->pack_start(*m_combo, true, false);

	hbox->pack_start(*vbox, Gtk::PACK_SHRINK);

	vbox = manage(new Gtk::VBox);
	vbox->show();

	image = manage(new Gtk::Image(Gtk::Stock::ADD, Gtk::ICON_SIZE_SMALL_TOOLBAR));
	image->show();

	Gtk::ToolButton* btn = manage(new Gtk::ToolButton(*image));
	btn->set_size_request(32, 32);
	btn->set_tooltip(m_tooltips, gettext("Add new windowlevel preset"));
	btn->show();
	btn->signal_clicked().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_add));

	vbox->pack_start(*btn, true, false);
	hbox->pack_start(*vbox, true,false);
	
	hbox->show();

	add(*hbox);

	update();
	m_widgetlist.insert(this);
}
示例#2
0
void VRGuiNet_on_del_clicked(GtkButton*, gpointer data) {
    Glib::RefPtr<Gtk::TreeView> tree_view  = Glib::RefPtr<Gtk::TreeView>::cast_static(VRGuiBuilder()->get_object("treeview9"));
    Gtk::TreeModel::iterator iter = tree_view->get_selection()->get_selected();
    if(!iter) return;

    VRGuiNet_SocketCols cols;
    Gtk::TreeModel::Row row = *iter;
    string name = row.get_value(cols.name);

    string msg1 = "Delete socket " + name;
    if (!askUser(msg1, "Are you sure you want to delete this socket?")) return;
    VRSceneManager::getCurrent()->remSocket(name);

    Glib::RefPtr<Gtk::ListStore> list_store  = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("Sockets"));
    list_store->erase(iter);

    Gtk::ToolButton* b;
    VRGuiBuilder()->get_widget("toolbutton15", b);
    b->set_sensitive(false);
}
void VentanaCliente::initBotones() {
    Gtk::ToolButton* pAux;

    get_widget(BOTON_CONECTAR, pAux);
    botones[BOTON_CONECTAR] = pAux;
    pAux->signal_clicked().connect(sigc::mem_fun(*this,
                                   &VentanaCliente::on_conectar_button_clicked));

    get_widget(BOTON_ACTUALIZAR, pAux);
    botones[BOTON_ACTUALIZAR] = pAux;
    pAux->signal_clicked().connect(sigc::mem_fun(*this,
                                   &VentanaCliente::on_actualizar_button_clicked));

    get_widget(BOTON_DETENER_ACTUALIZAR, pAux);
    botones[BOTON_DETENER_ACTUALIZAR] = pAux;
    pAux->signal_clicked().connect(sigc::mem_fun(*this,
                                   &VentanaCliente::on_detenerActualizar_button_clicked));

    get_widget(BOTON_CONFIGURAR, pAux);
    botones[BOTON_CONFIGURAR] = pAux;
    pAux->signal_clicked().connect(sigc::mem_fun(*this,
                                   &VentanaCliente::on_configurar_button_clicked));

    get_widget(BOTON_SALIR, pAux);
    botones[BOTON_SALIR] = pAux;
    pAux->signal_clicked().connect(sigc::mem_fun(*this,
                                   &VentanaCliente::on_salir_button_clicked));
}
示例#4
0
ParticlePreview::ParticlePreview()
{
    // Add one additional toolbar for particle-related stuff
    Gtk::Toolbar* toolbar = Gtk::manage(new Gtk::Toolbar);
    toolbar->set_toolbar_style(Gtk::TOOLBAR_ICONS);

    _showAxesButton = Gtk::manage(new Gtk::ToggleToolButton);
    _showAxesButton->signal_toggled().connect(
        sigc::mem_fun(this, &ParticlePreview::queue_draw)
    );
    _showAxesButton->set_icon_widget(*Gtk::manage(new Gtk::Image(
        GlobalUIManager().getLocalPixbufWithMask("axes.png"))));
    _showAxesButton->set_tooltip_text(_("Show coordinate axes"));

    Gtk::ToolButton* reloadButton = Gtk::manage(new Gtk::ToolButton);
    reloadButton->set_icon_widget(*Gtk::manage(new Gtk::Image(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU)));
    reloadButton->set_tooltip_text(_("Reload Particle Defs"));
    IEventPtr ev = GlobalEventManager().findEvent("ReloadParticles");
    ev->connectWidget(reloadButton);

    _showWireFrameButton = Gtk::manage(new Gtk::ToggleToolButton);
    _showWireFrameButton->set_icon_widget(*Gtk::manage(new Gtk::Image(
        GlobalUIManager().getLocalPixbufWithMask("wireframe.png"))));
    _showWireFrameButton->set_tooltip_text(_("Show wireframe"));
    _showWireFrameButton->signal_toggled().connect(
        sigc::mem_fun(this, &ParticlePreview::queue_draw)
    );

    _automaticLoopButton = Gtk::manage(new Gtk::ToggleToolButton(_("Auto Loop")));
    _automaticLoopButton->set_tooltip_text(_("Auto Loop"));

    toolbar->insert(*_showAxesButton, 0);
    toolbar->insert(*_showWireFrameButton, 0);
    toolbar->insert(*_automaticLoopButton, 0);
    toolbar->insert(*reloadButton, 0);

    addToolbar(*toolbar);
}
示例#5
0
int common___::proc__(std::deque<Glib::ustring>* p,char*buf,long siz,char**addr_ret,void*shangji,void*ce) {
	const Glib::ustring& p0=(*p)[0];

	if(p0=="剪贴板"){
		if(siz==-1)return 1;
		Glib::RefPtr<Gtk::Clipboard> cb = Gtk::Clipboard::get();
		if(p->size()>1)
			cb->set_text((*p)[1].c_str());
		else
			*addr_ret=dup__(cb->wait_for_text().c_str());
		return 1;
	}
	if(p0=="全屏"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->fullscreen();
		return 1;
	}
	if(p0=="取消全屏"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->unfullscreen();
		return 1;
	}
	if(p0=="置顶"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->set_keep_above(true);
		return 1;
	}
	if(p0=="取消置顶"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->set_keep_above(false);
		return 1;
	}
	if(p0=="无边框"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->set_decorated(false);
		return 1;
	}
	if(p0=="跳过任务栏"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->set_skip_taskbar_hint(true);
		return 1;
	}
	if(p0=="窗口活动"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		cpy__(buf,w->property_is_active(),siz);
		return 1;
	}
	if(p0=="图标"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,2);
		if(!w)
			return 1;
		if(p->size()>1){
			const Glib::ustring& p1=(*p)[1];
			w->set_icon_name(p1);
			Glib::RefPtr<Gdk::Pixbuf> pb=Gdk::Pixbuf::create_from_file(p1);
			if(pb)
				w->set_icon(pb);
		}else
			cpy__(buf,w->get_icon_name().c_str(),siz);
		return 1;
	}

	if(p->size()<2){
		return 0;
	}
	const Glib::ustring& p1=(*p)[1];

	Gtk::Entry* e;
	Gtk::Label* l;
	Gtk::Button* b;
	Gtk::ToolButton* tb;
	Gtk::TextView* tv;
	Gtk::Notebook* n;
	Gtk::Bin* bI;
	Gtk::Widget* w;
	Gtk::Statusbar* sB;
	Gtk::FileChooserButton* fcb;
	Gtk::ToggleButton* tOb;//CheckButton RadioButton
	Gtk::ToggleToolButton*ttb;
	//Gtk::RadioButtonGroup* rbg;
	Gtk::MenuItem* mi;
	Gtk::CheckMenuItem* cmi;
	Gtk::SpinButton* sb;

	if(p0=="窗口标题"){
		if(siz==-1)return 1;
		Gtk::Window* w1;
		if(p1=="")
			w1=sh_->main_win_;
		else{
			sh_->builder_->get_widget(p1, w);
			if(!w){
				d_(sh_,err_show_wufa_,2,p,1);
				return 1;
			}
			w1=(Gtk::Window*)w;
		}
		if(p->size()<3){
			cpy__(buf,w1->get_title().c_str(),siz);
		}else{
			w1->set_title((*p)[2]);
		}
		return 1;
	}

	if(p0=="内容"){
		if(siz==-1)return 1;
		Glib::ustring text;
		bool read=false;
		int start=2;
		if(p->size()>2&&(*p)[2]=="读取"){
			read=true;
			start=3;
		}
		for(size_t i=start;i<p->size();i++){
			if((*p)[i]=="源码")
				text+=sh_->src_;
			else{
				if(read){
					string name=sh_->ui_file_;
					size_t i1=name.rfind('/');
					if(i1==string::npos)
						i1=name.rfind('\\');
					if(i1!=string::npos)
						name=name.substr(0,i1+1);
					name+=(*p)[i];
					file_get__(name.c_str(),text);
				}else
					text+=(*p)[i];
			}
		}
		if(p1=="源码"){
			if(p->size()>2)
				sh_->src_=text;
			else
				*addr_ret=dup__(sh_->src_.c_str());
			return 1;
		}else{
			sh_->builder_->get_widget(p1, sb);
			if(sb){
				if(p->size()>2){
					float f=0;
					sscanf(text.c_str(),"%f",&f);
					sb->set_value(f);
					return 1;
				}
			}
			sh_->builder_->get_widget(p1, e);
			if(e){
				if(p->size()<3){
					*addr_ret=dup__(e->get_text().c_str());
				}else{
					e->set_text(text);
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, l);
			if(l){
				if(p->size()<3){
					*addr_ret=dup__(l->get_text().c_str());
				}else{
					l->set_markup(text);
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, tv);
			if(tv){
				if(p->size()<3){
					*addr_ret=dup__(tv->get_buffer()->get_text().c_str());
				}else{
					tv->get_buffer()->set_text(text);
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, fcb);
			if(fcb){
				if(p->size()<3){
					*addr_ret=dup__(fcb->get_filename().c_str());
				}else{
					fcb->set_filename(text);

					  /*GtkFileChooser *chooser=(GtkFileChooser *)fcb->gobj();
					  const gchar    *filename=text.c_str();
					  gtk_file_chooser_unselect_all (chooser);
					  //gtk_file_chooser_select_filename (chooser, filename);
					  GFile *file;
					  gboolean result;
					  file = g_file_new_for_path (filename);
					  result = gtk_file_chooser_select_file (chooser, file, NULL);
//#define GTK_FILE_CHOOSER_GET_IFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FILE_CHOOSER, GtkFileChooserIface))
					  //result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->select_file (chooser, file, NULL);
					  g_object_unref (file);*/
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, tOb);
			if(tOb){
				if(p->size()<3){
					cpy__(buf,tOb->get_label().c_str(),siz);
				}else{
					tOb->set_label(text);
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, sB);
			if(sB){
				if(p->size()<3){
				}else{
					sB->push(text,sB->get_context_id(text));
					return 1;
				}
			}
			sh_->builder_->get_widget(p1, n);
			if(n){
				if(p->size()<3){
					cpy__(buf,n->get_current_page()+1,siz);
				}else{
					n->set_current_page(s2i__(text,1)-1);
				}
				return 1;
			}
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="勾选"){
		if(siz==-1)return 1;
		if(p->size()>2){
			bool b=d_(sh_,bool_,(*p)[p->size()-1].c_str());
			for(size_t i=1;i<p->size()-1;i++){
				sh_->builder_->get_widget((*p)[i], tOb);
				if(tOb){
					tOb->set_active(b);
					continue;
				}
				sh_->builder_->get_widget((*p)[i], ttb);
				if(ttb){
					ttb->set_active(b);
					continue;
				}
				sh_->builder_->get_widget((*p)[i], cmi);
				if(cmi){
					cmi->set_active(b);
					continue;
				}
				d_(sh_,err_show_wufa_,2,p,i);
				return 1;
			}
		}else{
			sh_->builder_->get_widget(p1, tOb);
			if(tOb){
				cpy__(buf,tOb->get_active(),siz);
				return 1;
			}
			sh_->builder_->get_widget(p1, ttb);
			if(ttb){
				cpy__(buf,ttb->get_active(),siz);
				return 1;
			}
			sh_->builder_->get_widget(p1, cmi);
			if(cmi){
				cpy__(buf,cmi->get_active(),siz);
				return 1;
			}
			d_(sh_,err_show_wufa_,2,p,1);
		}
		return 1;
	}
	if(p0=="提示文字"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			if(p->size()<3){
				cpy__(buf,w->get_tooltip_markup().c_str(),siz);
			}else{
				w->set_tooltip_markup((*p)[2]);
			}
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="焦点"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			w->grab_focus();
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="侦听"){
		if(siz==-1)return 1;
		if(p->size()>2){
			if(p1=="点击"){
				Glib::ustring code;
				size_t size=p->size();
				if(size>=4)
					code=(*p)[--size];
				for(size_t i=2;i<size;i++){
					if((*p)[i].length()==0)
						continue;
					Glib::SignalProxy0< void >* sp0=NULL;
					Glib::SignalProxy1< bool, GdkEventButton* >* sp1=NULL;
					Glib::ustring dong;
					bI=NULL;
					w=NULL;
					for(;;){
						sh_->builder_->get_widget((*p)[i], b);
						if(b){
							bI=b;
							w=b;
							dong=b->get_label();
							sp0=&b->signal_clicked();
							break;
						}

						sh_->builder_->get_widget((*p)[i], tb);
						if(tb){
							bI=tb;
							w=tb;
							dong=tb->get_label();
							sp0=&tb->signal_clicked();
							break;
						}

						sh_->builder_->get_widget((*p)[i], mi);
						if(mi){
							bI=mi;
							w=mi;
							sp1=&mi->signal_button_press_event();
							break;
						}

						sh_->builder_->get_widget((*p)[i], w);
						if(w){
							sp1=&w->signal_button_press_event();
							break;
						}

						d_(sh_,err_show_wufa_,3,p,i,0);
						return 1;
					}

					if(w){
						const char*arg4;
						if(dong.empty()){
							dong=(*p)[i];
							arg4=NULL;
						}else
							arg4=(*p)[i].c_str();
						control___* c;
						const char*zhao;
						const char*arg3;
						//不buf会乱指
						Glib::ustring buf3;
						if(w==mi){
							zhao="菜单";
							buf3=mi->get_label();
						}else{
							zhao=bI!=NULL?"按钮":p1.c_str();
							buf3=w->get_tooltip_text();
						}
						arg3=buf3.c_str();
						if(!arg4)
							c=new control___(zhao,dong.c_str(),sh_,d_,code.c_str(),arg3);
						else
							c=new control___(zhao,dong.c_str(),sh_,d_,code.c_str(),arg3,arg4);
						if(sp0)
							sp0->connect(sigc::mem_fun(*c, &control___::on__));
						else if(sp1)
							sp1->connect(sigc::mem_fun(*c, &control___::on1__));
						w->set_data("ctl",c);
						if(p->size()==4)
							break;
					}
				}
				return 1;
			}
			d_(sh_,err_show_wufa_,2,p,1);
			return 1;
		}
		d_(sh_,err_show_buzu_,p);
		return 1;
	}
	if(p0=="点击"){
		if(siz==-1)return 1;
		for(size_t i=1;i<p->size();i++){
			w=NULL;
			for(;;){
				sh_->builder_->get_widget((*p)[i], b);
				if(b){
					w=b;
					break;
				}
				sh_->builder_->get_widget((*p)[i], tb);
				if(tb){
					w=tb;
					break;
				}
				sh_->builder_->get_widget((*p)[i], mi);
				if(mi){
					w=mi;
					break;
				}
				sh_->builder_->get_widget((*p)[i], w);
				if(w){
					break;
				}
				d_(sh_,err_show_wufa_,3,p,i,0);
				return 1;
			}
			control___* c=(control___*)w->get_data("ctl");
			if(!c){
				d_(sh_,err_show_wufa_,3,p,i,0);
				return 1;
			}
			c->on__();
		}
		return 1;
	}
	if(p0=="可见"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			if(p->size()>2){
				bool b=d_(sh_,bool_,(*p)[p->size()-1].c_str());
				for(size_t i=1;i<p->size()-1;i++){
					sh_->builder_->get_widget((*p)[i], w);
					if(w)
						w->set_visible(b);
					else
						d_(sh_,err_show_wufa_,2,p,i);
				}
			}else
				cpy__(buf,w->get_visible(),siz);
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="可见状态"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, e);
		if(e){
			bool b;
			if(p->size()>2)
				b=d_(sh_,bool_,(*p)[2].c_str());
			else
				b=!e->get_visibility();
			e->set_visibility(b);
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="敏感"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			if(p->size()>2){
				bool b=d_(sh_,bool_,(*p)[p->size()-1].c_str());
				for(size_t i=1;i<p->size()-1;i++){
					sh_->builder_->get_widget((*p)[i], w);
					if(w)
						w->set_sensitive(b);
					else
						d_(sh_,err_show_wufa_,2,p,i);
				}
			}else
				cpy__(buf,w->get_sensitive(),siz);
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="区域信息"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			Gtk::Allocation a=w->get_allocation();
			sprintf(buf,"%d,%d,%d,%d,",a.get_x(),a.get_y(),a.get_width(),a.get_height());
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="鼠标"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			gint  x,y;
			/*Glib::RefPtr<Gdk::Window> w2=w->get_window();
			w2->get_pointer(x,y,);*/
			w->get_pointer(x,y);
			sprintf(buf,"%d,%d,",x,y);
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="数目"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, n);
		if(n){
			sprintf(buf,"%d",n->get_n_pages());
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="遍历"){
		if(siz==-1)return 1;
		const Glib::ustring& code=(*p)[p->size()-1];
		bool exe=true;
		char s1[16];
		const char*argv[]={s1};
		int err;
		for(size_t i=1;i<p->size()-1&&exe;i++){
			sh_->builder_->get_widget((*p)[i], n);
			if(n){
				for(int pn=0;pn<n->get_n_pages();pn++){
					w=n->get_nth_page(pn);
					sprintf(s1,"%d",pn+1);
					d_(sh_,call4_1_,code.c_str(),shangji,NULL,NULL,NULL,1,argv,0,ce,&err);
					if(err){
						if(err==jieshiqi_go_+keyword_break_)
							break;
						if(err==jieshiqi_go_+keyword_continue_)
							continue;
						if(err==jieshiqi_go_+keyword_exit_){
							exe=false;
							break;
						}
						d_(sh_,call4_2_,err);
						return 1;
					}
				}
				continue;
			}
			d_(sh_,err_show_wufa_,2,p,i);
		}
		return 1;
	}
	return 0;
}
示例#6
0
void on_button_clicked(Gtk::TreeModel::Path path, Gtk::TreeViewColumn* column, Glib::RefPtr<Gtk::TreeModel> model) {
	Gtk::TreeModel::iterator iter = model->get_iter(path);
	Gtk::TreeModel::Row row = *iter;
	string shortname = row[m_columns.name];
	string longname = row[m_columns.longname];
	
	BOARD = shortname;
	LONGBOARD = longname;
	
	boardView();
	
	Gtk::TreeView *threadlist = 0;
	builder->get_widget("treeview2", threadlist);
	
	pWebKitView = WEBKIT_WEB_VIEW (webkit_web_view_new ());
	
	Gtk::ScrolledWindow *imgview = 0;
	builder->get_widget("scrolledwindow3", imgview);
	imgview->set_visible(true);
	imgview->show();
	
	gtk_container_add (GTK_CONTAINER (imgview->gobj()), GTK_WIDGET (pWebKitView));
	webkit_web_view_load_uri(pWebKitView, "about:blank");
	webkit_web_view_set_zoom_level(pWebKitView, true);
	gtk_widget_set_can_focus(GTK_WIDGET(pWebKitView), true);
	gtk_widget_show(GTK_WIDGET(pWebKitView));
	
	Glib::RefPtr<Gtk::ListStore> m_threads_tree_model;
	m_threads_tree_model = Gtk::ListStore::create(m_thread_list);
	m_threads_tree_model->clear();
	threadlist->set_model(m_threads_tree_model);
	threadlist->set_search_column(1);
	threadlist->get_column(1)->set_visible(false);
	threadlist->get_column(2)->set_visible(false);
	threadlist->get_column(3)->set_visible(false);
	threadlist->get_column(4)->set_visible(false);
	
	threadlist->signal_key_press_event().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_key_press_or_release_event), m_threads_tree_model));
	threadlist->signal_key_release_event().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_key_press_or_release_event), m_threads_tree_model));
	threadlist->add_events(Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
	
	Gtk::CellRendererText* cellRender = dynamic_cast<Gtk::CellRendererText*>(threadlist->get_column_cell_renderer(0));
	cellRender->property_wrap_mode() = Pango::WRAP_WORD;
	cellRender->property_wrap_width() = 400;
	cellRender->set_alignment(0, 0);
	
	Glib::RefPtr<Gtk::TreeSelection> thread_selection = threadlist->get_selection();
	thread_selection->signal_changed().connect(sigc::bind<Glib::RefPtr<Gtk::TreeSelection>, WebKitWebView*>(sigc::ptr_fun(&on_selection_changed), thread_selection, pWebKitView));
	
	getThreadData(m_threads_tree_model);
	
	threadlist->grab_focus();
	
	Gtk::ToolButton* refresh;
	builder->get_widget("toolbutton5", refresh);
	refresh->set_visible(true);
	refresh->show();
	if(!THREAD_REFRESH_CONNECTED) {
		THREAD_REFRESH_CONNECT = refresh->signal_clicked().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_refresh_threads_clicked), m_threads_tree_model));
	}
	
	THREAD_CLICK_CONNECT = threadlist->signal_row_activated().connect(sigc::bind<Glib::RefPtr<Gtk::TreeModel>, Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_thread_activated), threadlist->get_model(), m_threads_tree_model));
}
示例#7
0
void on_thread_activated(Gtk::TreeModel::Path path, Gtk::TreeViewColumn* column, Glib::RefPtr<Gtk::TreeModel> model, Glib::RefPtr<Gtk::ListStore> store) {
	///To be run when a thread is double clicked
	
	Gtk::TreeModel::iterator iter = model->get_iter(path);
	Gtk::TreeModel::Row row = *iter;
	string no = row[m_thread_list.no];
	
	THREAD = no;
	
	cout << THREAD << endl;
	cout << BOARD << endl;
	
	threadView();
	
	Gtk::TreeView *postlist = 0;
	builder->get_widget("treeview4", postlist);
	postlist->set_visible(true);
	postlist->show();
	
	Gtk::ScrolledWindow *imgview = 0;
	builder->get_widget("scrolledwindow3", imgview);
	
	gtk_container_add (GTK_CONTAINER (imgview->gobj()), GTK_WIDGET (pWebKitView));
	webkit_web_view_load_uri(pWebKitView, "about:blank");
	webkit_web_view_set_zoom_level(pWebKitView, true);
	gtk_widget_set_can_focus(GTK_WIDGET(pWebKitView), true);
	gtk_widget_show(GTK_WIDGET(pWebKitView));
	
	Glib::RefPtr<Gtk::ListStore> m_posts_tree_model;
	m_posts_tree_model = Gtk::ListStore::create(m_post_list);
	m_posts_tree_model->clear();
	postlist->set_model(m_posts_tree_model);
	postlist->set_search_column(1);
	postlist->get_column(1)->set_visible(false);
	postlist->get_column(2)->set_visible(false);
	postlist->get_column(3)->set_visible(false);
	postlist->get_column(4)->set_visible(false);
	postlist->get_column(5)->set_visible(false);
	
	postlist->signal_key_press_event().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_key_press_thread), m_posts_tree_model));
	postlist->signal_key_release_event().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_key_press_thread), m_posts_tree_model));
	postlist->add_events(Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
	
	Gtk::CellRendererText* cellRender = dynamic_cast<Gtk::CellRendererText*>(postlist->get_column_cell_renderer(0));
	cellRender->property_wrap_mode() = Pango::WRAP_WORD;
	cellRender->property_wrap_width() = 400;
	cellRender->set_alignment(0, 0);
	
	Glib::RefPtr<Gtk::TreeSelection> thread_selection = postlist->get_selection();
	thread_selection->signal_changed().connect(sigc::bind<Glib::RefPtr<Gtk::TreeSelection>, WebKitWebView*>(sigc::ptr_fun(&on_selection_changed_post), thread_selection, pWebKitView));
	
	getPostData(m_posts_tree_model);
	
	postlist->grab_focus();
	
	Gtk::ToolButton* refresh;
	builder->get_widget("toolbutton6", refresh);
	refresh->set_visible(true);
	refresh->show();
	POST_REFRESH_CONNECT = refresh->signal_clicked().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_refresh_posts_clicked), m_posts_tree_model));
	
	Gtk::ScrolledWindow *postwin = 0;
	builder->get_widget("scrolledwindow4", postwin);
	postwin->set_visible(true);
	postwin->show();
	
	POST_CLICK_CONNECT = postlist->signal_row_activated().connect(sigc::bind<Glib::RefPtr<Gtk::TreeModel>, Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_post_activated1), postlist->get_model(), m_posts_tree_model));
}
示例#8
0
void boardView(bool destroy=true) {
	///Show/hide widgets for viewing all of the threads on a board
	
	Gtk::ScrolledWindow *boardlist = 0;
	builder->get_widget("scrolledwindow1", boardlist);
	boardlist->set_visible(false);
	boardlist->hide();
	
	Gtk::Paned *threadview = 0;
	builder->get_widget("paned1", threadview);
	threadview->set_visible(true);
	threadview->show();
	
	if(INIT) { //To be run only the first time a board is viewed
		Gtk::Window *window = 0;
		builder->get_widget("window1", window);
		int w = 0;
		int h = 0;
		window->get_size(w, h);
		threadview->set_position((1-2/(1+sqrt(5)))*w);
		
		Gtk::TextView *view = 0;
		builder->get_widget("textview1", view);
		GtkSpellChecker* spell = gtk_spell_checker_new ();
		gtk_spell_checker_set_language (spell, setlocale(LC_ALL,NULL), NULL);
		gtk_spell_checker_attach (spell, GTK_TEXT_VIEW (view->gobj()));
		
		INIT = false;
	}
	
	Gtk::ToolItem *boardback = 0;
	builder->get_widget("toolbutton3", boardback);
	boardback->set_visible(true);
	boardback->show();
	
	Gtk::ToolItem *threadback = 0;
	builder->get_widget("toolbutton4", threadback);
	threadback->set_visible(false);
	threadback->hide();
	
	Gtk::Button* button;
	builder->get_widget("button1", button);
	button->signal_clicked().connect(sigc::ptr_fun(&on_board_back_clicked));
	button->set_visible(true);
	button->show();
	
	Gtk::ScrolledWindow *threadlist = 0;
	builder->get_widget("scrolledwindow2", threadlist);
	threadlist->set_visible(true);
	threadlist->show();
	
	Gtk::ScrolledWindow *postlist = 0;
	builder->get_widget("scrolledwindow4", postlist);
	postlist->set_visible(false);
	postlist->hide();
	
	Gtk::ScrolledWindow *webview = 0;
	builder->get_widget("scrolledwindow3", webview);
	webview->set_visible(true);
	webview->show();
	
	Gtk::ToolButton* refresh;
	builder->get_widget("toolbutton5", refresh);
	refresh->set_visible(true);
	refresh->show();
	
	gtk_widget_show(GTK_WIDGET(pWebKitView));
	
	Gtk::Label *title = 0;
	builder->get_widget("label2", title);
	title->set_text(BOARD+" - "+LONGBOARD);
	
	Gtk::ToolButton *refresh1 = 0;
	builder->get_widget("toolbutton5", refresh1);
	refresh1->set_visible(true);
	refresh1->show();
	
	Gtk::ToolItem *refresh2 = 0;
	builder->get_widget("toolbutton6", refresh2);
	refresh2->set_visible(false);
	refresh2->hide();
	
	Gtk::MenuItem *item3 = 0;
	builder->get_widget("menuitem3", item3);
	item3->set_sensitive(false);
	
	Gtk::ToolButton *post_but;
	builder->get_widget("toolbutton8", post_but);
	post_but->set_visible(true);
	post_but->show();
}
示例#9
0
Main_window::Main_window(const Main_window_settings& settings)
:
	m::gtk::Window("", settings.window, 800, 600, 0),
	gui(new Gui)
{
	Client_settings& client_settings = get_client_settings();
	Main_window_settings& main_window_settings = client_settings.gui.main_window;

	// Заголовок окна -->
		this->gui->orig_window_title = APP_NAME;

		if(get_application().get_config_dir_path() != get_default_config_dir_path())
			this->gui->orig_window_title = " (" + get_application().get_config_dir_path() + ")";

		Gtk::Window::set_title(this->gui->orig_window_title);
	// Заголовок окна <--

	// Трей
	show_tray_icon(client_settings.gui.show_tray_icon);

	// Меню -->
		this->gui->ui_manager = Gtk::UIManager::create();
		Glib::RefPtr<Gtk::ActionGroup> action_group = Gtk::ActionGroup::create();


		action_group->add(
			app_icons::create_action("app", app_icons::ICON_APP, APP_NAME),
			sigc::mem_fun(*this, &Main_window::on_tray_activated)
		);


		action_group->add(Gtk::Action::create("file", _("_File")));
		action_group->add(
			Gtk::Action::create("create", Gtk::Stock::NEW, _("_Create")),
			sigc::mem_fun(*this, &Main_window::on_create_callback)
		);
		action_group->add(
			Gtk::Action::create("open", Gtk::Stock::OPEN, _("_Open a torrent")),
			sigc::mem_fun(*this, &Main_window::on_open_callback)
		);
		action_group->add(
			Gtk::Action::create("open_magnet", Gtk::Stock::JUMP_TO, _("_Open a magnet link")),
			sigc::mem_fun(*this, &Main_window::on_open_magnet_callback)
		);
		action_group->add(
			Gtk::Action::create("quit", Gtk::Stock::QUIT, _("_Quit")),
			sigc::mem_fun(get_application(), &Application::close
		));


		action_group->add(Gtk::Action::create("edit", _("_Edit")));
		action_group->add(
			app_icons::create_action("statistics", app_icons::ICON_STATISTICS, _("_Statistics")),
			sigc::mem_fun(*this, &Main_window::on_show_statistics_callback)
		);
		action_group->add(
			Gtk::Action::create("preferences", Gtk::Stock::PREFERENCES, _("_Preferences")),
			sigc::mem_fun(*this, &Main_window::on_show_settings_window_callback)
		);


		action_group->add(Gtk::Action::create("view", _("_View")));

		// Toolbar -->
			action_group->add(Gtk::Action::create("toolbar", _("_Toolbar")));

			this->gui->menu_show_toolbar_action = Gtk::ToggleAction::create(
				"toolbar/show", _Q("'Show ...' toggle|_Show"), "",
				get_client_settings().gui.show_toolbar
			);
			action_group->add(
				this->gui->menu_show_toolbar_action,
				sigc::mem_fun(*this, &Main_window::on_show_toolbar_toggled_callback)
			);

			// Стиль панели инструментов -->
			{
				Gtk::RadioButtonGroup radio_group;
				std::map< m::gtk::toolbar::Style, Glib::RefPtr<Gtk::RadioAction> > toolbar_style_buttons;

				action_group->add(Gtk::Action::create("toolbar/style", _("Toolbar _style")));

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::DEFAULT] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/default", _("_Desktop default")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::DEFAULT
					)
				);

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::ICONS] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/icons", _("_Icons")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::ICONS
					)
				);

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::TEXT] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/text", _("_Text")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::TEXT
					)
				);

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::BOTH] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/both", _("_Both")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::BOTH
					)
				);

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::BOTH_HORIZ] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/both_horiz", _("Both _horizontal")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::BOTH_HORIZ
					)
				);

				toolbar_style_buttons[get_client_settings().gui.toolbar_style]->set_active();
			}
			// Стиль панели инструментов <--
		// Toolbar <--

		// Categories <--
		{
			Glib::RefPtr<Gtk::ToggleAction> action;

			action_group->add(Gtk::Action::create("categories", _("_Categories")));

			action = Gtk::ToggleAction::create(
				"categories/show", _Q("'Show ...' toggle|_Show"), "",
				get_client_settings().gui.main_window.torrents_viewport.categories_view->visible
			);
			action_group->add(
				action,
				sigc::bind< Glib::RefPtr<Gtk::ToggleAction> >(
					sigc::mem_fun(*this->gui, &Main_window::Gui::on_show_categories_toggle_cb), action)
			);

			action = Gtk::ToggleAction::create(
				"categories/show_names", _("Show _names"), "",
				get_client_settings().gui.main_window.torrents_viewport.categories_view->show_names
			);
			action_group->add(
				action,
				sigc::bind< Glib::RefPtr<Gtk::ToggleAction> >(
					sigc::mem_fun(*this->gui, &Main_window::Gui::on_show_categories_names_toggle_cb), action)
			);

			action = Gtk::ToggleAction::create(
				"categories/show_counters", _("Show _counters"), "",
				get_client_settings().gui.main_window.torrents_viewport.categories_view->show_counters
			);
			action_group->add(
				action,
				sigc::bind< Glib::RefPtr<Gtk::ToggleAction> >(
					sigc::mem_fun(*this->gui, &Main_window::Gui::on_show_categories_counters_toggle_cb), action)
			);
		}
		// Categories <--

		// Torrents -->
			action_group->add(Gtk::Action::create("torrents", _("_Torrents")));


			action_group->add(Gtk::Action::create("resume", Gtk::Stock::MEDIA_PLAY, _("_Resume")));
			action_group->add(
				app_icons::create_action("resume/all", app_icons::ICON_DOWNLOAD_AND_UPLOAD, _("_All")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_resume_torrents_callback),
					ALL
				)
			);
			action_group->add(
				app_icons::create_action("resume/downloads", app_icons::ICON_DOWNLOAD, _("_Downloads")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_resume_torrents_callback),
					DOWNLOADS
				)
			);
			action_group->add(
				app_icons::create_action("resume/uploads", app_icons::ICON_UPLOAD, _("_Uploads")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_resume_torrents_callback),
					UPLOADS
				)
			);


			action_group->add(Gtk::Action::create("pause", Gtk::Stock::MEDIA_PAUSE, _("_Pause")));
			action_group->add(
				app_icons::create_action("pause/all", app_icons::ICON_DOWNLOAD_AND_UPLOAD, _("_All")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_pause_torrents_callback),
					ALL
				)
			);
			action_group->add(
				app_icons::create_action("pause/downloads", app_icons::ICON_DOWNLOAD, _("_Downloads")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_pause_torrents_callback),
					DOWNLOADS
				)
			);
			action_group->add(
				app_icons::create_action("pause/uploads", app_icons::ICON_UPLOAD, _("_Uploads")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_pause_torrents_callback),
					UPLOADS
				)
			);


			// Temporary -->
				gui->resume_temporary = Gtk::Action::create(
					"resume_temporary", Gtk::Stock::MEDIA_PLAY, _("R_esume temporary"));
				action_group->add(gui->resume_temporary);

				action_group->add(
					app_icons::create_action("resume_temporary/all", app_icons::ICON_DOWNLOAD_AND_UPLOAD, _("_All")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_RESUME, ALL )
					)
				);
				action_group->add(
					app_icons::create_action("resume_temporary/downloads", app_icons::ICON_DOWNLOAD, _("_Downloads")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_RESUME, DOWNLOADS )
					)
				);
				action_group->add(
					app_icons::create_action("resume_temporary/uploads", app_icons::ICON_UPLOAD, _("_Uploads")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_RESUME, UPLOADS )
					)
				);


				gui->pause_temporary = Gtk::Action::create(
					"pause_temporary", Gtk::Stock::MEDIA_PAUSE, _("P_ause temporary"));
				action_group->add(gui->pause_temporary);

				action_group->add(
					app_icons::create_action("pause_temporary/all", app_icons::ICON_DOWNLOAD_AND_UPLOAD, _("_All")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_PAUSE, ALL )
					)
				);
				action_group->add(
					app_icons::create_action("pause_temporary/downloads", app_icons::ICON_DOWNLOAD, _("_Downloads")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_PAUSE, DOWNLOADS )
					)
				);
				action_group->add(
					app_icons::create_action("pause_temporary/uploads", app_icons::ICON_UPLOAD, _("_Uploads")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_PAUSE, UPLOADS )
					)
				);

				gui->complete_temporary_action = Gtk::Action::create(
					"complete_temporary_action", Gtk::Stock::APPLY, _("C_omplete pending temporary action"));
				action_group->add(
					gui->complete_temporary_action,
					sigc::bind<bool>( sigc::mem_fun(*this, &Main_window::on_interrupt_temporary_action_cb), true )
				);

				gui->cancel_temporary_action = Gtk::Action::create(
					"cancel_temporary_action", Gtk::Stock::STOP, _("_Cancel pending temporary action"));
				action_group->add(
					gui->cancel_temporary_action,
					sigc::bind<bool>( sigc::mem_fun(*this, &Main_window::on_interrupt_temporary_action_cb), false )
				);
			// Temporary <--
		// Torrents <--


		action_group->add(
			app_icons::create_action("set_upload_rate_limit", app_icons::ICON_UPLOAD, _("Set _upload rate limit")),
			sigc::bind<Traffic_type>(
				sigc::mem_fun(*this, &Main_window::on_change_rate_limit_callback),
				UPLOAD
			)
		);
		action_group->add(
			app_icons::create_action("set_download_rate_limit",
				app_icons::ICON_DOWNLOAD, _("Set _download rate limit")),
			sigc::bind<Traffic_type>(
				sigc::mem_fun(*this, &Main_window::on_change_rate_limit_callback),
				DOWNLOAD
			)
		);


		action_group->add(Gtk::Action::create("help", _("_Help")));
		action_group->add(
			Gtk::Action::create("about", Gtk::Stock::ABOUT, _("_About")),
			sigc::mem_fun(*this, &Main_window::on_show_about_dialog_callback)
		);

		this->gui->ui_manager->insert_action_group(action_group);

		Glib::ustring ui_info =
			"<ui>"
			"	<menubar name='menu_bar'>"

			"		<menu action='file'>"
			"			<menuitem action='create'/>"
			"			<menuitem action='open'/>"
			"			<menuitem action='open_magnet'/>"
			"			<menuitem action='quit'/>"
			"		</menu>"

			"		<menu action='edit'>"
			"			<menuitem action='statistics'/>"
			"			<menuitem action='preferences'/>"
			"		</menu>"

			"		<menu action='view'>"
			"			<menu action='toolbar'>"
			"				<menuitem action='toolbar/show'/>"
			"				<menu action='toolbar/style'>"
			"					<menuitem action='toolbar/style/default'/>"
			"					<menuitem action='toolbar/style/icons'/>"
			"					<menuitem action='toolbar/style/text'/>"
			"					<menuitem action='toolbar/style/both'/>"
			"					<menuitem action='toolbar/style/both_horiz'/>"
			"				</menu>"
			"			</menu>"
			"			<menu action='categories'>"
			"				<menuitem action='categories/show'/>"
			"				<menuitem action='categories/show_names'/>"
			"				<menuitem action='categories/show_counters'/>"
			"			</menu>"
			"		</menu>"

			"		<menu action='torrents'>"

			"			<menu action='resume'>"
			"				<menuitem action='resume/all'/>"
			"				<menuitem action='resume/uploads'/>"
			"				<menuitem action='resume/downloads'/>"
			"			</menu>"
			"			<menu action='pause'>"
			"				<menuitem action='pause/all'/>"
			"				<menuitem action='pause/uploads'/>"
			"				<menuitem action='pause/downloads'/>"
			"			</menu>"

			"			<separator/>"

			"			<menu action='resume_temporary'>"
			"				<menuitem action='resume_temporary/all'/>"
			"				<menuitem action='resume_temporary/uploads'/>"
			"				<menuitem action='resume_temporary/downloads'/>"
			"			</menu>"
			"			<menu action='pause_temporary'>"
			"				<menuitem action='pause_temporary/all'/>"
			"				<menuitem action='pause_temporary/uploads'/>"
			"				<menuitem action='pause_temporary/downloads'/>"
			"			</menu>"
			"			<menuitem action='complete_temporary_action'/>"
			"			<menuitem action='cancel_temporary_action'/>"

			"		</menu>"

			"		<menu action='help'>"
			"			<menuitem action='about'/>"
			"		</menu>"

			"	</menubar>"


			"	<popup name='appindicator'>"
			"		<menuitem action='app'/>"

			"		<separator/>"

			"		<menuitem action='open'/>"
			"		<menuitem action='open_magnet'/>"

			"		<separator/>"

			"		<menu action='resume'>"
			"			<menuitem action='resume/all'/>"
			"			<menuitem action='resume/uploads'/>"
			"			<menuitem action='resume/downloads'/>"
			"		</menu>"
			"		<menu action='pause'>"
			"			<menuitem action='pause/all'/>"
			"			<menuitem action='pause/uploads'/>"
			"			<menuitem action='pause/downloads'/>"
			"		</menu>"

			"		<separator/>"

			"		<menu action='resume_temporary'>"
			"			<menuitem action='resume_temporary/all'/>"
			"			<menuitem action='resume_temporary/uploads'/>"
			"			<menuitem action='resume_temporary/downloads'/>"
			"		</menu>"
			"		<menu action='pause_temporary'>"
			"			<menuitem action='pause_temporary/all'/>"
			"			<menuitem action='pause_temporary/uploads'/>"
			"			<menuitem action='pause_temporary/downloads'/>"
			"		</menu>"
			"		<menuitem action='complete_temporary_action'/>"
			"		<menuitem action='cancel_temporary_action'/>"

			"		<separator/>"

			"		<menuitem action='set_upload_rate_limit'/>"
			"		<menuitem action='set_download_rate_limit'/>"

			"		<separator/>"

			"		<menuitem action='quit'/>"
			"	</popup>"


			"	<popup name='tray_popup_menu'>"
			"		<menuitem action='open'/>"
			"		<menuitem action='open_magnet'/>"

			"		<separator/>"

			"		<menu action='resume'>"
			"			<menuitem action='resume/all'/>"
			"			<menuitem action='resume/uploads'/>"
			"			<menuitem action='resume/downloads'/>"
			"		</menu>"
			"		<menu action='pause'>"
			"			<menuitem action='pause/all'/>"
			"			<menuitem action='pause/uploads'/>"
			"			<menuitem action='pause/downloads'/>"
			"		</menu>"

			"		<separator/>"

			"		<menu action='resume_temporary'>"
			"			<menuitem action='resume_temporary/all'/>"
			"			<menuitem action='resume_temporary/uploads'/>"
			"			<menuitem action='resume_temporary/downloads'/>"
			"		</menu>"
			"		<menu action='pause_temporary'>"
			"			<menuitem action='pause_temporary/all'/>"
			"			<menuitem action='pause_temporary/uploads'/>"
			"			<menuitem action='pause_temporary/downloads'/>"
			"		</menu>"
			"		<menuitem action='complete_temporary_action'/>"
			"		<menuitem action='cancel_temporary_action'/>"

			"		<separator/>"

			"		<menuitem action='set_upload_rate_limit'/>"
			"		<menuitem action='set_download_rate_limit'/>"

			"		<separator/>"

			"		<menuitem action='quit'/>"
			"	</popup>"

			"</ui>";

		this->gui->ui_manager->add_ui_from_string(ui_info);
		this->add_accel_group(this->gui->ui_manager->get_accel_group());
	// Меню <--


	Gtk::VBox* main_vbox = Gtk::manage(new Gtk::VBox());
	this->add(*main_vbox);

	// Панель меню -->
		Gtk::Widget* menu_bar = this->gui->ui_manager->get_widget("/menu_bar");
		main_vbox->pack_start(*menu_bar, false, true);
	// Панель меню <--

	// Панель инструментов
	main_vbox->pack_start(this->gui->toolbar, false, false);

	// Список торрентов -->
		this->gui->torrents_viewport = Gtk::manage(new Torrents_viewport(main_window_settings.torrents_viewport));
		main_vbox->pack_start(*this->gui->torrents_viewport, true, true);

		// Настройки отдельных виджетов
		this->gui->torrents_viewport->get_log_view().set_max_lines(client_settings.gui.max_log_lines);
	// Список торрентов <--

	// status bar -->
	{
		Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment());
		alignment->property_top_padding() = m::gtk::VBOX_SPACING / 2;
		main_vbox->pack_start(*alignment, false, false);

		alignment->add(this->gui->status_bar);
		this->gui->status_bar.push("");
	}
	// status bar <--

	// AppIndicator -->
	#if HAVE_APP_INDICATOR
	{
		app_indicator_set_menu(this->gui->appindicator, GTK_MENU(
			gtk_ui_manager_get_widget(this->gui->ui_manager->gobj(), "/ui/appindicator")));

		g_signal_connect(G_OBJECT(this->gui->appindicator), APP_INDICATOR_SIGNAL_CONNECTION_CHANGED,
			G_CALLBACK(&Main_window::on_appindicator_connection_changed), this);
	}
	#endif
	// AppIndicator <--


	// Панель инструментов -->
	{
		// Заполнять ее лучше в самом конце, когда уже созданы все необходимые
		// виджеты.

		Gtk::ToolButton* button;


		button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::NEW));
		button->set_label(_("Create"));
		button->set_tooltip_text(_("Create a new torrent"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_create_callback)
		);

		button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::OPEN));
		button->set_label(_("Open"));
		button->set_tooltip_text(_("Open a torrent"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_open_callback)
		);


		button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::JUMP_TO));
		button->set_label(_("Magnet link"));
		button->set_tooltip_text(_("Open a magnet link"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_open_magnet_callback)
		);


		this->gui->toolbar.append(
			*Gtk::manage(new Gtk::SeparatorToolItem())
		);


		button = this->gui->toolbar_resume_button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::MEDIA_PLAY));
		button->set_label(_("Resume"));
		button->set_tooltip_text(_("Resume torrent(s)"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::bind<Torrent_process_action>(
				sigc::mem_fun(*this->gui->torrents_viewport, &Torrents_viewport::process_torrents),
				RESUME
			)
		);

		button = this->gui->toolbar_pause_button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::MEDIA_PAUSE));
		button->set_label(_("Pause"));
		button->set_tooltip_text(_("Pause torrent(s)"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::bind<Torrent_process_action>(
				sigc::mem_fun(*this->gui->torrents_viewport, &Torrents_viewport::process_torrents),
				PAUSE
			)
		);

		button = this->gui->toolbar_remove_button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::REMOVE));
		button->set_label(_("Remove"));
		button->set_tooltip_text(_("Remove torrent(s)"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::bind<Torrent_process_action>(
				sigc::mem_fun(*this->gui->torrents_viewport, &Torrents_viewport::process_torrents),
				REMOVE
			)
		);


		this->gui->toolbar.append(
			*Gtk::manage(new Gtk::SeparatorToolItem())
		);


		button = Gtk::manage(new Gtk::ToolButton());
		button->set_label(_("Statistics"));
		app_icons::set_for_tool_button(*button, app_icons::ICON_STATISTICS);
		button->set_tooltip_text(_("Statistics"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_show_statistics_callback)
		);

		button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::PREFERENCES));
		button->set_label(_("Preferences"));
		button->set_tooltip_text(_("Preferences"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_show_settings_window_callback)
		);


		this->gui->toolbar.show_all_children();
		if(get_client_settings().gui.show_toolbar)
			this->gui->toolbar.show();

		this->gui->toolbar.set_no_show_all();
	}
	// Панель инструментов <--


	// Устанавливаем интервал обновления GUI
	this->set_gui_update_interval(client_settings.gui.update_interval);

	// Обновление доступных в данный момент кнопок -->
		this->on_torrent_process_actions_changed_callback(0);

		gui->torrent_process_actions_changed_connection =
			this->gui->torrents_viewport->signal_torrent_process_actions_changed().connect(
				sigc::mem_fun(*this, &Main_window::on_torrent_process_actions_changed_callback)
			);
	// Обновление доступных в данный момент кнопок <--

	// Автоматическое сохранение настроек
	gui->autosave_settings_connection = Glib::signal_timeout().connect(
		sigc::mem_fun(*this, &Main_window::on_save_settings_timeout), SAVE_SETTINGS_INTERVAL
	);

	// Обработчик сигнала на изменение состояния окна
	this->signal_window_state_event().connect(sigc::mem_fun(
		*this, &Main_window::on_window_state_changed_callback
	));

	// Закрытие окна
	this->signal_delete_event().connect(sigc::mem_fun(*this, &Main_window::on_close_callback));

	if(client_settings.gui.show_tray_icon && client_settings.gui.hide_app_to_tray_at_startup)
		this->show_all_children();
	else
		this->show_all();

	// В gtkmm 2.16.0 (Ubuntu 9.04) есть небольшая бага, из-за которой
	// this->show_all() отображает даже элементы меню, для которых была
	// выполнена Gtk::Action::set_visible(false).
	// Поэтому скрываем элементы меню в самый последний момент.
	COMPATIBILITY
	gui->complete_temporary_action->set_visible(true);
	gui->cancel_temporary_action->set_visible(true);
}
示例#10
0
文件: VRGuiNet.cpp 项目: uagmw/polyvr
void VRGuiNet_on_treeview_select(GtkTreeView* tv, gpointer user_data) {
    Gtk::ToolButton* b;
    VRGuiBuilder()->get_widget("toolbutton15", b);
    b->set_sensitive(true);
}
void CategoryWindowGTKMM::connectSignals()
{

	// The delete event to close the program
	categoryWindow->signal_delete_event().connect( sigc::mem_fun( this, &EngineGTKMM::quit) );



  //Get the Glade-instantiated Button, and connect a signal handler:
  Gtk::ToolButton* pToolButton = 0;
  

  // New button
  refXml->get_widget("toolbutton14", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &CategoryWindowGTKMM::onButton_new) );
    pToolButton->set_tooltip_text("Create a new category.");
  }
  else
  {
  	// TODO throw error
  }
  

	// Open button
  refXml->get_widget("toolbutton15", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &CategoryWindowGTKMM::onButton_open) );
    pToolButton->set_tooltip_text("Open a category from file.");
  }
  else
  {
  	// TODO throw error
  }
  
  
  // Save button
	refXml->get_widget("toolbutton16", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &EngineGTKMM::saveCategory) );
    pToolButton->set_tooltip_text("Save a category to file.");
  }
  else
  {
  	// TODO throw error
  } 

  // Save as button
	refXml->get_widget("toolbutton32", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &EngineGTKMM::saveAsCategory) );
    pToolButton->set_tooltip_text("Save as a category to file.");
  }
  else
  {
  	// TODO throw error
  }     
 
 
  // Back button
	refXml->get_widget("toolbutton17", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &CategoryWindowGTKMM::onButton_back) );
    pToolButton->set_tooltip_text("Display previous category.");
  }
  else
  {
  	// TODO throw error
  }      
 
 
  // Forward button
	refXml->get_widget("toolbutton18", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &CategoryWindowGTKMM::onButton_forward) );
    pToolButton->set_tooltip_text("Display next category.");
  }
  else
  {
  	// TODO throw error
  }      
  
	// Add button
  refXml->get_widget("toolbutton21", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &CategoryWindowGTKMM::onButton_add) );
    pToolButton->set_tooltip_text("Add a field to the category.");
  }
  else
  {
  	// TODO throw error	fieldTableGTKMM = new FieldTableGTKMM();
  }
  
  
  // Delete button
	refXml->get_widget("toolbutton22", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &CategoryWindowGTKMM::onButton_delete) );
    pToolButton->set_tooltip_text("Delete the selected field from the category.");
  }
  else
  {
  	// TODO throw error
  } 
  
  // Up button
	refXml->get_widget("toolbutton23", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &CategoryWindowGTKMM::onButton_up) );
    pToolButton->set_tooltip_text("Move the selected category up.");
  }
  else
  {
  	// TODO throw error
  }   

  // Down button
	refXml->get_widget("toolbutton24", pToolButton);
  if(pToolButton)
  {
    pToolButton->signal_clicked().connect( sigc::mem_fun( this, &CategoryWindowGTKMM::onButton_down) );
    pToolButton->set_tooltip_text("Move the selected category down.");
  }
  else
  {
  	// TODO throw error
  }        
    
  // When clicking on a field in the tree view of the category window, change the selection
  categoryGTKMM->get_signal_selectionChange().connect( sigc::mem_fun( this, &CategoryWindowGTKMM::fieldSelected) );



};
示例#12
0
void setToolButtonCallback(string b, sigc::slot<void> sig ) {
    Gtk::ToolButton* bu;
    VRGuiBuilder()->get_widget(b, bu);
    bu->signal_clicked().connect(sig);
}
示例#13
0
void setToolButtonCallback(string b, void (* fkt)(GtkButton*, gpointer)) {
    Gtk::ToolButton* bu;
    VRGuiBuilder()->get_widget(b, bu);
    g_signal_connect (bu->gobj(), "clicked", G_CALLBACK(fkt), NULL);
}
示例#14
0
void setToolButtonSensitivity(string toolbutton, bool b) {
    Gtk::ToolButton* tb;
    VRGuiBuilder()->get_widget(toolbutton, tb);
    tb->set_sensitive(b);
}