Пример #1
0
static JSBool
set_tab_label_text(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
    DOC_BEGIN("");
    DOC_END;
/*
void    set_tab_label_text(Widget& child, const Glib::ustring& tab_label)
*/
    try {
        ensureParamCount(argc, 1);

        Gtk::Notebook * mySelf = 0;
        convertFrom(cx, OBJECT_TO_JSVAL(obj), mySelf);

        // first argument must be a widget or an int
        Gtk::Widget * myPage = 0;

        if (!convertFrom(cx, argv[0], myPage)) {
            JS_ReportError(cx, "JSNotebook::set_tab_label_text(): first argument must be a widget.");
            return JS_FALSE;
        }

        Glib::ustring myNewLabel;
        if (!convertFrom(cx, argv[1], myNewLabel)) {
            JS_ReportError(cx, "JSNotebook::set_tab_label_text(): second argument must be a string.");
            return JS_FALSE;
        }

        mySelf->set_tab_label_text(*myPage, myNewLabel);

        return JS_TRUE;
    } HANDLE_CPP_EXCEPTION;
}
Пример #2
0
window_main::window_main(p2p & P2P_in):
	Gtk::Window(Gtk::WINDOW_TOPLEVEL),
	P2P(P2P_in)
{
	//splits main window
	Gtk::VBox * VBox = Gtk::manage(new Gtk::VBox(false, 0));
	//notebook and tab labels
	Gtk::Notebook * notebook = Gtk::manage(new Gtk::Notebook);
	Gtk::Image * download_label = Gtk::manage(new Gtk::Image(Gtk::Stock::GO_DOWN,
		Gtk::ICON_SIZE_LARGE_TOOLBAR));
	Gtk::Image * upload_label = Gtk::manage(new Gtk::Image(Gtk::Stock::GO_UP,
		Gtk::ICON_SIZE_LARGE_TOOLBAR));
	Gtk::Image * prefs_label = Gtk::manage(new Gtk::Image(Gtk::Stock::PREFERENCES,
		Gtk::ICON_SIZE_LARGE_TOOLBAR));
	//windows inside tabs
	window_transfer * download_window = Gtk::manage(new window_transfer(
		window_transfer::download, P2P, notebook));
	window_transfer * upload_window = Gtk::manage(new window_transfer(
		window_transfer::upload, P2P, notebook));
	window_prefs * prefs_window = Gtk::manage(new window_prefs(P2P));
	//bar on bottom of window (that lists upload/download speeds)
	Gtk::Fixed * statusbar = Gtk::manage(new fixed_statusbar(P2P));

	//icon for top left of window
	this->set_icon(Gtk::Widget::render_icon(Gtk::Stock::NETWORK, Gtk::ICON_SIZE_LARGE_TOOLBAR));

	//add/compose elements
	notebook->append_page(*download_window, *download_label);
	notebook->append_page(*upload_window, *upload_label);
	notebook->append_page(*prefs_window, *prefs_label);
	VBox->pack_start(*notebook);
	VBox->pack_start(*statusbar, Gtk::PACK_SHRINK, 0);
	this->add(*VBox);

	//options
	notebook->set_scrollable(true);  //scroll when many tabs open
	this->set_title(settings::name);
	this->resize(640, 480);
	this->set_resizable(true);
	this->property_destroy_with_parent().set_value(false);

	//get URIs of files dropped on it
	std::list<Gtk::TargetEntry> list_targets;
	list_targets.push_back(Gtk::TargetEntry("STRING"));
	list_targets.push_back(Gtk::TargetEntry("text/plain"));
	this->drag_dest_set(list_targets);

	//signaled functions
	this->signal_drag_data_received().connect(sigc::mem_fun(*this,
		&window_main::file_drag_data_received));

	this->show_all_children();
}
Пример #3
0
void ConfigurationUI::initUI() {
  m_gameConfigurationUI = manage(new GameConfigurationUI);
  m_playerConfigurationUI[0] = manage(new PlayerConfigurationUI);
  m_playerConfigurationUI[1] = manage(new PlayerConfigurationUI);
  Gtk::Notebook* notebook = manage(new Gtk::Notebook());

  notebook->append_page(*m_gameConfigurationUI, "Gra");
  notebook->append_page(*(m_playerConfigurationUI[0]), "Gracz 1");
  notebook->append_page(*(m_playerConfigurationUI[1]), "Gracz 2");

  get_content_area()->pack_start(*notebook);
  get_content_area()->show_all();
}
Пример #4
0
VizTab::VizTab(const Graph& g, const string& name) :
	pGraph(new Graph(g))
{
	Gtk::Notebook* notebook = TheBuilder::get<Gtk::Notebook>("viz_tabs");
	Gtk::Frame* tabFrame = Gtk::manage(new Gtk::Frame);
	fpCanvas = Gtk::manage(new VizCanvas(pGraph.get(), this));
	notebook->append_page(*tabFrame, name);
	tabFrame->add(*fpCanvas);
	tabFrame->show_all();

	notebook->set_current_page(-1);

	Gtk::Button* compareBtn = TheBuilder::get<Gtk::Button>("viz_compare_button");
	compareBtn->signal_clicked().connect(sigc::mem_fun(*this, &VizTab::displayComparisonDialog));
	
}
Пример #5
0
    bool HDRPage::OnTimer()
    {
        if ( m_pCamera == NULL ||
             m_pCheckbuttonEnableHDR->get_active() != true)
        {
            return true;
        }

        Gtk::Notebook* pNotebook;
        m_refXml->get_widget( "notebookCamCtl", pNotebook );
        if ( pNotebook->get_current_page() == 7 )
        {
            UpdateHDRWidgets();
        }

        return true;
    }
Пример #6
0
    bool CamSettingsPage::OnTimer()
    {
        if (m_pCamera == NULL || !IsUpdateable())
        {
            return true;
        }

        // This is only so that the camera settings page doesn't hammer
        // the camera with async reads when it is not the visible page
        Gtk::Notebook* pNotebook;
        m_refXml->get_widget( "notebookCamCtl", pNotebook );
        if ( pNotebook->get_current_page() == 0 )
        {
            UpdateWidgets();	
        }        

        return true;
    }
Пример #7
0
bool CamInfoPage::OnTimer()
{
    if (m_pCamera == NULL || !IsUpdateable())
    {
        return true;
    }

    Gtk::Notebook* pNotebook;
    m_refXml->get_widget( "notebookCamCtl", pNotebook );
    if ( pNotebook->get_current_page() == 3 )
    {
        UpdateInitializeTime();
        UpdateBusResetTime();
        UpdatePixelClockFreq();
        UpdateHorizontalLineFreq();
        UpdateTransmitFailures();
    }

    return true;
}
Пример #8
0
View::View(int & argc, char** argv) : 
Gtk::Main(argc, argv), _unsavedAgenda(false), _menu(*this), _viewEvent(*this), _viewTodo(*this) {

    Gtk::Notebook * ptrNotebook = Gtk::manage(new Gtk::Notebook);
    ptrNotebook->append_page(_viewEvent, "Events");
    ptrNotebook->append_page(_viewTodo, "Todos");

    _vbox.pack_start(_menu.init(_window), Gtk::PACK_SHRINK);
    _vbox.pack_start(*ptrNotebook);
    _vbox.pack_start(_statusbar, Gtk::PACK_SHRINK);

    _window.add(_vbox);
    _window.set_size_request(400, 600);
    _window.show_all();

    if (argc > 1)
        _agenda.openFile(argv[1]);

    refresh();
}
Пример #9
0
int
WokjabDockWindowHandler::Destroy(WokXMLTag *tag)
{
	if ( windows.find(tag->GetAttr("id"))  != windows.end() ) 
	{
		WokjabDockWindow *tmp = windows[tag->GetAttr("id")];
		windows.erase(tag->GetAttr("id"));

		std::string type = tmp->GetType();
		delete tmp;
		WokjabDockWindowMaster *dwm = masterlist[type];
		Gtk::Notebook *nb = dwm->GetNotebook();

		std::cout << "Pages: " << nb->get_n_pages() << std::endl;

		if( nb->get_n_pages() == 0 )
		{
			delete dwm;
			masterlist.erase(type);
		}
	}
	
	return 1;
}
Пример #10
0
static JSBool
remove_page(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
    DOC_BEGIN("");
    DOC_END;
/*
int     append_page (Widget& child)
int     append_page (Widget& child, Widget& tab_label)
int     append_page (Widget& child, Widget& tab_label, Widget& menu_label)
int     append_page (Widget& child, const Glib::ustring& tab_label, bool use_mnemonic=false)
int     append_page (Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic=false)
*/
    try {
        ensureParamCount(argc, 1);

        Gtk::Notebook * mySelf = 0;
        convertFrom(cx, OBJECT_TO_JSVAL(obj), mySelf);

        // first argument must be a widget or an int
        Gtk::Widget * myPageToRemove = 0;
        int myIndexToRemove = 0;

        if (!convertFrom(cx, argv[0], myPageToRemove)) {
            if (!convertFrom(cx, argv[0], myIndexToRemove)) {
                JS_ReportError(cx, "JSNotebook::remove_page(): argument must be a widget or an int.");
                return JS_FALSE;
            }
        }

        if (myPageToRemove) {
            mySelf->remove_page(*myPageToRemove);
        } else {
            mySelf->remove_page(myIndexToRemove);
        }
        return JS_TRUE;
    } HANDLE_CPP_EXCEPTION;
}
Пример #11
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;
}
Пример #12
0
static JSBool
append_page(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
    DOC_BEGIN("");
    DOC_END;
/*
int     append_page (Widget& child)
int     append_page (Widget& child, Widget& tab_label)
int     append_page (Widget& child, Widget& tab_label, Widget& menu_label)
int     append_page (Widget& child, const Glib::ustring& tab_label, bool use_mnemonic=false)
int     append_page (Widget& child, const Glib::ustring& tab_label, const Glib::ustring& menu_label, bool use_mnemonic=false)
*/
    try {
        ensureParamCount(argc, 1, 4);

        Gtk::Notebook * mySelf = 0;
        convertFrom(cx, OBJECT_TO_JSVAL(obj), mySelf);

        int myRetVal = 0;
        // first argument must be a widget
        Gtk::Widget * myChild;
        if (!convertFrom(cx, argv[0], myChild)) {
            JS_ReportError(cx, "JSNotebook::append_page(): First argument must be a widget.");
            return JS_FALSE;
        }
        // second argument must be a widget or a string
        Glib::ustring myStringLabel;
        Gtk::Widget * myWidgetLabel = 0;
        if (argc >= 2) {
            if (!convertFrom(cx, argv[1], myWidgetLabel)) {
                if (!convertFrom(cx, argv[1], myStringLabel)) {
                    JS_ReportError(cx, "JSNotebook::append_page(): Second argument must be a widget or a string.");
                    return JS_FALSE;
                }
            }
        }

        switch (argc) {
            case 1:
                myRetVal = mySelf->append_page(*myChild);
                break;
            case 2:
                if (myWidgetLabel) {
                    myRetVal = mySelf->append_page(*myChild, *myWidgetLabel);
                } else {
                    myRetVal = mySelf->append_page(*myChild, myStringLabel);
                }
                break;
            case 3:
                if (myWidgetLabel) {
                    Gtk::Widget * myMenu = 0;
                    if (!convertFrom(cx, argv[2], myMenu)) {
                        JS_ReportError(cx, "JSNotebook::append_page(): Third argument must be a Widget.");
                        return JS_FALSE;
                    }
                    myRetVal = mySelf->append_page(*myChild, *myWidgetLabel, *myMenu);
                } else {
                    if (JSVAL_IS_BOOLEAN(argv[2])) {
                        bool myMnemonicFlag;
                        if (!convertFrom(cx, argv[2], myMnemonicFlag)) {
                            JS_ReportError(cx, "JSNotebook::append_page(): Third argument must be a bool or string.");
                            return JS_FALSE;
                        }
                        myRetVal = mySelf->append_page(*myChild, myStringLabel, myMnemonicFlag);
                    } else {
                        Glib::ustring myMenuLabel;
                        if (!convertFrom(cx, argv[2], myMenuLabel)) {
                            JS_ReportError(cx, "JSNotebook::append_page(): Third argument must be a bool or string.");
                            return JS_FALSE;
                        }
                        myRetVal = mySelf->append_page(*myChild, myStringLabel, myMenuLabel);
                    }
                }
                break;
            case 4:
                {
                    Glib::ustring myMenuLabel;
                    if (!convertFrom(cx, argv[2], myMenuLabel)) {
                        JS_ReportError(cx, "JSNotebook::append_page(): Third argument must be a bool or string.");
                        return JS_FALSE;
                    }
                    bool myMnemonicFlag;
                    if (!convertFrom(cx, argv[3], myMnemonicFlag)) {
                        JS_ReportError(cx, "JSNotebook::append_page(): fourth argument must be a bool.");
                        return JS_FALSE;
                    }
                    myRetVal = mySelf->append_page(*myChild, myStringLabel, myMenuLabel, myMnemonicFlag);
                }
                break;
        }
        *rval = as_jsval(cx, myRetVal);
        return JS_TRUE;
    } HANDLE_CPP_EXCEPTION;
}
Пример #13
0
int main(int argc, char **argv)
{
  Gtk::Main main(argc, argv);
  Gtk::Window window(Gtk::WINDOW_TOPLEVEL);
  Gtk::Notebook note;
  GtkCanvas *canvas;
  GtkCanvasScroller *scroller;
  mdc::CanvasView *cv;

  window.add(note);
  window.show_all();

for (int i=0; i < 1; i++)
{
  ImageManager *im= ImageManager::get_instance();
  im->add_search_path("../../../images/grt/structs");
  im->add_search_path("../../../images/icons");

  canvas= new GtkCanvas(false);
  scroller= new GtkCanvasScroller();

  window.set_default_size(1024,768);
  scroller->add(canvas);

  note.add(*scroller);

  canvas->set_scroll_adjustments(scroller->get_hadjustment(), scroller->get_vadjustment());

  cv= canvas->get_canvas();
  cv->set_page_size(Size(210*5, 297*5));
 // cv->set_page_size(Size(600, 400));
  cv->set_page_layout(1, 1);

#if 0
  for (int i=0; i < 10; i++)
{
  wbfig::Table *thing= new wbfig::Table(cv->get_current_layer());
  cv->get_current_layer()->add_item(thing);
  thing->move_to(Point(100, 100));
}
#endif

  RectangleFigure r(cv->get_current_layer());

  cv->get_current_layer()->add_item(&r);
  r.move_to(Point(100, 200));
  r.resize_to(Size(50,100));
  r.set_pen_color(Color(1,0,0));
  r.set_line_width(2);
  r.set_filled(true);
  r.set_fill_color(Color(1,1,0));
}
  /*
  for (int i= 0; i < 100; i++)
  {
    RectangleFigure *r= new RectangleFigure(cv->get_current_layer(), 0);
    r->set_fixed_size(Size(rand()%100+1, rand()%200+1));

    ToplevelItem *item= cv->get_current_layer()->add_wrap_item(r);

    item->set_pos(Point(rand()%800, rand()%600));
  }
*/

  main.run();
}
Пример #14
0
void setNotebookSensitivity(string nb, bool b) {
    Gtk::Notebook* tab;
    VRGuiBuilder()->get_widget(nb, tab);
    tab->set_sensitive(b);
}