Guidance
指路人
g.yi.org
software / RapidQ / System / Win32 / Rapid-Q++ / rqcombobox.h

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
#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();

    // Override height properties
    void  setHeight(int16 height) {}
    int16 getHeight() { return comboBoxHeight; }

    // ComboBox properties
    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();

    // ComboBox methods
    void  addItem(const char*);
    void  insertItem(const int, const char*);
    void  deleteItem(const int);
    void  clear();

    // ComboBox events
    void (*onChange)(RQComboBox&);
    void (*onDrawItem)(int index, int state, RECT rect, RQComboBox&);
};

#endif
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-3-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-08-20 12:34:40