File: pgmultilineedit.h

package info (click to toggle)
asc 2.4.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 75,240 kB
  • sloc: cpp: 155,036; sh: 8,829; ansic: 6,890; makefile: 652; perl: 138
file content (83 lines) | stat: -rw-r--r-- 1,899 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

/** \file pgmultilineedit.h
	Header file for the PG_MultiLineEdit class.
*/

#ifndef PG_MULTI_LINE_EDIT
#define PG_MULTI_LINE_EDIT

#include "pglineedit.h"
#include "pgscrollbar.h"
#include "pgtheme.h"
#include "pgstring.h"

class DECLSPEC PG_MultiLineEdit : public PG_LineEdit {
public:

	PG_MultiLineEdit(PG_Widget* parent, const PG_Rect& r, const std::string& style="LineEdit", int maximumLength = 1000000);
	virtual void SetText(const std::string& new_text);

	void SetCursorPos(int p);

	void SetVPosition(int line);
   
   void InsertText(const std::string& c);

protected:

	void eventBlit(SDL_Surface* surface, const PG_Rect& src, const PG_Rect& dst);

	bool eventKeyDown(const SDL_KeyboardEvent* key);

	bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);

	bool eventMouseMotion(const SDL_MouseMotionEvent* motion);

	bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);

	virtual void InsertChar(const PG_Char& c);

	virtual void DeleteChar(Uint16 pos);

	bool handleScroll(PG_ScrollBar* widget, long data);

private:

	DLLLOCAL void FindWordRight();

	DLLLOCAL void FindWordLeft();

	DLLLOCAL void DeleteSelection();

	DLLLOCAL void GetCursorTextPosFromScreen(int x, int y, unsigned int& horzOffset, unsigned int& lineOffset);

	DLLLOCAL void GetCursorTextPos(unsigned int& horzOffset, unsigned int& lineOffset);

	DLLLOCAL void SetCursorTextPos(unsigned int offset, unsigned int line);

	DLLLOCAL int ConvertCursorPos(unsigned int offset, unsigned int line);

	DLLLOCAL void GetCursorPos(int& x, int& y);

	DLLLOCAL void DrawText(const PG_Rect& dst);

	DLLLOCAL void DrawTextCursor();

	DLLLOCAL void CreateTextVector(bool bSetupVScroll = true);

	DLLLOCAL void SetupVScroll();

	std::vector<PG_String> my_textdata;

	PG_ScrollBar* my_vscroll;

	int my_firstLine;

	int my_mark;

	bool my_isCursorAtEOL;

	bool my_allowHiddenCursor;
};

#endif // PG_MULTI_LINE_EDIT