Просмотр исходного кода

Fix indentation (replace tabs by spaces)

Marc Plano-Lesay 12 лет назад
Родитель
Сommit
25f09a4653
2 измененных файлов с 98 добавлено и 98 удалено
  1. 22 22
      gameplay/src/TextBox.cpp
  2. 76 76
      gameplay/src/TextBox.h

+ 22 - 22
gameplay/src/TextBox.cpp

@@ -37,7 +37,7 @@ void TextBox::initialize(Theme::Style* style, Properties* properties)
     GP_ASSERT(properties);
 
     Label::initialize(style, properties);
-	_inputMode = getInputMode(properties->getString("inputMode"));
+    _inputMode = getInputMode(properties->getString("inputMode"));
 }
 
 int TextBox::getLastKeypress()
@@ -159,7 +159,7 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
                 }
                 case Keyboard::KEY_LEFT_ARROW:
                 {
-					const std::string displayedText = getDisplayedText();
+                    const std::string displayedText = getDisplayedText();
                     Font* font = getFont(_state);
                     GP_ASSERT(font);
                     unsigned int fontSize = getFontSize(_state);
@@ -175,7 +175,7 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
                 }
                 case Keyboard::KEY_RIGHT_ARROW:
                 {
-					const std::string displayedText = getDisplayedText();
+                    const std::string displayedText = getDisplayedText();
                     Font* font = getFont(_state);
                     GP_ASSERT(font);
                     unsigned int fontSize = getFontSize(_state);
@@ -370,7 +370,7 @@ void TextBox::setCaretLocation(int x, int y)
     unsigned int fontSize = getFontSize(_state);
     Font::Justify textAlignment = getTextAlignment(_state);
     bool rightToLeft = getTextRightToLeft(_state);
-	const std::string displayedText = getDisplayedText();
+    const std::string displayedText = getDisplayedText();
 
     int index = font->getIndexAtLocation(displayedText.c_str(), _textBounds, fontSize, _caretLocation, &_caretLocation,
             textAlignment, true, rightToLeft);
@@ -428,22 +428,22 @@ const char* TextBox::getType() const
 
 void TextBox::setPasswordChar(char character)
 {
-	_passwordChar = character;
+    _passwordChar = character;
 }
 
 char TextBox::getPasswordChar() const
 {
-	return _passwordChar;
+    return _passwordChar;
 }
 
 void TextBox::setInputMode(InputMode inputMode)
 {
-	_inputMode = inputMode;
+    _inputMode = inputMode;
 }
 
 TextBox::InputMode TextBox::getInputMode() const
 {
-	return _inputMode;
+    return _inputMode;
 }
 
 void TextBox::drawText(const Rectangle& clip)
@@ -454,7 +454,7 @@ void TextBox::drawText(const Rectangle& clip)
     // Draw the text.
     if (_font)
     {
-		const std::string displayedText = getDisplayedText();
+        const std::string displayedText = getDisplayedText();
         _font->start();
         _font->drawText(displayedText.c_str(), _textBounds, _textColor, getFontSize(_state), getTextAlignment(_state), true, getTextRightToLeft(_state), &_viewportClipBounds);
         _font->finish();
@@ -487,19 +487,19 @@ TextBox::InputMode TextBox::getInputMode(const char* inputMode)
 
 std::string TextBox::getDisplayedText() const
 {
-	std::string displayedText;
-	switch (_inputMode) {
-		case PASSWORD:
-			displayedText.insert(0, _text.length(), _passwordChar);
-			break;
-
-		case TEXT:
-		default:
-			displayedText = _text;
-			break;
-	}
-
-	return displayedText;
+    std::string displayedText;
+    switch (_inputMode) {
+        case PASSWORD:
+            displayedText.insert(0, _text.length(), _passwordChar);
+            break;
+
+        case TEXT:
+        default:
+            displayedText = _text;
+            break;
+    }
+
+    return displayedText;
 }
 
 }

+ 76 - 76
gameplay/src/TextBox.h

@@ -40,20 +40,20 @@ class TextBox : public Label
 
 public:
 
-	/**
-	 * Input modes. Default is Text.
-	 */
-	enum InputMode {
-		/**
-		 * Text: Text is displayed directly.
-		 */
-		TEXT = 0x01,
-
-		/**
-		 * Password: Text is replaced by _passwordChar, which is '*' by default.
-		 */
-		PASSWORD = 0x02
-	};
+    /**
+     * Input modes. Default is Text.
+     */
+    enum InputMode {
+        /**
+         * Text: Text is displayed directly.
+         */
+        TEXT = 0x01,
+
+        /**
+         * Password: Text is replaced by _passwordChar, which is '*' by default.
+         */
+        PASSWORD = 0x02
+    };
 
     /**
      * Create a new text box control.
@@ -69,7 +69,7 @@ public:
     /**
      * Initialize this textbox.
      */
-	virtual void initialize(Theme::Style* style, Properties* properties);
+    virtual void initialize(Theme::Style* style, Properties* properties);
 
     /**
      * Add a listener to be notified of specific events affecting
@@ -95,33 +95,33 @@ public:
      */
     const char* getType() const;
 
-	/**
-	 * Set the character displayed in password mode.
-	 *
-	 * @param character Character to display in password mode.
-	 */
-	void setPasswordChar(char character);
-
-	/**
-	 * Get the character displayed in password mode.
-	 *
-	 * @return The character displayed in password mode.
-	 */
-	char getPasswordChar() const;
-
-	/**
-	 * Set the input mode.
-	 *
-	 * @param inputMode Input mode to set.
-	 */
-	void setInputMode(InputMode inputMode);
-
-	/**
-	 * Get the input mode.
-	 *
-	 * @return The input mode.
-	 */
-	InputMode getInputMode() const;
+    /**
+     * Set the character displayed in password mode.
+     *
+     * @param character Character to display in password mode.
+     */
+    void setPasswordChar(char character);
+
+    /**
+     * Get the character displayed in password mode.
+     *
+     * @return The character displayed in password mode.
+     */
+    char getPasswordChar() const;
+
+    /**
+     * Set the input mode.
+     *
+     * @param inputMode Input mode to set.
+     */
+    void setInputMode(InputMode inputMode);
+
+    /**
+     * Get the input mode.
+     *
+     * @return The input mode.
+     */
+    InputMode getInputMode() const;
 
 protected:
 
@@ -185,32 +185,32 @@ protected:
      *
      * @param spriteBatch The sprite batch containing this control's icons.
      * @param clip The clipping rectangle of this control's parent container.
-	 */
-	void drawImages(SpriteBatch* spriteBatch, const Rectangle& clip);
-
-	/**
-	 * Draw this textbox's text.
-	 *
-	 * @param clip The clipping rectangle of this textbox's
-	 * parent container.
-	 **/
-	virtual void drawText(const Rectangle& clip);
-
-	/**
-	 * Gets an InputMode by string.
-	 *
-	 * @param inputMode The string representation of the InputMode type.
-	 * @return The InputMode enum value corresponding to the given string.
-	 */
-	static InputMode getInputMode(const char* inputMode);
-
-	/**
-	 * Get the text which should be displayed, depending on
-	 * _inputMode.
-	 *
-	 * @return The text to be displayed.
-	 */
-	std::string getDisplayedText() const;
+     */
+    void drawImages(SpriteBatch* spriteBatch, const Rectangle& clip);
+
+    /**
+     * Draw this textbox's text.
+     *
+     * @param clip The clipping rectangle of this textbox's
+     * parent container.
+     */
+    virtual void drawText(const Rectangle& clip);
+
+    /**
+     * Gets an InputMode by string.
+     *
+     * @param inputMode The string representation of the InputMode type.
+     * @return The InputMode enum value corresponding to the given string.
+     */
+    static InputMode getInputMode(const char* inputMode);
+
+    /**
+     * Get the text which should be displayed, depending on
+     * _inputMode.
+     *
+     * @return The text to be displayed.
+     */
+    std::string getDisplayedText() const;
 
     /**
      * The current position of the TextBox's caret.
@@ -237,15 +237,15 @@ protected:
      */
     Theme::ThemeImage* _caretImage;
 
-	/**
-	 * The character displayed in password mode.
-	 */
-	char _passwordChar;
+    /**
+     * The character displayed in password mode.
+     */
+    char _passwordChar;
 
-	/**
-	 * The mode used to display the typed text.
-	 */
-	InputMode _inputMode;
+    /**
+     * The mode used to display the typed text.
+     */
+    InputMode _inputMode;
 
 private: