#if !defined RQCOMBOBOX_H
#define RQCOMBOBOX_H
#include <windows.h>
#include "rqfont.h"
#include "rqcanvas.h"
#include "rqcontrol.h"
#include "rqdefs.h"
typedef enum {csDropDown, csSimple, csDropDownList, csOwnerDrawFixed, csOwnerDrawVariable} COMBOBOXSTYLE;
class RQComboBox: public RQControl
{
private:
char *tempItem;
char **tempItems;
int tempItemsCount;
void freeTempItems();
void saveItems();
void loadItems();
protected:
HWND handle;
char *caption;
COMBOBOXSTYLE comboBoxStyle;
int dropDownCount;
int comboBoxHeight;
int itemIndex, itemHeight;
bool sorted;
void messageHandler(HWND, UINT, WPARAM, LPARAM);
void adjustComboBoxHeight();
HWND getHandle() { return handle; }
RQControl* getParent() { return parent; }
void recreateHandle();
public:
RQComboBox();
~RQComboBox();
void setHeight(int16 height) {}
int16 getHeight() { return comboBoxHeight; }
RQFont font;
RQCanvas canvas;
void setParent(RQControl&);
void setDropDownCount(int);
int getDropDownCount();
void setItemIndex(int itemIndex);
int getItemIndex();
void setStyle(COMBOBOXSTYLE);
COMBOBOXSTYLE getStyle();
int getItemCount();
void setItem(int index, const char*);
const char* getItem(int index);
void setItemHeight(int);
int getItemHeight();
void setSorted(bool);
bool getSorted();
void addItem(const char*);
void insertItem(const int, const char*);
void deleteItem(const int);
void clear();
void (*onChange)(RQComboBox&);
void (*onDrawItem)(int index, int state, RECT rect, RQComboBox&);
};
#endif
|