Esempio n. 1
0
static std::string addAutograderButton(GWindow& gui, const std::string& text, const std::string& icon) {
    static Set<char> usedMnemonics;

    std::string html = "<html><center>" + stringReplace(text, "\n", "<br>") + "</center></html>";
    GButton* button = new GButton(html);
    STATIC_VARIABLE(AUTOGRADER_BUTTONS).add(button);

    // set mnemonic shortcut
    char mnemonic = '\0';
    for (int i = 0; i < (int) text.length(); i++) {
        if (isalpha(text[i]) && !usedMnemonics.contains(text[i])) {
            mnemonic = text[i];
            break;
        }
    }
    if (mnemonic) {
        usedMnemonics.add(mnemonic);
        button->setMnemonic(mnemonic);
        button->setAccelerator("ctrl " + charToString(mnemonic));
    }

    if (!icon.empty()) {
        button->setIcon(icon);
        button->setTextPosition(SwingConstants::SWING_CENTER, SwingConstants::SWING_BOTTOM);
    }
    gui.addToRegion(button, "SOUTH");
    return html;
}
Esempio n. 2
0
GAlert::GAlert(	GViewI *parent,
				const char *Title,
				const char *Text,
				const char *Btn1,
				const char *Btn2,
				const char *Btn3)
{
	GText *t = 0;
	Children.Insert(t = new GText(-1, 8, 8, -1, -1, (char*)Text));
	if (t)
	{
		// Setup dialog
		SetParent(parent);
		Name((char*)Title);

		List<GButton> Btns;
		List<const char> Names;
		if (Btn1) Names.Insert(Btn1);
		if (Btn2) Names.Insert(Btn2);
		if (Btn3) Names.Insert(Btn3);
		int i = 1, Tx = 0;
		for (const char *n=Names.First(); n; n=Names.Next())
		{
			GDisplayString ds(SysFont, (char*)n);
			int x = ds.X();
			GButton *v;
			Btns.Insert(v = new GButton(CMD_BASE + i++,
										0, 0,
										(int) ((30.0f + x) * BTN_SCALE),
										(int) (20.0f * BTN_SCALE),
										(char*)n));
			Tx += v->X() + ((i>1) ? 10 : 0);
		}
		
		int x = LgiApp->GetMetric(LGI_MET_DECOR_X) + 16;
		int y = LgiApp->GetMetric(LGI_MET_DECOR_Y) + 20 + 8 + 16;
		GRect r;
		if (t)
		{
			x += max(Tx, t->X());
			y += t->Y();
			r.ZOff(x, y);
		}
		SetPos(r);
		MoveToCenter();

		// Setup controls
		int Cx = X() / 2;
		int Bx = Cx - (Tx / 2);
		for (GButton *b=Btns.First(); b; b=Btns.Next())
		{
			GRect r;
			r.ZOff(b->X()-1, b->Y()-1);
			r.Offset(Bx, t->GetPos().y2 + 8);
			b->SetPos(r);
			Children.Insert(b);
			Bx += b->X() + 10;
		}
	}
}
void testQwindow() {
    static GWindow* window = new GWindow(900, 300);
    window->setTitle("QtGui Window");
    window->setResizable(true);
    window->setExitOnClose(true);
    window->center();

//    window->setColor("red");
//    window->fillRect(0, 0, 900, 300);

    // NORTH AREA

    GLabel* label = new GLabel("Type <b>stuff</b> <i>now</i> (North):");
    // label->setIcon("triangle-icon.png");
    label->setColor(GColor::GREEN);
    // label->setBackground(GColor::YELLOW);
    label->setActionListener([=]() {
        std::cout << "label clicked!" << std::endl;
        label->setBackground(label->getBackground() == "cyan" ? "yellow" : "cyan");
    });
    label->setDoubleClickListener(GEvent::LOG_EVENT);
    window->addToRegion(label, GWindow::REGION_NORTH);
    cout << "label:     " << label->toString() << endl;

    //        static GTextField* textField = new GTextField(42.0);
    static GTextField* textField = new GTextField("Marty");
    textField->setPlaceholder("type your name");
    // textField->setEditable(false);
    textField->setAutocompleteList({"matt", "Marty", "Stuart", "steve", "yana", "yes", "no"});
    textField->setTextChangeListener([]() {
        cout << "textfield text changed! text is:" << endl << textField->getText() << endl;
    });
    textField->setActionListener([]() {
        cout << "textfield action performed! text is:" << endl << textField->getText() << endl;
    });
    window->addToRegion(textField, GWindow::REGION_NORTH);
    cout << "textfield: " << textField->toString() << endl;

    static GSlider* slider = new GSlider();
    slider->setMinorTickSpacing(20);
    slider->setPaintLabels(true);
    slider->setPaintTicks(true);
    slider->setActionListener([](GEvent event) {
        cout << "sliderChangeHandler: slider was slid!" << endl;
        cout << "value: " << slider->getValue() << endl;
        cout << "event: " << event << endl;
        window->removeTimerListener();
    });

    window->addToRegion(slider, GWindow::REGION_NORTH);
    cout << "slider:    " << slider->toString() << endl;


    // WEST AREA

    static GCheckBox* checkBox = new GCheckBox("Question?", true);
    checkBox->setActionListener([](const GEvent&) {
        cout << "checkbox clicked! " << boolalpha << checkBox->isChecked() << endl;
    });
    window->addToRegion(checkBox, GWindow::REGION_WEST);
    window->addToRegion(new GLabel("Hi!"), GWindow::REGION_WEST);
    window->addToRegion(new GLabel("^_^"), GWindow::REGION_WEST);
    // window->setRegionAlignment(GWindow::REGION_WEST, "Top Right");
    cout << "checkbox:  " << checkBox->toString() << endl;


    // EAST AREA

    static GRadioButton* radio1group1 = new GRadioButton("A", "group1");
    static GRadioButton* radio2group1 = new GRadioButton("B", "group1", true);
    static GRadioButton* radio3group1 = new GRadioButton("C", "group1");
    static GRadioButton* radio1group2 = new GRadioButton("XX", "group2", true);
    static GRadioButton* radio2group2 = new GRadioButton("YY", "group2");

    GEventListenerVoid radioChangeHandler = []() {
        cout << "checkbox clicked! " << boolalpha
             << radio1group1->isChecked() << " "
             << radio2group1->isChecked() << " "
             << radio3group1->isChecked() << " "
             << radio1group2->isChecked() << " "
             << radio2group2->isChecked() << endl;
    };
    radio1group1->setActionListener(radioChangeHandler);
    radio1group1->setDoubleClickListener(GEvent::LOG_EVENT);
    radio2group1->setActionListener(radioChangeHandler);
    radio2group1->setDoubleClickListener(GEvent::LOG_EVENT);
    radio3group1->setActionListener(radioChangeHandler);
    radio3group1->setDoubleClickListener(GEvent::LOG_EVENT);
    radio1group2->setActionListener(radioChangeHandler);
    radio2group2->setActionListener(radioChangeHandler);

//    static QGScrollBar* scrollBar = new QGScrollBar(QGScrollBar::VERTICAL, 0, 10, 0, 500);
//    scrollBar->setValueChangeHandler([]() {
//        cout << "value: " << scrollBar->getValue() << endl;
//    });
//    window->addToRegion(scrollBar, GWindow::REGION_EAST);

    window->addToRegion(radio1group1, GWindow::REGION_EAST);
    window->addToRegion(radio2group1, GWindow::REGION_EAST);
    window->addToRegion(radio3group1, GWindow::REGION_EAST);
    window->addToRegion(radio1group2, GWindow::REGION_EAST);
    window->addToRegion(radio2group2, GWindow::REGION_EAST);
    // window->setRegionAlignment(GWindow::REGION_EAST, "Bottom Left");
//    cout << "radio:     " << radio1group1->toString() << endl;


    // SOUTH AREA

    static GChooser* chooser = new GChooser({"one", "two", "three four"});
    chooser->setColor(GColor::RED);
    chooser->setBackground(GColor::CYAN);
    chooser->setActionListener([]() {
        cout << "changeHandler: chooser was clicked!" << endl;
        cout << "selected: " << chooser->getSelectedIndex() << " : "
             << chooser->getSelectedItem() << endl;
        cout << "size: " << chooser->size() << endl << endl;
    });
    window->addToRegion(chooser, GWindow::REGION_SOUTH);
    cout << "chooser:   " << chooser->toString() << endl;

    GButton* button = new GButton("Triforce");
    button->setColor(GColor::RED);
    button->setBackground(GColor::YELLOW);
    button->setIcon("triangle-icon.png");
    button->setTextPosition(GInteractor::TEXT_BESIDE_ICON);
    button->setActionListener([](GEvent event) {
        cout << "button click! event = " << event << endl;
        cout.flush();
        window->restore();

        a();

//        window->setResizable(!window->isResizable());
//        cout << "clickHandler: button was clicked!" << endl;
//        cout << "location:  " << window->getLocation() << endl;
//        cout << "size:      " << window->getSize() << endl;
//        cout << "visible:   " << boolalpha << window->isVisible() << endl;
//        cout << "resizable: " << boolalpha << window->isResizable() << endl << endl;

//        // test GOptionPane
//        GOptionPane::showMessageDialog("I love Yana! <3");

//        Vector<string> choices = {"One", "Two", "Three"};
//        string result = GOptionPane::showOptionDialog("Pick a thing", choices);
//        cout << "You chose: " << result << endl;

        //    int result = GOptionPane::showConfirmDialog("Is Yana the most beautiful?", "Important Question", GOptionPane::YES_NO_CANCEL);
        //    cout << "You chose: " << result << endl;
        //    std::string answer = GOptionPane::showInputDialog("Who is my baby?", "Baby's name?", "bozo");
        //    cout << "You typed: " << answer << endl;

        //    string filename = QGFileChooser::showOpenDialog("", "*.txt, *.cpp, *.h");
        //    cout << "You chose: " << filename << endl;
        // window->clear();
    });

    //        button->setClickHandler([]() {
    //            // grayscale(image);
    //        });
    button->setDoubleClickListener([](GEvent event) {
        cout << "button double-click! event = " << event << endl;
    });
    button->setAccelerator("Ctrl-T");
    window->addToRegion(button, GWindow::REGION_SOUTH);
    cout << "button:    " << button->toString() << endl;
    cout << "button accelerator: " << button->getAccelerator() << endl;
    cout << "button font: " << button->getFont() << endl;
    button->setFont("Monospaced-Bold-14");

    static GButton* button4 = new GButton("HI!");
    window->addToRegion(button4, GWindow::REGION_SOUTH);

    static GCheckBox* checkboxs = new GCheckBox("&Visible?", /* checked */ true);
    checkboxs->setActionListener([]() {
        std::cout << "checkbox clicked!" << std::endl;
        // button4->setVisible(checkboxs->isChecked());
        if (checkboxs->isChecked()) {
            window->addToRegion(button4, GWindow::REGION_SOUTH);
        } else {
            window->removeFromRegion(button4, GWindow::REGION_SOUTH);
        }
    });
    checkboxs->setDoubleClickListener([]() {
        std::cout << "checkbox double-clicked!" << std::endl;
    });
    window->addToRegion(checkboxs, GWindow::REGION_SOUTH);

    GButton* timerButton = new GButton("Timer");
    GTimer* timer = nullptr;
    timerButton->setActionListener([&timer]() {
        if (timer) {
            timer->stop();
            delete timer;
            timer = nullptr;
        } else {
            timer = new GTimer(1000);
            timer->start();
        }
    });
    window->addToRegion(timerButton, GWindow::REGION_SOUTH);

//    window->setRegionAlignment(GWindow::REGION_SOUTH, "Center");

    // GLabel* oopsButton = new GLabel("I should not show up!!!!!");
    // oopsButton->setVisible(true);


    // CENTER AREA

//    static GTextArea* textArea = new GTextArea("This is \na multi-line\n\ntext area");
//    textArea->setPlaceholder("type some text");
//    textArea->setTextChangeListener([](GEvent) {
//        cout << "textarea text changed! text is:" << endl << textArea->getText() << endl;
//    });
//    window->addToRegion(textArea, "Center");

    GBrowserPane* pane = new GBrowserPane();
    pane->readTextFromFile("resfile3.html");
    pane->setLinkListener([](GEvent event) {
        cout << "event: " << event << ", url: " << event.getRequestURL() << endl;
    });
    window->addToRegion(pane, GWindow::REGION_CENTER);
    cout << "browser:  " << pane->toString() << endl;

    // window->pack();

//    while (true) {
//        GEvent event = waitForEvent(TIMER_EVENT);
//        cout << "event: " << event << endl;
//    }

    // will crash
    // a();

//    int* x = nullptr;
//    (*x)++;   // boom
}
void test_contains_and_getBounds() {
    bool useCompounds = false;
    int x0 = 350;
    int y0 = 300;
    Map<string, GObject*> shapeMap;
    GOval *oval = new GOval(x0, y0, 200, 100);
    GRoundRect *roundRect = new GRoundRect(x0, y0, 200, 100, 300);
    roundRect->setLineWidth(20);
    G3DRect *rect3d = new G3DRect(x0, y0, 200, 100, true);
    //rect3d->setLineWidth(5);
    rect3d->setFillColor("green");
    rect3d->setFilled(true);
    GPolygon *poly = new GPolygon;
    poly->addVertex(0, 0);
    poly->addEdge(200, 100);
    poly->addEdge(-200, 0);
    poly->setLocation(x0, y0);
    GPolygon *cpoly = new GPolygon;
    cpoly->addVertex(0, 0);
    cpoly->addEdge(200, 100);
    cpoly->addEdge(0, -100);
    cpoly->addEdge(-200, 100);
    cpoly->setLocation(x0, y0);
    GRect *rect = new GRect(x0, y0, 200, 100);
    GLine *line = new GLine(x0, y0, x0 + 200, y0 + 100);
    GLabel *label = new GLabel("Ostromantus", x0, y0);
    GArc *arc = new GArc(x0, y0, 350, 350, 0, 90);
    //arc->setLineWidth(5);
    arc->setColor("#44000000");
    GArc *filledArc = new GArc(x0, y0, 350, 100, 45, 225);
    filledArc->setFillColor("#88e0e0e0");
    filledArc->setFilled(true);
    GCompound *comp1 = new GCompound;
    comp1->setLocation(x0, y0);
    comp1->add(new GLabel("compound", 0, 15));
    GRect *bgRect1 = new GRect(0, 0);
    gw->add(bgRect1);
    bgRect1->setFillColor("#55dddddd");
    bgRect1->setFilled(true);
    GImage *image = new GImage("homer-transparent.png");
    image->setLocation(x0, y0);
    GCompound *comp = new GCompound;
    comp->setLocation(x0, y0);
    GRect *compRect = new GRect(20, 20, 100, 100);
    GOval *compOval = new GOval(90, 90, 150, 70);
    comp->add(compRect);
    comp->add(compOval);
    GButton *button = new GButton("Testo");
    button->setSize(200, 100);
    button->setLocation(x0, y0);
    shapeMap.put("oval", oval);
    shapeMap.put("rounded rectangle", roundRect);
    shapeMap.put("3D rectangle", rect3d);
    shapeMap.put("polygon", poly);
    shapeMap.put("crazy polygon", cpoly);
    shapeMap.put("rectangle", rect);
    shapeMap.put("line", line);
    shapeMap.put("arc", arc);
    shapeMap.put("filled arc", filledArc);
    shapeMap.put("label", label);
    shapeMap.put("image", image);
    shapeMap.put("compound", comp);
    shapeMap.put("button", button);

    GObject *currObj;
    GChooser *ch = new GChooser;
    ch->setActionCommand("chooser");
    ch->addItem("oval");
    ch->addItem("rounded rectangle");
    ch->addItem(("3D rectangle"));
    ch->addItem("polygon");
    ch->addItem("crazy polygon");
    ch->addItem("rectangle");
    ch->addItem("line");
    ch->addItem("arc");
    ch->addItem("filled arc");
    ch->addItem("label");
    ch->addItem("image");
    ch->addItem("compound");
    ch->addItem("button");
    ch->setSelectedItem("rectangle");
    currObj = rect;

    GButton *endButton = new GButton("End test");
    GButton *fillButton = new GButton("Auto-fill");
    GButton *rotateButton = new GButton("Rotate");
    GButton *scaleButton = new GButton("Scale");

    GCheckBox *compCheckbox = new GCheckBox("compounds");
    compCheckbox->setActionCommand("compounds");
    gw->addToRegion(compCheckbox, "north");
    gw->addToRegion(ch, "north");
    gw->addToRegion(rotateButton, "north");
    gw->addToRegion(scaleButton, "north");
    gw->addToRegion(fillButton, "north");
    gw->addToRegion(endButton, "north");

    while (true) {
        GEvent e = waitForEvent(ACTION_EVENT | MOUSE_EVENT);
        if (!e.isValid())
            continue;
        if (e.getEventClass() == ACTION_EVENT) {
            if (((GActionEvent) e).getActionCommand() == "End test")
                break;
            if (((GActionEvent) e).getActionCommand() == "compounds") {
                bgRect1->setVisible(compCheckbox->isSelected());
                useCompounds = compCheckbox->isSelected();
            }
            if (((GActionEvent) e).getActionCommand() == "Testo") {
                GPoint pt = button->getLocation();
                button->setLocation(pt.getX()-button->getWidth()-10, pt.getY());
                pause(1000);
                button->setLocation(pt);
            }
            if (((GActionEvent) e).getActionCommand() == "Auto-fill") {
                GRectangle bds = currObj->getBounds();
                int xmin = bds.getX();
                int ymin = bds.getY();
                int xmax = bds.getX() + bds.getWidth();
                int ymax = bds.getY() + bds.getHeight();
                int dx = useCompounds ? comp1->getX(): 0;
                int dy = useCompounds ? comp1->getY(): 0;
                for (int y = ymin; y < ymax; y+=1)
                    for (int x = xmin; x < xmax; x+=1) {
                        if (currObj->contains(x, y)) {
                            gw->setColor("red");
                            gw->fillOval(x + dx, y + dy, 1, 1);
                        } else {
                            gw->setColor("green");
                            gw->fillOval(x + dx, y + dy, 1, 1);
                        }
                    }
            }

            if (((GActionEvent) e).getActionCommand() == "Rotate") {
                currObj->rotate(45);
                if (useCompounds) {
                    bgRect1->setBounds(comp1->getBounds());
                }
            }
            if (((GActionEvent) e).getActionCommand() == "Scale") {
                currObj->scale(1.2, 0.8);
                if (useCompounds) {
                    bgRect1->setBounds(comp1->getBounds());
                }
            }
            if (((GActionEvent) e).getActionCommand() == "chooser") {
                string shape = ch->getSelectedItem();
                if (useCompounds) {
                    comp1->remove(currObj);
                    gw->remove(comp1);
                } else {
                    gw->remove(currObj);
                }
                gw->setColor("white");
                gw->fillRect(0, 0, gw->getCanvasWidth(), gw->getCanvasHeight());
                //drawGrid();
                gw->setColor("black");
                currObj = shapeMap.get(shape);
                if (useCompounds) {
                    gw->add(comp1);
                    comp1->add(currObj, 50, 50);
                    bgRect1->setBounds(comp1->getBounds());
                } else {
                    gw->add(currObj);
                }
                gw->drawOval(currObj->getX()-2, currObj->getY()-2, 4, 4);
            }
        } else if (e.getEventType() == MOUSE_CLICKED) {
            double x = ((GMouseEvent) e).getX();
            double y = ((GMouseEvent) e).getY();
            if (currObj->contains(x, y)) {
                gw->setColor("red");
                gw->fillOval(x, y, 1, 1);
            }
        }
    }
}
void test_interactors_as_objects() {
    GButton *b = new GButton("button");
    b->rotate(90);
    b->scale(2);
    b->setColor("red");
    b->setSize(100, 100);
    b->setLineWidth(20);
    gw->add(b, 10, 10);
    gw->drawRect(b->getBounds());

    GSlider *s = new GSlider(5, 40, 20);
    s->rotate(90);
    s->scale(2);
    s->setColor("red");
    s->setSize(100, 100);
    s->setLineWidth(20);
    gw->add(s, 120, 10);
    gw->drawRect(s->getBounds());

    GCheckBox *c = new GCheckBox("checkbox");
    c->rotate(90);
    c->scale(2);
    c->setColor("red");
    c->setSize(100, 100);
    c->setLineWidth(20);
    gw->add(c, 230, 10);
    gw->drawRect(c->getBounds());

    GChooser *ch = new GChooser;
    ch->addItem("beef");
    ch->addItem("veal");
    ch->rotate(90);
    ch->scale(2);
    ch->setColor("red");
    ch->setSize(100, 100);
    ch->setLineWidth(20);
    gw->add(ch, 340, 10);
    gw->drawRect(ch->getBounds());

    GTextField *t = new GTextField(40);
    t->rotate(90);
    t->scale(2);
    t->setColor("red");
    t->setSize(100, 100);
    t->setLineWidth(20);
    t->setText("text field");
    gw->add(t, 450, 10);
    gw->drawRect(t->getBounds());

    GButton *b2 = new GButton("button");
    b2->rotate(90);
    b2->scale(2);
    b2->setColor("red");
    b2->setSize(100, 100);
    b2->setLineWidth(20);
    gw->addToRegion(b2, "SOUTH");

    GSlider *s2 = new GSlider(5, 40, 20);
    s2->rotate(90);
    s2->scale(2);
    s2->setColor("red");
    s2->setSize(100, 100);
    s2->setLineWidth(20);
    gw->addToRegion(s2, "SOUTH");

    GCheckBox *c2 = new GCheckBox("checkbox");
    c2->rotate(90);
    c2->scale(2);
    c2->setColor("red");
    c2->setSize(100, 100);
    c2->setLineWidth(20);
    gw->addToRegion(c2, "SOUTH");

    GChooser *ch2 = new GChooser;
    ch2->addItem("beef");
    ch2->addItem("veal");
    ch2->rotate(90);
    ch2->scale(2);
    ch2->setColor("red");
    ch2->setSize(100, 100);
    ch2->setLineWidth(20);
    gw->addToRegion(ch2, "SOUTH");

    GTextField *t2 = new GTextField;
    t2->rotate(90);
    t2->scale(2);
    t2->setColor("red");
    t2->setSize(100, 100);
    t2->setLineWidth(20);
    t2->setText("text field");
    gw->addToRegion(t2, "SOUTH");
}
Esempio n. 6
0
GInput::GInput(GViewI *parent, const char *InitStr, const char *Msg, const char *Title, bool Password, GInputCallback callback, void *callbackparam)
{
	Callback = callback;
	CallbackParam = callbackparam;

	GText *Txt = new GText(-1, 5, 5, -1, -1, Msg);
	GDisplayString MsgDs(SysFont, ValidStr(InitStr)?InitStr:"A");
	int Dx = LgiApp->GetMetric(LGI_MET_DECOR_X) + 10;
	int Dy = LgiApp->GetMetric(LGI_MET_DECOR_Y);
	
	int ContextX = 400;
	ContextX = max(ContextX, MsgDs.X() + 40);
	ContextX = min(ContextX, (int)(GdcD->X() * 0.8));
	int EditX = ContextX;
	int CallbackX = callback ? GBUTTON_MIN_X + 20 : 0;
	ContextX = max(ContextX, Txt->X() + CallbackX);

	GRect r(0, 0, ContextX + CallbackX + Dx, 70 + Txt->Y() + Dy);

	SetParent(parent);
	Name(Title);
	SetPos(r);
	MoveToCenter();

	GRect c = GetClient();
	Children.Insert(Txt);
	Children.Insert(Edit = new GEdit(IDC_EDIT, 5, Txt->GetPos().y2 + 5, EditX - 1, MsgDs.Y()+7, InitStr));
	if (Edit)
	{
		Edit->Password(Password);
		Edit->Focus(true);
		if (Callback)
		{
			GRect e = Edit->GetPos();
			Children.Insert(new GButton(IDC_CALLBACK, c.X() - (CallbackX-5) - 6, e.y1, CallbackX-5, e.Y()-1, "..."));
		}
	}

	GButton *Ok = new GButton(IDOK, 0, 0, -1, -1, LgiLoadString(L_BTN_OK, "Ok"));
	GButton *Cancel = new GButton(IDCANCEL, 0, 0, -1, -1, LgiLoadString(L_BTN_CANCEL, "Cancel"));
	int BtnX = max(Ok->X(), Cancel->X());
	int BtnY = Edit->GetPos().y2 + 11;
	
	GRect p = Cancel->GetPos();
	p.x2 = p.x1 + BtnX - 1;
	p.Offset(c.X() - Cancel->X() - 5, BtnY);
	Cancel->SetPos(p);
	
	p = Ok->GetPos();
	p.x2 = p.x1 + BtnX - 1;
	p.Offset(Cancel->GetPos().x1 - p.X() - 5, BtnY);
	Ok->SetPos(p);

	Children.Insert(Ok);
	Children.Insert(Cancel);
	Ok->Default(true);
}