Ejemplo n.º 1
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();
}
Ejemplo n.º 2
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();
}
Ejemplo n.º 3
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();
}
Ejemplo n.º 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));
	
}
Ejemplo n.º 5
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;
}