Open-Source-Software-Entwicklung und Downloads

Browse Subversion Repository

Contents of /trunk/TTProxy/YCL/include/YCL/EditBoxCtrl.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3227 - (show annotations) (download) (as text)
Tue Mar 24 15:10:33 2009 UTC (15 years, 1 month ago) by maya
File MIME type: text/x-chdr
File size: 4441 byte(s)
CVS から SVN へ移行: 改行コードを LF から CR+LF へ変換
1 /*
2 * $Id: EditBoxCtrl.h,v 1.4 2007-08-18 08:52:18 maya Exp $
3 */
4
5 #ifndef _YCL_EDITBOXCTRL_H_
6 #define _YCL_EDITBOXCTRL_H_
7
8 #if _MSC_VER >= 1000
9 #pragma once
10 #endif // _MSC_VER >= 1000
11
12 #include <YCL/Window.h>
13
14 namespace yebisuya {
15
16 class EditBoxCtrl : virtual public Window {
17 public:
18 void limitText(int limit) {
19 SendMessage(EM_LIMITTEXT, limit);
20 }
21 int getLineCount()const {
22 return SendMessage(EM_GETLINECOUNT);
23 }
24 int getLine(int line, char* buffer, int length)const {
25 *((int*) buffer) = length;
26 return SendMessage(EM_GETLINE, line, (LPARAM) buffer);
27 }
28 String getLine(int line)const {
29 int length = lineLength(line);
30 char* buffer = (char*) alloca(length + 1);
31 getLine(line, buffer, length + 1);
32 return buffer;
33 }
34 void getRect(RECT& rect)const {
35 SendMessage(EM_GETRECT, 0, (LPARAM) &rect);
36 }
37 void setRect(const RECT& rect) {
38 SendMessage(EM_SETRECT, 0, (LPARAM) &rect);
39 }
40 void setRectNoPaint(const RECT& rect) {
41 SendMessage(EM_SETRECTNP, 0, (LPARAM) &rect);
42 }
43 long getSel()const {
44 return SendMessage(EM_GETSEL);
45 }
46 bool getSel(int& start, int& end)const {
47 return SendMessage(EM_GETSEL, (WPARAM) &start, (LPARAM) &end) != -1;
48 }
49 void setSel(int start, int end) {
50 SendMessage(EM_SETSEL, start, end);
51 }
52 void replaceSel(const char* string) {
53 SendMessage(EM_REPLACESEL, 0, (LPARAM) string);
54 }
55 bool getModify()const {
56 return SendMessage(EM_GETMODIFY) != FALSE;
57 }
58 void setModify(bool modified) {
59 SendMessage(EM_SETMODIFY, modified);
60 }
61 bool scrollCaret() {
62 return SendMessage(EM_SCROLLCARET) != FALSE;
63 }
64 int lineFromChar(int index) {
65 return SendMessage(EM_LINEFROMCHAR, index);
66 }
67 int lineIndex(int line) {
68 return SendMessage(EM_LINEINDEX, line);
69 }
70 int lineLength(int line)const {
71 return SendMessage(EM_LINELENGTH, line);
72 }
73 void scroll(int cx, int cy) {
74 SendMessage(EM_LINESCROLL, cx, cy);
75 }
76 bool canUndo()const {
77 return SendMessage(EM_CANUNDO) != FALSE;
78 }
79 bool undo() {
80 return SendMessage(EM_UNDO) != FALSE;
81 }
82 void emptyUndoBuffer() {
83 SendMessage(EM_EMPTYUNDOBUFFER);
84 }
85 void setPasswordChar(int ch) {
86 SendMessage(EM_SETPASSWORDCHAR, ch);
87 }
88 void setTabStops(int count, const int tabs[]) {
89 SendMessage(EM_SETTABSTOPS, count, (LPARAM) tabs);
90 }
91 bool fmtLines(bool addEOL) {
92 return SendMessage(EM_FMTLINES, addEOL) != FALSE;
93 }
94 HLOCAL getHandle()const {
95 return (HLOCAL) SendMessage(EM_GETHANDLE);
96 }
97 void setHandle(HLOCAL buffer) {
98 SendMessage(EM_SETHANDLE, (WPARAM) buffer);
99 }
100 int getFirstVisibleLine()const {
101 return SendMessage(EM_GETFIRSTVISIBLELINE);
102 }
103 bool setReadOnly(bool readOnly) {
104 return SendMessage(EM_SETREADONLY, readOnly) != FALSE;
105 }
106 int getPasswordChar()const {
107 return (TCHAR) SendMessage(EM_GETPASSWORDCHAR);
108 }
109 void setWordBreakProc(EDITWORDBREAKPROC wordBreakProc) {
110 SendMessage(EM_SETWORDBREAKPROC, 0, (LPARAM) wordBreakProc);
111 }
112 EDITWORDBREAKPROC getWordBreakProc()const {
113 return (EDITWORDBREAKPROC) SendMessage(EM_GETWORDBREAKPROC);
114 }
115 void charFromPos(POINT point, int& charIndex, int& line)const {
116 long result = SendMessage(EM_CHARFROMPOS, 0, MAKELONG(point.x, point.y));
117 charIndex = LOWORD(result);
118 line = HIWORD(result);
119 }
120 void posFromChar(int charIndex, POINT& point)const {
121 long result = SendMessage(EM_POSFROMCHAR, charIndex);
122 point.x = LOWORD(result);
123 point.y = HIWORD(result);
124 }
125 bool lineScroll(int cx, int cy) {
126 return SendMessage(EM_LINESCROLL, cx, cy) != FALSE;
127 }
128 long getThumb()const {
129 return SendMessage(EM_GETTHUMB);
130 }
131 int getLimitText()const {
132 return SendMessage(EM_GETLIMITTEXT);
133 }
134 void setLimitText(int limit) {
135 SendMessage(EM_SETLIMITTEXT, limit);
136 }
137 void getMargins(int& leftMargin, int& rightMargin)const {
138 long result = SendMessage(EM_GETMARGINS);
139 leftMargin = LOWORD(result);
140 rightMargin = HIWORD(result);
141 }
142 void setMargins(int flags, int leftMargin, int rightMargin) {
143 SendMessage(EM_SETMARGINS, flags, MAKELONG(leftMargin, rightMargin));
144 }
145 #ifndef EM_GETIMESTATUS
146 #define EM_GETIMESTATUS 0x00D9
147 #endif
148 long getImeStatus(int type)const {
149 return SendMessage(EM_GETIMESTATUS, type);
150 }
151 #ifndef EM_SETIMESTATUS
152 #define EM_SETIMESTATUS 0x00D8
153 #endif
154 long setImeStatus(int type, long status) {
155 return SendMessage(EM_SETIMESTATUS, type, status);
156 }
157 };
158
159 }
160
161 #endif//_YCL_EDITBOXCTRL_H_

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26