コード例 #1
0
void MenuPanel::createCheckBox(const CheckBoxInfo& info)
{
    std::unique_ptr<CheckBox> checkbox(new CheckBox(info.id, info.style, m_position, info.position));
    checkbox->setToolTip(info.toolTip);
    checkbox->setVisibleWhenId(info.visibleWhenId);
    m_elements.push_back(std::move(checkbox));
}
コード例 #2
0
ファイル: main.cpp プロジェクト: WendyHanzer/4s
void loadWidgets(tgui::Gui& gui, tgui::Gui& gui2, sf::RenderWindow& window)
{
	tgui::Picture::Ptr picture(gui2);
	picture->load("images/xubuntu_bg_aluminium.jpg");
	picture->setCallbackId(3);

	//would be nice to get below to work, but OpenGL covers it
	//picture->bindCallbackEx(onBackClick, tgui::Picture::LeftMouseClicked);
	
	tgui::Label::Ptr instructions1(gui);
	instructions1->setText("Use up and down arrow keys");
	instructions1->setPosition(0, 0);
	tgui::Label::Ptr instructions2(gui);
	instructions2->setText("to control speed of spin");
	instructions2->setPosition(0, 32);

	// Create check box for pausing
	tgui::Checkbox::Ptr checkbox(gui);
	checkbox->load("widgets/Black.conf");
	checkbox->setPosition(window.getSize().x - 128, 30);
	checkbox->setText("Paused");
	checkbox->setSize(32, 32);
	checkbox->setCallbackId(1);
	checkbox->bindCallbackEx(pauseCallback, tgui::Checkbox::LeftMouseClicked);

	// Create the quit button
	tgui::Button::Ptr quit(gui);
	quit->load("widgets/Black.conf");
	quit->setSize(128, 30);
	quit->setPosition(window.getSize().x - 128, 0);
	quit->setText("Quit");
	quit->setCallbackId(2);
	quit->bindCallbackEx(quitCallback, tgui::Button::LeftMouseClicked);
}
コード例 #3
0
ファイル: main.c プロジェクト: mahiso/JudoShiai
static void show_menu(void)
{
    char buf[16];
    SDL_Rect dest;
    int h = LINE2-LINE1;
    int f = 9*h/10;
    int i;

    dest.x = dest.y = dest.w = dest.h = 0;
    SDL_BlitSurface(menubg, NULL, darea, &dest);

    for (i = 0; i < 10; i++)
	checkbox(tatami_x[i], LINE2, f, -1, conf_tatamis[i]);

    textbox(L1, LINE3, TEXTBOX_W, f, dspnames[display_type]);

    textbox(L1, LINE4, TEXTBOX_W, f, red_background ? "Red" : "Blue");

    checkbox(L1, LINE5, f, 1, mirror_display);

}
コード例 #4
0
ファイル: make.c プロジェクト: GreatDevelopers/wBRLCAD
void main()
{
f=fopen("onform.html","w");

int i,n;

printf("Enter the title for your html file:");
scanf("%s", title);
printf("Enter the css file to be used:");
scanf("%s",css);
printf("Enter the name of script file to be executed:");
scanf("%s",script);
printf("How many fields you want in your table:");
scanf("%d",&n);
clean_stdin();

//fprintf for writing the things in html file

fprintf(f,"<html><head> \n <title>%s</title>",title);
fprintf(f,"<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\"> \n </head><body>\n",css);
fprintf(f,"<header><h1>%s</h1></header>",title);
fprintf(f,"<table>");
fprintf(f, "<form action=\"%s\" method=\"GET\">",script);

for(i=0; i<n; i++)
{
printf("Enter the type of field:");
scanf("%c",&type);
if(type=='t')
{
  text();
}
else if(type=='r')
{
	radio();
}
else if(type=='c')
{
	checkbox();
}
else if(type=='p')
{	
	password();
}
}
fprintf(f,"</table>");
fprintf(f,"<center><input type=submit value=Submit></center>");
fprintf(f,"</form></body></html>");
}
コード例 #5
0
ファイル: IMGUI.cpp プロジェクト: cdaniel8937/cashew
 int luaCheckbox(lua_State* L) {
     int x = lua_tonumber(L, 1);
     int y = lua_tonumber(L, 2);
     int w = lua_tonumber(L, 3);
     int h = lua_tonumber(L, 4);
     lua_pushstring(L, "checked");
     lua_gettable(L, 6);
     bool checked = lua_toboolean(L, 8);
     lua_pop(L, 1);
     const char* text = lua_tostring(L, 5);
     const char* textureFile = lua_tostring(L, 7);
     bool hit = checkbox(x, y, w, h, text, checked, textureFile);
     lua_pushstring(L, "checked");
     lua_pushboolean(L, checked);
     lua_settable(L, 6);
     lua_pushboolean(L, hit);
     return 1;
 }
コード例 #6
0
ファイル: settings.c プロジェクト: Andy753421/lackey
/* Settings draw */
void settings_draw(void)
{
	int wtype = 0, wname = 0;

	/* Figure out cal widths */
	for (cal_t *cal = CALS; cal; cal = cal->next) {
		if (strlen(cal->type) > wtype)
			wtype = strlen(cal->type);
		if (strlen(cal->name) > wname)
			wname = strlen(cal->name);
	}

	heading(win, "Current Settings\n");
	checkbox(win, "Compact layout\n", &COMPACT);

	heading(win, "\nLoaded Calendars\n");
	for (cal_t *cal = CALS; cal; cal = cal->next)
		wprintw(win, PAD "%s:%*s \"%s\"%*s - %s\n",
			cal->type, wtype-strlen(cal->type), "",
			cal->name, wname-strlen(cal->name), "",
			cal->desc ?: "(no description)");
}
コード例 #7
0
ファイル: main.cpp プロジェクト: lkuwada/CSCI60
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QLabel label("hello");
//    label.show();
//    label.setAlignment(Qt::AlignCenter);

    QCheckBox checkbox("like qt?");
//    checkbox.show();

    QSlider slider(Qt::Horizontal);
//    slider.show();

    /*
    QHBoxLayout hboxlayout;
    hboxlayout.addWidget(&label);
    hboxlayout.addWidget(&checkbox);
    hboxlayout.addWidget(&slider);

    QWidget hwindow;
    hwindow.setLayout(&hboxlayout);
    hwindow.show();
    */

    QGridLayout gridlayout;
    gridlayout.addWidget(&label, 0, 0);
    gridlayout.addWidget(&checkbox, 1, 3);
    gridlayout.addWidget(&slider, 2, 2);

    QWidget gwindow;
    gwindow.setLayout(&gridlayout);
    gwindow.show();



    return app.exec();
}
コード例 #8
0
ファイル: main.cpp プロジェクト: Hronom/GraphicSystem
int main(int argc, char *argv[])
{
    Q_UNUSED(argc)
    Q_UNUSED(argv)

    //////////////////////////////////////////////////////////////////
    /// Init GraphicSystem singleton
    GraphicSystem::initialize("GraphicSystemTest", "data/fonts/DejaVuSans.ttf");
    //////////////////////////////////////////////////////////////////



    //////////////////////////////////////////////////////////////////
    /// Get pointers of GraphicSystem
    sf::RenderWindow *window;
    window = GraphicSystem::instance()->getWindow();

    tgui::Gui *gui;
    gui = GraphicSystem::instance()->getGUI();
    //////////////////////////////////////////////////////////////////



    //////////////////////////////////////////////////////////////////
    /// Create widgets
    tgui::Picture::Ptr picture((*gui));
    picture->load("data/others/Linux.jpg");

    tgui::Button::Ptr button((*gui));
    button->load(THEME_CONFIG_FILE);
    button->setPosition(40, 25);
    button->setText("Quit");
    button->setCallbackId(1);
    button->bindCallback(tgui::Button::LeftMouseClicked);
    button->setSize(300, 40);

    tgui::ChatBox::Ptr chatbox((*gui));
    chatbox->load(THEME_CONFIG_FILE);
    chatbox->setSize(200, 100);
    chatbox->setTextSize(20);
    chatbox->setPosition(400, 25);
    chatbox->addLine("Line 1", sf::Color::Red);
    chatbox->addLine("Line 2", sf::Color::Blue);
    chatbox->addLine("Line 3", sf::Color::Green);
    chatbox->addLine("Line 4", sf::Color::Yellow);
    chatbox->addLine("Line 5", sf::Color::Cyan);
    chatbox->addLine("Line 6", sf::Color::Magenta);

    tgui::Checkbox::Ptr checkbox((*gui));
    checkbox->load(THEME_CONFIG_FILE);
    checkbox->setPosition(40, 80);
    checkbox->setText("Checkbox");
    checkbox->setSize(32, 32);

    tgui::ChildWindow::Ptr child((*gui));
    child->load(THEME_CONFIG_FILE);
    child->setSize(200, 100);
    child->setBackgroundColor(sf::Color(80, 80, 80));
    child->setPosition(400, 460);
    child->setTitle("Child window");
    child->setIcon("data/others/icon.jpg");

    tgui::ComboBox::Ptr comboBox((*gui));
    comboBox->load(THEME_CONFIG_FILE);
    comboBox->setSize(120, 21);
    comboBox->setPosition(210, 440);
    comboBox->addItem("Item 1");
    comboBox->addItem("Item 2");
    comboBox->addItem("Item 3");
    comboBox->setSelectedItem("Item 2");

    tgui::EditBox::Ptr editBox((*gui));
    editBox->load(THEME_CONFIG_FILE);
    editBox->setPosition(40, 200);
    editBox->setSize(300, 30);

    tgui::Label::Ptr label((*gui));
    label->load(THEME_CONFIG_FILE);
    label->setText("Label");
    label->setPosition(40, 160);
    label->setTextColor(sf::Color(200, 200, 200));
    label->setTextSize(24);

    tgui::ListBox::Ptr listBox((*gui));
    listBox->load(THEME_CONFIG_FILE);
    listBox->setSize(150, 120);
    listBox->setItemHeight(20);
    listBox->setPosition(40, 440);
    listBox->addItem("Item 1");
    listBox->addItem("Item 2");
    listBox->addItem("Item 3");

    tgui::LoadingBar::Ptr loadingbar((*gui));
    loadingbar->load(THEME_CONFIG_FILE);
    loadingbar->setPosition(40, 330);
    loadingbar->setSize(300, 30);
    loadingbar->setValue(35);

    tgui::MenuBar::Ptr menu((*gui));
    menu->load(THEME_CONFIG_FILE);
    menu->setSize(window->getSize().x, 20);
    menu->addMenu("File");
    menu->addMenuItem("File", "Load");
    menu->addMenuItem("File", "Save");
    menu->addMenuItem("File", "Exit");
    menu->bindCallback(tgui::MenuBar::MenuItemClicked);
    menu->setCallbackId(2);

    sf::Texture texture;
    texture.loadFromFile("data/others/ThinkLinux.jpg");

    tgui::Panel::Ptr panel((*gui));
    panel->setSize(200, 140);
    panel->setPosition(400, 150);
    panel->setBackgroundTexture(&texture);

    tgui::RadioButton::Ptr radioButton((*gui));
    radioButton->load(THEME_CONFIG_FILE);
    radioButton->setPosition(40, 120);
    radioButton->setText("Radio Button");
    radioButton->setSize(32, 32);

    tgui::Slider::Ptr slider((*gui));
    slider->load(THEME_CONFIG_FILE);
    slider->setVerticalScroll(false);
    slider->setPosition(40, 250);
    slider->setSize(300, 25);
    slider->setValue(2);

    tgui::Scrollbar::Ptr scrollbar((*gui));
    scrollbar->load(THEME_CONFIG_FILE);
    scrollbar->setVerticalScroll(false);
    scrollbar->setPosition(40, 290);
    scrollbar->setSize(300, 25);
    scrollbar->setMaximum(5);
    scrollbar->setLowValue(3);

    tgui::Slider2d::Ptr slider2d((*gui));
    slider2d->load("data/widgets/Slider2d/Black.conf");
    slider2d->setPosition(400, 300);
    slider2d->setSize(200, 150);

    tgui::SpinButton::Ptr spinButton((*gui));
    spinButton->load(THEME_CONFIG_FILE);
    spinButton->setPosition(40, 410);
    spinButton->setVerticalScroll(false);
    spinButton->setSize(40, 20);

    tgui::SpriteSheet::Ptr spritesheet((*gui));
    spritesheet->load("data/others/ThinkLinux.jpg");
    spritesheet->setCells(4, 4);
    spritesheet->setVisibleCell(2, 3);
    spritesheet->setSize(160, 120);
    spritesheet->setPosition(620, 25);

    tgui::Tab::Ptr tab((*gui));
    tab->load(THEME_CONFIG_FILE);
    tab->setPosition(40, 370);
    tab->add("Item 1");
    tab->add("Item 2");
    tab->add("Item 3");

    tgui::TextBox::Ptr textBox((*gui));
    textBox->load(THEME_CONFIG_FILE);
    textBox->setPosition(210, 470);
    textBox->setSize(180, 120);
    textBox->setTextSize(16);

    comboBox->moveToFront();
    //////////////////////////////////////////////////////////////////



    //////////////////////////////////////////////////////////////////
    /// Start main loop
    while(window->isOpen())
    {
        GraphicSystem::instance()->injectPreUpdate(0);

        sf::Event event;
        while(GraphicSystem::instance()->pollWindowEvent(event))
        {
            if(event.type == sf::Event::Closed)
                window->close();

            GraphicSystem::instance()->handleGUIEvent(event);
        }

        tgui::Callback callback;
        while(GraphicSystem::instance()->pollGUICallback(callback))
        {
            if(callback.id == 1)
                window->close();

            else if(callback.id == 2)
            {
                if(callback.text == "Exit")
                    window->close();
            }
        }

        GraphicSystem::instance()->injectPostUpdate(0);
    }
    //////////////////////////////////////////////////////////////////



    //////////////////////////////////////////////////////////////////
    /// Destroy GraphicSystem
    GraphicSystem::shutdown();
    //////////////////////////////////////////////////////////////////

    return 0;
}
コード例 #9
0
// boolean return value no longer required
// was used to detect whether all settings were present in the ini,
// since writing in 'preserved' mode would not create settings not present.
// that is now fixed, so return value redundant.
void EditorConfigDialog::syncData(ini::AttributeMap& data, bool saveDialogData)
{
	bool /*preserve = true,*/ read = !saveDialogData;

	QString pathDefaults[pathSize] = {
		paths[d2charPath]->text(),
		paths[d2dataPath]->text(),
		paths[d2expPath]->text(),
		paths[patch_d2Path]->text(),
		paths[mod_dirPath]->text()
	};
#ifdef Q_WS_WIN
	// get default mpq path based on diablo install path in registry
	QSettings diabloSettings("HKEY_CURRENT_USER\\Software\\Blizzard Entertainment\\Diablo II",
		QSettings::NativeFormat);
	if (diabloSettings.contains("InstallPath"))
	{
		QString installPath = diabloSettings.value("InstallPath").toString();
		if (installPath.length())
		{
			QDir installDir(installPath);
#define DEFPATHFROMINST(name) pathDefaults[( name##Path )] = installDir.filePath( #name ".mpq" )
			DEFPATHFROMINST(d2char);
			DEFPATHFROMINST(d2data);
			DEFPATHFROMINST(d2exp);
			DEFPATHFROMINST(patch_d2);
		}
	}
#undef DEFPATHFROMINST
#endif

//#define SYNCPATH(name) preserve *= lineedit(#name, paths[ name##Path ], \ /**/
#define SYNCPATH(name) lineedit(#name, paths[ name##Path ], \
		pathDefaults[ name##Path ], read, data)
	SYNCPATH(d2char);
	SYNCPATH(d2data);
	SYNCPATH(d2exp);
	SYNCPATH(patch_d2);
	SYNCPATH(mod_dir);
#undef SYNCPATH
	/*preserve *=*/ checkbox("full_screen", useFullscreen, true, false, read, data);
	/*preserve *=*/ lineedit("screen_width", screenWidth, "800", read, data);
	/*preserve *=*/ lineedit("screen_height", screenHeight, "600", read, data);
	/*preserve *=*/ combobox("screen_depth", screenDepth, 4, read, data);
	/*preserve *=*/ lineedit("refresh_rate", screenRefresh, "60", read, data);
	/*preserve *=*/ lineedit("keyb_scroll_x", scrollSpeeds[keyboardScroll][0], "40", read, data);
	/*preserve *=*/ lineedit("keyb_scroll_y", scrollSpeeds[keyboardScroll][1], "20", read, data);
	/*preserve *=*/ lineedit("mouse_scroll_x", scrollSpeeds[mouseScroll][0], "20", read, data);
	/*preserve *=*/ lineedit("mouse_scroll_y", scrollSpeeds[mouseScroll][1], "10", read, data);
	/*preserve *=*/ lineedit("edit_scroll_x", scrollSpeeds[tileeditScroll][0], "20", read, data);
	/*preserve *=*/ lineedit("edit_scroll_y", scrollSpeeds[tileeditScroll][1], "20", read, data);
	/*preserve *=*/ lineedit("obj_edit_scroll", editScrollSpeed, "2", read, data);
	/*preserve *=*/ lineedit("mouse_speed_x", mouseSpeeds[0], "2", read, data);
	/*preserve *=*/ lineedit("mouse_speed_y", mouseSpeeds[1], "2", read, data);
	/*preserve *=*/ combobox("gamma_correction", gammaCorrection, 23, read, data);
	/*preserve *=*/ checkbox("only_normal_type2", allowHigherType2, false, true, read, data);
	/*preserve *=*/ checkbox("always_max_layers", alwaysMaxLayerCount, true, false, read, data);
	/*preserve *=*/ checkbox("stretch_sprite", stretchSpritesOnZoom, true, false, read, data);
	/*preserve *=*/ checkbox("ds1_saved_minimize", minimizeSavedDs1, true, false, read, data);
	/*preserve *=*/ combobox("center_zoom", zoomAfterCentering, 1, read, data);
	/*preserve *=*/ checkbox("winobj_can_scroll_keyb", mouseScrollsMain, true, false, read, data);
	/*preserve *=*/ checkbox("winobj_can_scroll_mouse", keybScrollsMain, false, false, read, data);
	/*preserve *=*/ lineedit("nb_type1_per_act", type1TableSize, "60", read, data);
	/*preserve *=*/ lineedit("nb_type2_per_act", type2TableSize, "150", read, data);
	/*preserve *=*/ checkbox("lower_speed_zoom_out", lowZoomedScrollSpeed, false, false, read, data);
	/*preserve *=*/ checkbox("workspace_enable", enableWorkspace, true, false, read, data);
	//return preserve;
}
コード例 #10
0
ファイル: csg.cpp プロジェクト: iquadrat/raytracer
void CSGIntersect::calculateBoundingBox() {

    assert(isclosed==true);

    // reset object's bb properties
    delete(boundingbox);
    boundingbox = 0;
    inverse = false;
    
    Vector3 min = Vector3::negativeInfinit();
    Vector3 max = Vector3::positiveInfinit();

    for(unsigned int i=0; i<objects->listsize; ++i) {

        SurfacePatch3D* current = objects->list[i];
        if ( static_cast<Object3D*>(current)->isInverse()==false ) {

            // an infinit bb does not help
            if (!current->hasFinitBounding()) continue;

            // transform bb into ObjectContainer's space
            BoundingBox checkbox(current->getBoundingMin(),current->getBoundingMax());
            checkbox.transformate(*this);

            // narrow min/max if possible
            min.maximize( checkbox.getBoxMin() );
            max.minimize( checkbox.getBoxMax() );
            
        }
        
    }
    
    // check for degenerated boundingbox
    // * add me *

    if  ( min.equals(Vector3::negativeInfinit()) && max.equals(Vector3::positiveInfinit()) ) {

        // if all members are inversed we can still try to draw a bb 
        // around all surfaces and set the container object to be inversed
    
        max = Vector3::negativeInfinit();
        min = Vector3::positiveInfinit();

        for(unsigned int i=0; i<objects->listsize; ++i) {

            SurfacePatch3D* current = objects->list[i];

            // if one member has no finit bb we must give up
            if (!current->hasFinitBounding()) return;

            // transform bb into ObjectContainer's space
            BoundingBox checkbox(current->getBoundingMin(),current->getBoundingMax());
            checkbox.transformate(*this);

            // extend min/max if necessary
            min.minimize( checkbox.getBoxMin() );
            max.maximize( checkbox.getBoxMax() );

        }
        
        inverse = true;
        
    }

    if ((!min.equals(Vector3::negativeInfinit()))&&(!max.equals(Vector3::positiveInfinit()))) {
        boundingbox = new BoundingBox(min,max);
    } 

}