summaryrefslogtreecommitdiff
path: root/src/interface
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-12 15:20:43 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-12 15:20:43 (GMT)
commit760a721e0db37925c5d3b31760ae3ddb4fc1a657 (patch)
treeec5a30c2b79c4868a8e277478936661f4621944b /src/interface
parent5d3d1d4916cf6d126b54c8bbfb9ba67e27a2e789 (diff)
downloadpowder-760a721e0db37925c5d3b31760ae3ddb4fc1a657.zip
powder-760a721e0db37925c5d3b31760ae3ddb4fc1a657.tar.gz
Remove old unused textarea
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/Textarea.cpp80
-rw-r--r--src/interface/Textarea.h33
2 files changed, 0 insertions, 113 deletions
diff --git a/src/interface/Textarea.cpp b/src/interface/Textarea.cpp
deleted file mode 100644
index fecc390..0000000
--- a/src/interface/Textarea.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Textarea.cpp
- *
- * Created on: Jan 29, 2012
- * Author: Simon
- */
-
-#include <iostream>
-#include "Textarea.h"
-
-using namespace ui;
-
-Textarea::Textarea(Point position, Point size, std::string textboxText):
- Textbox(position, size, textboxText)
-{
- updateMultiline();
-}
-
-void Textarea::SetText(std::string text)
-{
- this->text = text;
- updateMultiline();
-}
-
-void Textarea::updateMultiline()
-{
- char * rawText = (char*)malloc(text.length()+1);
- memcpy(rawText, text.c_str(), text.length());
- rawText[text.length()] = 0;
-
- int currentWidth = 0;
- char * lastSpace = NULL;
- char * currentWord = rawText;
- char * nextSpace;
- while(true)
- {
- nextSpace = strchr(currentWord+1, ' ');
- if(nextSpace)
- nextSpace[0] = 0;
- int width = Graphics::textwidth(currentWord);
- if(width+currentWidth > Size.X-6)
- {
- currentWidth = width;
- currentWord[0] = '\n';
- }
- else
- currentWidth += width;
- if(nextSpace)
- nextSpace[0] = ' ';
- if(!(currentWord = strchr(currentWord+1, ' ')))
- break;
- }
- textLines = rawText;
-}
-
-void Textarea::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
-{
- Textbox::OnKeyPress(key, character, shift, ctrl, alt);
- updateMultiline();
-}
-
-void Textarea::Draw(const Point &screenPos)
-{
- Graphics * g = ui::Engine::Ref().g;
- if(IsFocused())
- {
- g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 255);
- g->drawtext(screenPos.X+3, screenPos.Y+3, textLines, 255, 255, 255, 255);
- }
- else
- {
- g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 160, 160, 160, 255);
- g->drawtext(screenPos.X+3, screenPos.Y+3, textLines, 160, 160, 160, 255);
- }
-}
-
-Textarea::~Textarea() {
- // TODO Auto-generated destructor stub
-}
-
diff --git a/src/interface/Textarea.h b/src/interface/Textarea.h
deleted file mode 100644
index c5529d6..0000000
--- a/src/interface/Textarea.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Textarea.h
- *
- * Created on: Jan 29, 2012
- * Author: Simon
- */
-
-#ifndef TEXTAREA_H_
-#define TEXTAREA_H_
-
-#include <vector>
-#include <string>
-#include <sstream>
-#include "Textbox.h"
-
-namespace ui
-{
-
-class Textarea: public ui::Textbox
-{
- void updateMultiline();
- std::string textLines;
-public:
- Textarea(Point position, Point size, std::string textboxText);
- virtual void TextPosition() {}
- virtual void SetText(std::string text);
- virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
- virtual void Draw(const Point& screenPos);
- virtual ~Textarea();
-};
-}
-
-#endif /* TEXTAREA_H_ */