Ejemplo n.º 1
0
 Rectangle Window::getChildrenArea()
 {
     return Rectangle(getPadding(),
                      getTitleBarHeight(),
                      getWidth() - getPadding() * 2,
                      getHeight() - getPadding() - getTitleBarHeight());
 }
Ejemplo n.º 2
0
void
Wellcome::mousePressed(gcn::MouseEvent &event)
{
    gcn::Rectangle d1, d2, d3, d4;
    d1.setAll(mNext->getDimension().x,
              mNext->getDimension().y + getTitleBarHeight(),
              mNext->getDimension().x + mNext->getDimension().width,
              mNext->getDimension().y + mNext->getDimension().height + getTitleBarHeight());
    d2.setAll(mPrev->getDimension().x,
              mPrev->getDimension().y + getTitleBarHeight(),
              mPrev->getDimension().x + mPrev->getDimension().width,
              mPrev->getDimension().y + mPrev->getDimension().height + getTitleBarHeight());
    d3.setAll(mFinish->getDimension().x,
              mFinish->getDimension().y + getTitleBarHeight(),
              mFinish->getDimension().x + mFinish->getDimension().width,
              mFinish->getDimension().y + mFinish->getDimension().height + getTitleBarHeight());
    d4.setAll(mAgain->getDimension().x,
              mAgain->getDimension().y + getTitleBarHeight(),
              mAgain->getDimension().x + mAgain->getDimension().width,
              mAgain->getDimension().y + mAgain->getDimension().height + getTitleBarHeight());

    if(d1.isPointInRect(event.getX(), event.getY()) ||
       d2.isPointInRect(event.getX(), event.getY()) ||
       d3.isPointInRect(event.getX(), event.getY()) ||
       d4.isPointInRect(event.getX(), event.getY()) ||
       event.getY()<getTitleBarHeight())
    {
        Window::mousePressed(event);
        return;
    }
    setActionEventId("next");
    distributeActionEvent();

}
Ejemplo n.º 3
0
void EquipmentWindow::loadEquipBoxes()
{
    if (mEquipBox)
        delete[] mEquipBox;

    // Load equipment boxes.
    mBoxesNumber = mEquipment->getSlotNumber();
    mEquipBox = new EquipBox[mBoxesNumber];

    for (int i = 0; i < mBoxesNumber; ++i)
    {
        Position boxPosition = Net::getInventoryHandler()->getBoxPosition(i);
        mEquipBox[i].posX = boxPosition.x + getPadding();
        mEquipBox[i].posY = boxPosition.y + getTitleBarHeight();

        const std::string &backgroundFile =
            Net::getInventoryHandler()->getBoxBackground(i);

        if (!backgroundFile.empty())
        {
            mEquipBox[i].backgroundImage =
                Theme::instance()->getImageFromTheme(backgroundFile);
        }
    }
}
void StandaloneFilterWindow::resized()
{
    DocumentWindow::resized();

    if (optionsButton != 0)
        optionsButton->setBounds (8, 6, 60, getTitleBarHeight() - 8);
}
Ejemplo n.º 5
0
Wellcome::Wellcome():
    Window("Hoşgeldin :)")
{
    setResizable(false);
    setDefaultSize(50, 50, 420, 430);
    loadWindowState();
    setResizable(false);
    ResourceManager *resman = ResourceManager::getInstance();
    mSlide = resman->getImage("graphics/sunular/basla1/g_00.png");

    setVisible(true);
    mNext = new Button("İleri","next",this);
    mPrev = new Button("Geri","prev",this);
    mFinish = new Button("Kapat","close",this);

    mNext->setPosition(205, getHeight()- mNext->getHeight() - getTitleBarHeight());
    mNext->setWidth(100);
    add(mNext);

    mPrev->setPosition(105,getHeight()- mPrev->getHeight() - getTitleBarHeight());
    mPrev->setWidth(100);
    add(mPrev);

    mFinish->setPosition(330,0);
    mFinish->setWidth(100);
    add(mFinish);

    mAgain = new CheckBox("Girişte göster.",false);
    mAgain->setPosition(mNext->getX() + mNext->getWidth() + 2 ,getHeight()- mAgain->getHeight() - getTitleBarHeight()-5);
    add(mAgain);

    mList.push_back("graphics/sunular/basla1/g_00.png");
    mList.push_back("graphics/sunular/basla1/g_01.png");
    mList.push_back("graphics/sunular/basla1/g_02.png");
    mList.push_back("graphics/sunular/basla1/g_03.png");
    mList.push_back("graphics/sunular/basla1/g_04.png");
    mList.push_back("graphics/sunular/basla1/g_05.png");
    mList.push_back("graphics/sunular/basla1/g_06.png");
    mList.push_back("graphics/sunular/basla1/g_07.png");
    mList.push_back("graphics/sunular/basla1/g_08.png");
//    mList.push_back("graphics/sunular/basla1/g_09.png");
//    mList.push_back("graphics/sunular/basla1/g_10.png");
    mCurrentSlide = 0;
    current_npc = 0;
    NPC::isTalking = false;
    addActionListener(this);
}
const Rectangle DocumentWindow::getTitleBarArea()
{
    const BorderSize border (getBorderThickness());

    return Rectangle (border.getLeft(), border.getTop(),
                      getWidth() - border.getLeftAndRight(),
                      getTitleBarHeight());
}
Ejemplo n.º 7
0
void Minimap::setMap(Map *map)
{
    // Set the title for the Minimap
    std::string caption;

    if (map)
        caption = map->getName();

    if (caption.empty())
        caption = _("Map");

    minimap->setCaption(caption);

    // Adapt the image
    if (mMapImage)
    {
        mMapImage->decRef();
        mMapImage = 0;
    }

    if (map)
    {
        ResourceManager *resman = ResourceManager::getInstance();
        mMapImage = resman->getImage(map->getProperty("minimap"));
    }

    if (mMapImage)
    {
        const int offsetX = 2 * getPadding();
        const int offsetY = getTitleBarHeight() + getPadding();
        const int titleWidth = getFont()->getWidth(getCaption()) + 15;
        const int mapWidth = mMapImage->getWidth() < 100 ?
                             mMapImage->getWidth() + offsetX : 100;
        const int mapHeight = mMapImage->getHeight() < 100 ?
                              mMapImage->getHeight() + offsetY : 100;

        setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth);
        setMinHeight(mapHeight);

        mWidthProportion = (float) mMapImage->getWidth() / map->getWidth();
        mHeightProportion = (float) mMapImage->getHeight() / map->getHeight();

        setMaxWidth(mMapImage->getWidth() > titleWidth ?
                    mMapImage->getWidth() + offsetX : titleWidth);
        setMaxHeight(mMapImage->getHeight() + offsetY);

        setDefaultSize(getX(), getY(), getWidth(), getHeight());
        resetToDefaultSize();

        if (mShow)
            setVisible(true);
    }
    else
    {
        if (!isSticky())
            setVisible(false);
    }
}
Ejemplo n.º 8
0
void Window::setContentSize(int width, int height)
{
    width = width + 2 * getPadding();
    height = height + getPadding() + getTitleBarHeight();

    if (getMinWidth() > width)
        width = getMinWidth();
    else if (getMaxWidth() < width)
        width = getMaxWidth();
    if (getMinHeight() > height)
        height = getMinHeight();
    else if (getMaxHeight() < height)
        height = getMaxHeight();

    setSize(width, height);
}
Ejemplo n.º 9
0
Item* EquipmentWindow::getItem(const int x, const int y)
{
    for (int i = EQUIP_LEGS_SLOT; i < EQUIP_VECTOREND; i++)
    {
        const int windowX = x - getPadding();
        const int windowY = y - getTitleBarHeight();

        if (mEquipIcon[i]->getDimension().isPointInRect(windowX, windowY))
        {
            return (i != EQUIP_AMMO_SLOT) ?
                    mInventory->getItem(mEquipment->getEquipment(i)) :
                    mInventory->getItem(mEquipment->getArrows());
        }
    }
    return NULL;
}
Ejemplo n.º 10
0
Setup::Setup():
    Window(_("Setup"))
{
    setWindowName("Setup");
    saveVisibility(false);
    setCloseButton(true);
    int width = 340 + 2 * getPadding();
    int height = 340 + 2 * getPadding() + getTitleBarHeight();

    static const char *buttonNames[] = {
        N_("Reset Windows"), N_("Cancel"), N_("Apply"), 0
    };

    mPanel = new TabbedArea();
    mPanel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40));

    mTabs.push_back(new Setup_Video());
    mTabs.push_back(new Setup_Audio());
    mTabs.push_back(new Setup_Input());
    mTabs.push_back(new Setup_Colors());

    for (std::list<SetupTabContainer*>::iterator i = mTabs.begin(),
         i_end = mTabs.end(); i != i_end; ++i)
    {
        SetupTabContainer *tab = *i;
        mPanel->addTab(tab->getName(), tab);
    }

    place(0, 0, mPanel, 7, 6).setPadding(2);

    for (int i = 0; buttonNames[i] != NULL; ++i)
    {
        Button *btn = new Button(gettext(buttonNames[i]), buttonNames[i], this);
        place(i + 4, 6, btn);

        // Store this button, as it needs to be enabled/disabled
        if (!strcmp(buttonNames[i], N_("Reset Windows")))
            mResetWindows = btn;
    }

    setDefaultSize(width, height, ImageRect::CENTER);

    Layout &layout = getLayout();
    layout.setRowHeight(0, Layout::AUTO_SET);

    loadWindowState();
}
Ejemplo n.º 11
0
void LightingWindow::moved() {
  if (initialized_) {
    if (SocketLineGetter* getter = SocketLineGetter::instance()) {
      YAML::Emitter out;

      out << YAML::BeginMap
          << YAML::Key << "type"
          << YAML::Value << "move"
          << YAML::Key << "top_left"
          << YAML::Value << YAML::BeginSeq
          << getX() << getY() - getTitleBarHeight()
          << YAML::EndSeq
          << YAML::EndMap;

      getter->writeSocket(out.c_str(), out.size());
    }
  }
}
Ejemplo n.º 12
0
    void Window::resizeToContent()
    {
        WidgetListIterator it;

        int w = 0, h = 0;
        for (it = mWidgets.begin(); it != mWidgets.end(); it++)
        {
            if ((*it)->getX() + (*it)->getWidth() > w)
            {
                w = (*it)->getX() + (*it)->getWidth();
            }

            if ((*it)->getY() + (*it)->getHeight() > h)
            {
                h = (*it)->getY() + (*it)->getHeight();
            }
        }

        setSize(w + 2* getPadding(), h + getPadding() + getTitleBarHeight());
    }
Ejemplo n.º 13
0
Recorder::Recorder(ChatWindow *chat, const std::string &title,
                   const std::string &buttonTxt) :
    Window(title)
{
    setWindowName("Recorder");
    const int offsetX = 2 * getPadding() + 10;
    const int offsetY = getTitleBarHeight() + getPadding() + 10;

    mChat = chat;
    Button *button = new Button(buttonTxt, "activate", this);

    // 123 is the default chat window height. If you change this in Chat, please
    // change it here as well
    setDefaultSize(button->getWidth() + offsetX, button->getHeight() +
                   offsetY, ImageRect::LOWER_LEFT, 0, 123);

    place(0, 0, button);

    Layout &layout = getLayout();
    layout.setRowHeight(0, Layout::AUTO_SET);

    loadWindowState();
}
Ejemplo n.º 14
0
void VstPluginWindow::resizeContentComponent (const int width,
                                              const int height,
                                              const bool limitHeight)
{
    DBG ("VstPluginWindow::resizeContentComponent");

    int desiredWidth = width + 2
                       /* + getBorderThickness().getLeftAndRight ()*/;

    int desiredHeight = getTitleBarHeight()
                        + getMenuBarHeight()
                        + getBorderThickness().getTopAndBottom ()
                        + (content ? content->getTabbedPanelHeight () : 0)
                        + (content ? (content->hasMidiKeyboardOpen() ? content->getMidiKeyboardHeight() : 0) : 0);

    int maxHeight = height + desiredHeight;
    maxHeight = limitHeight ? jmin (700, maxHeight) : maxHeight;

    setSize (desiredWidth, maxHeight);

    if (limitHeight)
        setResizeLimits (desiredWidth, desiredHeight,
                         desiredWidth, maxHeight);
}
Ejemplo n.º 15
0
 void Window::resizeToContent()
 {
     resizeToChildren();
     setSize(getWidth() + 2* getPadding(), 
             getHeight() + getPadding() + getTitleBarHeight());
 }
Ejemplo n.º 16
0
void Windowiki::setContentHeight(int height)
{
//    mChrome->setHeight(height);
    setHeight(height + getPadding() + getTitleBarHeight());
}
Ejemplo n.º 17
0
    void Window::draw(Graphics* graphics)
    {
        const Color &faceColor = getBaseColor();
        Color highlightColor, shadowColor;
        const int alpha = getBaseColor().a;
        highlightColor = faceColor + 0x303030;
        highlightColor.a = alpha;
        shadowColor = faceColor - 0x303030;
        shadowColor.a = alpha;

        Rectangle d = getChildrenArea();

        // Fill the background around the content
        graphics->setColor(faceColor);
        // Fill top
        graphics->fillRectangle(Rectangle(0,0,getWidth(),d.y - 1));
        // Fill left
        graphics->fillRectangle(Rectangle(0,d.y - 1, d.x - 1, getHeight() - d.y + 1));
        // Fill right
        graphics->fillRectangle(Rectangle(d.x + d.width + 1,
                                          d.y - 1,
                                          getWidth() - d.x - d.width - 1,
                                          getHeight() - d.y + 1));
        // Fill bottom
        graphics->fillRectangle(Rectangle(d.x - 1,
                                          d.y + d.height + 1,
                                          d.width + 2,
                                          getHeight() - d.height - d.y - 1));

        if (isOpaque())
        {
            graphics->fillRectangle(d);
        }

        // Construct a rectangle one pixel bigger than the content
        d.x -= 1;
        d.y -= 1;
        d.width += 2;
        d.height += 2;

        // Draw a border around the content
        graphics->setColor(shadowColor);
        // Top line
        graphics->drawLine(d.x,
                           d.y,
                           d.x + d.width - 2,
                           d.y);

        // Left line
        graphics->drawLine(d.x,
                           d.y + 1,
                           d.x,
                           d.y + d.height - 1);

        graphics->setColor(highlightColor);
        // Right line
        graphics->drawLine(d.x + d.width - 1,
                           d.y,
                           d.x + d.width - 1,
                           d.y + d.height - 2);
        // Bottom line
        graphics->drawLine(d.x + 1,
                           d.y + d.height - 1,
                           d.x + d.width - 1,
                           d.y + d.height - 1);

        drawChildren(graphics);

        int textX;
        int textY;

        textY = ((int)getTitleBarHeight() - getFont()->getHeight()) / 2;

        switch (getAlignment())
        {
          case Graphics::LEFT:
              textX = 4;
              break;
          case Graphics::CENTER:
              textX = getWidth() / 2;
              break;
          case Graphics::RIGHT:
              textX = getWidth() - 4;
              break;
          default:
              throw GCN_EXCEPTION("Unknown alignment.");
        }

        graphics->setColor(getForegroundColor());
        graphics->setFont(getFont());
        graphics->pushClipArea(Rectangle(0, 0, getWidth(), getTitleBarHeight() - 1));
        graphics->drawText(getCaption(), textX, textY, getAlignment());
        graphics->popClipArea();
    }
Ejemplo n.º 18
0
/// Create dialog window for selecting a new GUI skin.
///
/// @param editorWindow pointer to the plug-in GUI
///
/// @param currentSkinFile file pointing to the currently used skin
///
/// ### Exit values
///
/// | %Value | %Result                           |
/// | :----: | --------------------------------- |
/// | 0      | window has been closed "by force" |
/// | 1      | user has selected a skin          |
///
GenericWindowSkin::GenericWindowSkin(Component *editorWindow, const File &currentSkinFile)
    : DocumentWindow("Select skin", Colours::white, 0, true)
{
    // dialog window dimentsions
    int windowWidth = 150;
    int windowHeight = 0;

    // empty windows are boring, so let's prepare a space for some
    // window components
    setContentOwned(&contentComponent, false);

    // locate skin directory and fill list box model
    File fileSkinDirectory = currentSkinFile.getParentDirectory();
    listBoxModel.fill(fileSkinDirectory);

    // set model for list box
    listBox.setModel(&listBoxModel);

    // calculate and set list box dimensions
    int listBoxWidth = windowWidth - 20;
    int listBoxHeight = listBoxModel.getNumRows() * listBox.getRowHeight() + 2;
    listBox.setBounds(10, 10, listBoxWidth, listBoxHeight);

    // set look of list box
    listBox.setColour(ListBox::outlineColourId, Colours::grey);
    listBox.setOutlineThickness(1);

    // disable multiple selections
    listBox.setMultipleSelectionEnabled(false);

    // select current skin in list box
    currentSkinName = currentSkinFile.getFileNameWithoutExtension();
    int rowNumber = listBoxModel.getRow(currentSkinName);
    listBox.selectRow(rowNumber);

    // display list box
    contentComponent.addAndMakeVisible(listBox);

    // calculate dialog window height from height of list box
    windowHeight = listBoxHeight + 50;

    // create and position an "select" button
    buttonSelect.setButtonText("Select");
    buttonSelect.setBounds(10, windowHeight - 30, 60, 20);
    buttonSelect.setColour(TextButton::buttonColourId, Colours::red);
    buttonSelect.setColour(TextButton::buttonOnColourId, Colours::red);

    // add "skin" window as button listener and display the button
    buttonSelect.addListener(this);
    contentComponent.addAndMakeVisible(buttonSelect);

    // create and position an "default" button
    buttonDefault.setButtonText("Default");
    buttonDefault.setBounds(windowWidth - 70, windowHeight - 30, 60, 20);
    buttonDefault.setColour(TextButton::buttonColourId, Colours::yellow);
    buttonDefault.setColour(TextButton::buttonOnColourId, Colours::yellow);

    // add "skin" window as button listener and display the button
    buttonDefault.addListener(this);
    contentComponent.addAndMakeVisible(buttonDefault);

    // set window dimensions
    setSize(windowWidth, windowHeight + getTitleBarHeight());

    // keep dialog window on top
    setAlwaysOnTop(true);

    // center window on editor
    centreAroundComponent(editorWindow, getWidth(), getHeight());

    // this window does not have any transparent areas (increases
    // performance on redrawing)
    setOpaque(true);

    // finally, display window
    setVisible(true);
}