Exemplo n.º 1
0
GuiTable::GuiTable(const Widget2 *const widget,
                   TableModel *const initial_model,
                   const bool opacity) :
    Widget(widget),
    MouseListener(),
    KeyListener(),
    mModel(nullptr),
    mTopWidget(nullptr),
    mActionListeners2(),
    mHighlightColor(getThemeColor(ThemeColorId::HIGHLIGHT)),
    mSelectedRow(-1),
    mSelectedColumn(-1),
    mLinewiseMode(false),
    mWrappingEnabled(false),
    mOpaque(opacity),
    mSelectable(true)
{
    mAllowLogic = false;
    mBackgroundColor = getThemeColor(ThemeColorId::BACKGROUND);

    setModel(initial_model);
    setFocusable(true);

    addMouseListener(this);
    addKeyListener(this);
}
Exemplo n.º 2
0
void Tab::init()
{
    setFocusable(false);
    setFrameSize(0);
    mFlash = false;

    if (mInstances == 0)
    {
        // Load the skin
        Image *tab[TAB_COUNT];

        int a, x, y, mode;

        for (mode = 0; mode < TAB_COUNT; mode++)
        {
            tab[mode] = Theme::getImageFromTheme(data[mode].file);
            a = 0;
            for (y = 0; y < 3; y++)
            {
                for (x = 0; x < 3; x++)
                {
                    tabImg[mode].grid[a] = tab[mode]->getSubImage(
                            data[x].gridX, data[y].gridY,
                            data[x + 1].gridX - data[x].gridX + 1,
                            data[y + 1].gridY - data[y].gridY + 1);
                    tabImg[mode].grid[a]->setAlpha(mAlpha);
                    a++;
                }
            }
            tab[mode]->decRef();
        }
    }
    mInstances++;
}
Exemplo n.º 3
0
TSpriteIcon::TSpriteIcon() :
    sprite_(NULL)
{
    setFrameSize(1);
    setFocusable(0);
    setVisible(1);
}
Exemplo n.º 4
0
void Slider::init()
{
    mAllowLogic = false;
    setFocusable(true);
    setFrameSize(1);

    addMouseListener(this);
    addKeyListener(this);

    setFrameSize(0);

    // Load resources
    if (mInstances == 0)
    {
        if (theme)
        {
            for (int mode = 0; mode < 2; mode ++)
                theme->loadRect(buttons[mode], data[mode], "slider.xml", 0, 8);
        }
        updateAlpha();
    }

    mInstances++;

    if (buttons[0].grid[HGRIP])
        setMarkerLength(buttons[0].grid[HGRIP]->getWidth());
}
Exemplo n.º 5
0
ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity):
    mInventory(inventory),
    mGridColumns(1),
    mGridRows(1),
    mSelectedIndex(-1),
    mHighlightedIndex(-1),
    mLastUsedSlot(-1),
    mSelectionStatus(SEL_NONE),
    mForceQuantity(forceQuantity),
    mSwapItems(false),
    mDescItems(false)
{
    mItemPopup = new ItemPopup;
    setFocusable(true);

    ResourceManager *resman = ResourceManager::getInstance();

    mSelImg = resman->getImage("graphics/gui/selection.png");
    if (!mSelImg)
        logger->error("Unable to load selection.png");

    addKeyListener(this);
    addMouseListener(this);
    addWidgetListener(this);
}
Exemplo n.º 6
0
TabbedArea::TabbedArea(const Widget2 *const widget) :
    ActionListener(),
    BasicContainer(widget),
    KeyListener(),
    MouseListener(),
    WidgetListener(),
    mArrowButton(),
    mSelectedTab(nullptr),
    mTabContainer(new BasicContainer2(widget)),
    mWidgetContainer(new BasicContainer2(widget)),
    mTabsToDelete(),
    mTabs(),
    mTabsWidth(0),
    mVisibleTabsWidth(0),
    mTabScrollIndex(0),
    mRightMargin(0),
    mOpaque(Opaque_false),
    mEnableScrollButtons(false),
    mFollowDownScroll(false),
    mBlockSwitching(true),
    mResizeHeight(true)
{
    setFocusable(true);
    addKeyListener(this);
    addMouseListener(this);
}
Exemplo n.º 7
0
  TabbedPane::TabbedPane( Widget * tabContainer /*= NULL*/,
                   Widget *widgetContainer /*= NULL*/ )
   : highestTab(0), tabPadding(0), resizeTabContent(false),
     selectedTab(reinterpret_cast<Tab*>(NULL),reinterpret_cast<Widget*>(NULL))
  {
    if(tabContainer)
    {
      isMaintainingTabContainer = false;
      this->tabContainer = tabContainer;
    }
    else
    {
      isMaintainingTabContainer = true;
      this->tabContainer = new EmptyWidget();
    }

    if(widgetContainer)
    {
      isMaintainingWidgetContainer = false;
      this->widgetContainer = widgetContainer;
    }
    else
    {
      isMaintainingWidgetContainer = true;
      this->widgetContainer = new EmptyWidget();
    }

    addPrivateChild(this->tabContainer);
    addPrivateChild(this->widgetContainer);
    setTabable(true);
    setFocusable(true);
	setReverseTabable(false);

    adjustTabs();
  }
Exemplo n.º 8
0
Viewport::Viewport():
    mMap(0),
    mMouseX(0),
    mMouseY(0),
    mPixelViewX(0.0f),
    mPixelViewY(0.0f),
    mDebugFlags(0),
    mPlayerFollowMouse(false),
    mLocalWalkTime(-1),
    mHoverBeing(0),
    mHoverItem(0)
{
    setOpaque(false);
    addMouseListener(this);

    mScrollLaziness = config.getIntValue("ScrollLaziness");
    mScrollRadius = config.getIntValue("ScrollRadius");
    mScrollCenterOffsetX = config.getIntValue("ScrollCenterOffsetX");
    mScrollCenterOffsetY = config.getIntValue("ScrollCenterOffsetY");

    mPopupMenu = new PopupMenu;
    mBeingPopup = new BeingPopup;

    setFocusable(true);

    listen(Event::ConfigChannel);
    listen(Event::ActorSpriteChannel);
}
Exemplo n.º 9
0
ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity):
    mInventory(inventory),
    mGridColumns(1),
    mGridRows(1),
    mSelectedIndex(-1),
    mHighlightedIndex(-1),
    mLastUsedSlot(-1),
    mSelectionStatus(SEL_NONE),
    mForceQuantity(forceQuantity),
    mSwapItems(false),
    mDescItems(false),
    mTag(0),
    mSortType(0),
    mItemPopup(new ItemPopup),
    mShowMatrix(nullptr),
    mClicks(1),
    mEquipedColor(Theme::getThemeColor(Theme::ITEM_EQUIPPED)),
    mUnEquipedColor(Theme::getThemeColor(Theme::ITEM_NOT_EQUIPPED))
{
    setFocusable(true);

    mSelImg = Theme::getImageFromTheme("selection.png");
    if (!mSelImg)
        logger->log1("Error: Unable to load selection.png");

    addKeyListener(this);
    addMouseListener(this);
    addWidgetListener(this);
}
Exemplo n.º 10
0
void Tab::init()
{
    addMouseListener(this);
    setFocusable(false);
    setFrameSize(0);
    mFlash = 0;

    addWidgetListener(this);

    if (mInstances == 0)
    {
        // Load the skin
        Theme *const theme = Theme::instance();
        if (theme)
        {
            for (int mode = 0; mode < TAB_COUNT; mode ++)
                tabImg[mode] = theme->load(data[mode], "tab.xml");
        }
        updateAlpha();
    }
    mInstances++;

    add(mLabel);

    const Skin *const skin = tabImg[TAB_STANDARD];
    if (!skin)
        return;
    const int padding = skin->getPadding();

    mLabel->setPosition(padding, padding);
}
Exemplo n.º 11
0
TabbedArea::TabbedArea(bool hide) :
    Container(),
    mHideWhenOneTab(hide),
    mSelectedTab(NULL)
{
    setFocusable(false);
    addKeyListener(this);
    addMouseListener(this);

    mTabContainer = new Container();
    mTabContainer->setOpaque(false);
    mWidgetContainer = new Container();
    mWidgetContainer->setOpaque(false);

    add(mTabContainer);
    add(mWidgetContainer);

    mProtFocusListener = new ProtectedFocusListener();

    addFocusListener(mProtFocusListener);

    mProtFocusListener->blockKey(SDLK_LEFT);
    mProtFocusListener->blockKey(SDLK_RIGHT);
    mProtFocusListener->blockKey(SDLK_UP);
    mProtFocusListener->blockKey(SDLK_DOWN);
}
Exemplo n.º 12
0
FFScrollArea::FFScrollArea()
{
    setScrollPolicy(ShowNever,
                    ShowNever);
    addKeyListener(this);
    setFocusable(false);
    setFrameSize(0);
}
Exemplo n.º 13
0
 CheckBox::CheckBox()
 {
     setMarked(false);
     
     setFocusable(true);
     addMouseListener(this);
     addKeyListener(this);
 }
Exemplo n.º 14
0
Menu::Menu(Layer& layer):
  Widget(layer),
  m_selection(NO_ITEM)
{
  setDraggable(true);
  setFocusable(true);
  hide();
}
Exemplo n.º 15
0
    RadioButton::RadioButton()
    {
        setSelected(false);

        setFocusable(true);
        addMouseListener(this);
        addKeyListener(this);
    }
Exemplo n.º 16
0
    MultiSelector::MultiSelector()
        : mCurrentSelection(0),
        mFrameCounter(0)
    {
        setFocusable(true);
        mSelectorImage = gcn::Image::load(ResourceHandler::getInstance()->getRealFilename("menu-selector.bmp"));

        addKeyListener(this);
    }
Exemplo n.º 17
0
TSpriteIcon::TSpriteIcon(TSprite *tsp) :
    sprite_(tsp)
{
    setFrameSize(1);
    setFocusable(0);
    setVisible(1);
    updateImage();
    adjustSize();
}
Exemplo n.º 18
0
 ListBox::ListBox()
 {    
     mSelected = -1;
     mListModel = NULL;
     setWidth(100);
     setFocusable(true);
 
     addMouseListener(this);
     addKeyListener(this);
 }
	MessageBoxContainer::MessageBoxContainer( Frame* frame, MessageBox* msg )
		: m_frame(frame),m_msg(msg)
	{
		add(m_frame);
		setMargins(0,0,0,0);
		m_frame->setResizable(false);
		m_frame->setMovable(false);
		setVisibility(false);
		setFocusable(false);
	}
Exemplo n.º 20
0
 ListBox::ListBox(ListModel *listModel)
 {
     mSelected = -1;
     setWidth(100);
     setListModel(listModel);
     setFocusable(true);
 
     addMouseListener(this);
     addKeyListener(this);
 }
Exemplo n.º 21
0
gcn::Panel::Panel(int initialSpaceX, int initialSpaceY)
: _coveredBy(NULL)
{
    _slotsx = -1;
    _slotsy = -1;
    _maxheight = 0;
    _spacingX = initialSpaceX;
    _spacingY = initialSpaceY;
    setFocusable(false);
    clear();
}
Exemplo n.º 22
0
    TextField::TextField():
        mEditable(true),
        mXScroll(0)
    {
        mText = new Text();

        setFocusable(true);

        addMouseListener(this);
        addKeyListener(this);
    }
Exemplo n.º 23
0
    ListBox::ListBox(ListModel *listModel)
        : mSelected(-1),
          mWrappingEnabled(false)
    {
        setWidth(100);
        setListModel(listModel);
        setFocusable(true);

        addMouseListener(this);
        addKeyListener(this);
    }
Exemplo n.º 24
0
BrowserBox::BrowserBox(unsigned int mode, bool opaque):
    gcn::Widget(),
    mMode(mode), mHighMode(UNDERLINE | BACKGROUND),
    mOpaque(opaque),
    mUseLinksAndUserColors(true),
    mSelectedLink(-1),
    mMaxRows(0)
{
    setFocusable(true);
    addMouseListener(this);
}
Exemplo n.º 25
0
ItemContainer::ItemContainer(Inventory *inventory,
                             const std::string &actionEventId,
                             gcn::ActionListener *listener):
    mInventory(inventory),
    mSelectedItemIndex(NO_ITEM),
    mLastSelectedItemId(NO_ITEM),
    mEquipSlotsFilter(NO_ITEM)
{
    if (!actionEventId.empty())
        setActionEventId(actionEventId);

    if (listener && !actionEventId.empty())
        addActionListener(listener);

    if (mInstances == 0)
    {
        mItemPopup = new ItemPopup();
        mItemPopup->setOpaque(false);

        mShowItemInfo = config.getValue("showItemPopups", true);
        mConfigListener = new ItemContainerConfigListener(this);
        config.addListener("showItemPopups", mConfigListener);

        mPopupMenu = new PopupMenu(TRADE);

        ResourceManager *resman = ResourceManager::getInstance();

        mSelImg = resman->getImage("graphics/gui/selection.png");

        if (!mSelImg)
            logger->error("Unable to load selection.png");
    }

    mProtFocusListener = new ProtectedFocusListener();

    mProtFocusListener->blockKey(SDLK_LEFT);
    mProtFocusListener->blockKey(SDLK_RIGHT);
    mProtFocusListener->blockKey(SDLK_UP);
    mProtFocusListener->blockKey(SDLK_DOWN);
    mProtFocusListener->blockKey(SDLK_SPACE);
    mProtFocusListener->blockKey(SDLK_RETURN);

    mInstances++;

    mMaxItems = mInventory->getLastUsedSlot(); // Count from 0, usage from 2

    addFocusListener(mProtFocusListener);
    addFocusListener(this);
    addKeyListener(this);
    addMouseListener(this);
    addWidgetListener(this);

    setFocusable(true);
}
Exemplo n.º 26
0
    ListBox::ListBox(ListModel *listModel)
    {
        mSelected = -1;
        mWrappingKeyboardSelection = false;
        setWidth(100);
        setListModel(listModel);
        setFocusable(true);

        addMouseListener(this);
        addKeyListener(this);
    }
Exemplo n.º 27
0
    TextField::TextField():
        mEditable(true)
    {
        mCaretPosition = 0;
        mXScroll = 0;

        setFocusable(true);

        addMouseListener(this);
        addKeyListener(this);
    }
Exemplo n.º 28
0
    CheckBox::CheckBox(const std::string &caption, bool marked)
    {
        setCaption(caption);
        setMarked(marked);

        setFocusable(true);
        addMouseListener(this);
        addKeyListener(this);

        adjustSize();
    }
Exemplo n.º 29
0
    TextField::TextField()
    {
        mCaretPosition = 0;
        mXScroll = 0;
		mNumericMode = false;

        setFocusable(true);

        addMouseListener(this);
        addKeyListener(this);
    }
Exemplo n.º 30
0
void Popup::init()
{
  const float em = layer().drawer().currentEM();

  setDesiredSize(vec2(em * 10.f, em * 2.f));

  m_menu = new Menu(layer());
  m_menu->itemSelectedSignal().connect(*this, &Popup::onItemSelected);
  m_menu->destroyedSignal().connect(*this, &Popup::onMenuDestroyed);

  setFocusable(true);
}