Beispiel #1
0
Frame* Frame::createSimpleFrame(
    const std::string& name,
    point_type         cw,
    point_type         ch,
    point_type         w,
    point_type         h,
    unsigned int       flags,
    Frame*             exFrame
) {
    Frame* frame = 0;

    // Use an "existing frame" if we have it (for example, if you've in inherited from
    // Frame and want to use this stuff.
    if(!exFrame) frame = new Frame(name, flags);

    else frame = exFrame;

    frame->addWidget(new Corner(CORNER_LOWER_LEFT,  cw, ch), 0, 0);
    frame->addWidget(new Border(BORDER_BOTTOM,      w,  ch), 0, 1);
    frame->addWidget(new Corner(CORNER_LOWER_RIGHT, cw, ch), 0, 2);
    frame->addWidget(new Border(BORDER_LEFT,        cw, h),  1, 0);
    frame->addWidget(new Border(BORDER_RIGHT,       cw, h),  1, 2);
    frame->addWidget(new Corner(CORNER_UPPER_LEFT,  cw, ch), 2, 0);
    frame->addWidget(new Border(BORDER_TOP,         w,  ch), 2, 1);
    frame->addWidget(new Corner(CORNER_UPPER_RIGHT, cw, ch), 2, 2);

    EmbeddedWindow* ew = new EmbeddedWindow(name, w, h);

    ew->setCanFill(true);

    frame->addWidget(ew, 1, 1);

    return frame;
}
Window::EmbeddedWindow* Window::embed(
    const std::string& newName,
    Widget::Layer      layer,
    unsigned int       layerOffset
) {
    EmbeddedWindow* ew = new EmbeddedWindow(
        newName.size() > 0 ? newName : _name + "Embedded",
        getWidth(),
        getHeight()
    );

    ew->setWindow(this);
    ew->setSize(getWidth(), getHeight());
    ew->setCanFill(true);
    ew->setLayer(layer, layerOffset);

    return ew;
}