예제 #1
0
  @Override
  protected void keyTyped(final char key, final int keyID) {
    // Did they press the escape key?
    if (keyID == Keyboard.KEY_ESCAPE) {
      // Close the screen.
      this.mc.thePlayer.closeScreen();
      return;
    }

    // Prevent only spaces
    if ((key == ' ') && (this.searchField.getText().length() == 0)) {
      return;
    }

    if (this.searchField.textboxKeyTyped(key, keyID)) {
      // Get the search query
      String newSearch = this.searchField.getText().trim().toLowerCase();

      // Has the query changed?
      if (!newSearch.equals(this.itemRepo.searchString)) {
        // Set the search string
        this.itemRepo.searchString = newSearch;

        // Repo needs update
        this.viewNeedsUpdate = true;
      }
    } else {
      super.keyTyped(key, keyID);
    }
  }
예제 #2
0
  @Override
  protected void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) {
    if (clickHandler_Widgets(mouseX, mouseY, mouseButton)) {
      return;
    }

    if (clickHandler_RegionDeposit(mouseX, mouseY)) {
      return;
    }

    if (clickHandler_SearchBox(mouseX, mouseY, mouseButton)) {
      return;
    }

    // Get search mode
    SearchBoxMode searchBoxMode =
        (SearchBoxMode) AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);

    // Inform search field of click if auto mode is not on
    if (!(searchBoxMode == SearchBoxMode.AUTOSEARCH
        || searchBoxMode == SearchBoxMode.NEI_AUTOSEARCH)) {
      this.searchField.mouseClicked(mouseX - this.guiLeft, mouseY - this.guiTop, mouseButton);
    }

    // Pass to super
    super.mouseClicked(mouseX, mouseY, mouseButton);
  }
예제 #3
0
  @Override
  protected void drawGuiContainerForegroundLayer(int cursorX, int cursorY) {
    super.drawGuiContainerForegroundLayer(cursorX, cursorY);

    this.fontRendererObj.drawString(this.guiTitle, TITLE_POS_X, TITLE_POS_Y, 0x000000);

    // Draw the search field.
    this.searchField.drawTextBox();

    // Enable lighting
    GL11.glEnable(GL11.GL_LIGHTING);

    // Draw the widgets and get which one the mouse is over
    WidgetAEItem widgetUnderMouse = this.drawItemWidgets(cursorX, cursorY);

    // Should we force a tooltip update?
    boolean forceTooltipUpdate =
        ((System.currentTimeMillis() - this.lastTooltipUpdateTime)
            >= WIDGET_TOOLTIP_UPDATE_INTERVAL);

    // Has the mouse moved, or timeout reached?
    if (forceTooltipUpdate
        || (this.previousMouseX != cursorX)
        || (this.previousMouseY != cursorY)) {
      // Do we have a widget under the mouse?
      if (widgetUnderMouse != null) {
        // Has the widget changed?
        if (forceTooltipUpdate || (widgetUnderMouse != this.previousWidgetUnderMouse)) {
          // Clear the tooltip
          this.tooltip.clear();

          // Get the tooltip from the widget
          widgetUnderMouse.getTooltip(this.tooltip);

          // Set the time
          this.lastTooltipUpdateTime = System.currentTimeMillis();
        }
      } else {
        // Clear the tooltip
        this.tooltip.clear();

        // Set the time
        this.lastTooltipUpdateTime = System.currentTimeMillis();

        // Get the tooltip from the buttons
        this.addTooltipFromButtons(cursorX, cursorY);
      }

      // Set the previous position
      this.previousMouseX = cursorX;
      this.previousMouseY = cursorY;

      // Set the previous widget
      this.previousWidgetUnderMouse = widgetUnderMouse;
    }

    // Draw the tooltip
    this.drawTooltip(cursorX - this.guiLeft, cursorY - this.guiTop, false);
  }