| 1 |
maya |
3227 |
/*
|
| 2 |
|
|
* $Id: ComboBoxCtrl.h,v 1.4 2007-08-18 08:52:18 maya Exp $
|
| 3 |
|
|
*/
|
| 4 |
|
|
|
| 5 |
|
|
#ifndef _YCL_COMBOBOXCTRL_H_
|
| 6 |
|
|
#define _YCL_COMBOBOXCTRL_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 ComboBoxCtrl : virtual public Window {
|
| 17 |
|
|
public:
|
| 18 |
|
|
int limitText(int limit) {
|
| 19 |
|
|
return SendMessage(CB_LIMITTEXT, limit);
|
| 20 |
|
|
}
|
| 21 |
|
|
int getEditSel()const {
|
| 22 |
|
|
return SendMessage(CB_GETEDITSEL);
|
| 23 |
|
|
}
|
| 24 |
|
|
int setEditSel(int start, int end) {
|
| 25 |
|
|
return SendMessage(CB_SETEDITSEL, 0, MAKELPARAM(start, end));
|
| 26 |
|
|
}
|
| 27 |
|
|
int getCount()const {
|
| 28 |
|
|
return SendMessage(CB_GETCOUNT);
|
| 29 |
|
|
}
|
| 30 |
|
|
int resetContent() {
|
| 31 |
|
|
return SendMessage(CB_RESETCONTENT);
|
| 32 |
|
|
}
|
| 33 |
|
|
int addString(const char* string) {
|
| 34 |
|
|
return SendMessage(CB_ADDSTRING, 0, (LPARAM) string);
|
| 35 |
|
|
}
|
| 36 |
|
|
int addItemData(long data) {
|
| 37 |
|
|
return SendMessage(CB_ADDSTRING, 0, data);
|
| 38 |
|
|
}
|
| 39 |
|
|
int insertString(int index, const char* string) {
|
| 40 |
|
|
return SendMessage(CB_INSERTSTRING, index, (LPARAM) string);
|
| 41 |
|
|
}
|
| 42 |
|
|
int insertItemData(int index, long data) {
|
| 43 |
|
|
return SendMessage(CB_INSERTSTRING, index, data);
|
| 44 |
|
|
}
|
| 45 |
|
|
int deleteString(int index) {
|
| 46 |
|
|
return SendMessage(CB_DELETESTRING, index);
|
| 47 |
|
|
}
|
| 48 |
|
|
int getTextLen(int index)const {
|
| 49 |
|
|
return SendMessage(CB_GETLBTEXTLEN, index);
|
| 50 |
|
|
}
|
| 51 |
|
|
int getText(int index, char* buffer)const {
|
| 52 |
|
|
return SendMessage(CB_GETLBTEXT, index, (LPARAM) buffer);
|
| 53 |
|
|
}
|
| 54 |
|
|
String getText(int index) {
|
| 55 |
|
|
int length = getTextLen(index);
|
| 56 |
|
|
char* buffer = (char*) alloca(length + 1);
|
| 57 |
|
|
getText(index, buffer);
|
| 58 |
|
|
return buffer;
|
| 59 |
|
|
}
|
| 60 |
|
|
long getItemData(int index)const {
|
| 61 |
|
|
return SendMessage(CB_GETITEMDATA, index);
|
| 62 |
|
|
}
|
| 63 |
|
|
int setItemData(int index, long data) {
|
| 64 |
|
|
return SendMessage(CB_SETITEMDATA, index, data);
|
| 65 |
|
|
}
|
| 66 |
|
|
int findString(const char* string, int startIndex = -1)const {
|
| 67 |
|
|
return SendMessage(CB_FINDSTRING, startIndex, (LPARAM) string);
|
| 68 |
|
|
}
|
| 69 |
|
|
int findItemData(long data, int startIndex = -1)const {
|
| 70 |
|
|
return SendMessage(CB_FINDSTRING, startIndex, data);
|
| 71 |
|
|
}
|
| 72 |
|
|
int getCurSel()const {
|
| 73 |
|
|
return SendMessage(CB_GETCURSEL);
|
| 74 |
|
|
}
|
| 75 |
|
|
int setCurSel(int index) {
|
| 76 |
|
|
return SendMessage(CB_SETCURSEL, index);
|
| 77 |
|
|
}
|
| 78 |
|
|
int selectString(const char* string, int startIndex = -1) {
|
| 79 |
|
|
return SendMessage(CB_SELECTSTRING, startIndex, (LPARAM) string);
|
| 80 |
|
|
}
|
| 81 |
|
|
int selectItemData(long data, int startIndex = -1) {
|
| 82 |
|
|
return SendMessage(CB_SELECTSTRING, startIndex, data);
|
| 83 |
|
|
}
|
| 84 |
|
|
int dir(int attributes, const char* path) {
|
| 85 |
|
|
return SendMessage(CB_DIR, attributes, (LPARAM) path);
|
| 86 |
|
|
}
|
| 87 |
|
|
bool showDropdown(bool show) {
|
| 88 |
|
|
return SendMessage(CB_SHOWDROPDOWN, show) != FALSE;
|
| 89 |
|
|
}
|
| 90 |
|
|
int findStringExact(const char* string, int startIndex = -1)const {
|
| 91 |
|
|
return SendMessage(CB_FINDSTRINGEXACT, startIndex, (LPARAM) string);
|
| 92 |
|
|
}
|
| 93 |
|
|
int findItemDataExact(long data, int startIndex = -1)const {
|
| 94 |
|
|
return SendMessage(CB_FINDSTRINGEXACT, startIndex, data);
|
| 95 |
|
|
}
|
| 96 |
|
|
bool getDroppedState()const {
|
| 97 |
|
|
return SendMessage(CB_GETDROPPEDSTATE) != FALSE;
|
| 98 |
|
|
}
|
| 99 |
|
|
void getDroppedControlRect(RECT& rect)const {
|
| 100 |
|
|
SendMessage(CB_GETDROPPEDCONTROLRECT, 0, (LPARAM) &rect);
|
| 101 |
|
|
}
|
| 102 |
|
|
int getItemHeight()const {
|
| 103 |
|
|
return SendMessage(CB_GETITEMHEIGHT);
|
| 104 |
|
|
}
|
| 105 |
|
|
int setItemHeight(int index, int cy) {
|
| 106 |
|
|
return SendMessage(CB_SETITEMHEIGHT, index, cy);
|
| 107 |
|
|
}
|
| 108 |
|
|
int getExtendedUI()const {
|
| 109 |
|
|
return SendMessage(CB_GETEXTENDEDUI);
|
| 110 |
|
|
}
|
| 111 |
|
|
int setExtendedUI(int flags) {
|
| 112 |
|
|
return SendMessage(CB_SETEXTENDEDUI, flags);
|
| 113 |
|
|
}
|
| 114 |
|
|
int getTopIndex()const {
|
| 115 |
|
|
return SendMessage(CB_GETTOPINDEX);
|
| 116 |
|
|
}
|
| 117 |
|
|
int setTopIndex(int index) {
|
| 118 |
|
|
return SendMessage(CB_SETTOPINDEX, index);
|
| 119 |
|
|
}
|
| 120 |
|
|
int getHorizontalExtent()const {
|
| 121 |
|
|
return SendMessage(CB_GETHORIZONTALEXTENT);
|
| 122 |
|
|
}
|
| 123 |
|
|
void setHorizontalExtent(int cx) {
|
| 124 |
|
|
SendMessage(CB_SETHORIZONTALEXTENT, cx);
|
| 125 |
|
|
}
|
| 126 |
|
|
int getDroppedWidth()const {
|
| 127 |
|
|
return SendMessage(CB_GETDROPPEDWIDTH);
|
| 128 |
|
|
}
|
| 129 |
|
|
int setDroppedWidth(int cx) {
|
| 130 |
|
|
return SendMessage(CB_SETDROPPEDWIDTH, cx);
|
| 131 |
|
|
}
|
| 132 |
|
|
int initStorage(int count, long size) {
|
| 133 |
|
|
return SendMessage(CB_INITSTORAGE, count, size);
|
| 134 |
|
|
}
|
| 135 |
|
|
};
|
| 136 |
|
|
|
| 137 |
|
|
}
|
| 138 |
|
|
|
| 139 |
|
|
#endif//_YCL_COMBOBOXCTRL_H_
|