📄 wx_combo.h
字号:
#ifndef WX_COMBO_H#define WX_COMBO_H 1#include <string.h>#include <ctype.h>#include <string.h>#include <stdlib.h>#include <FL/x.H>#include <FL/fl_draw.H>#include <FL/Fl_Widget.H>#include <FL/Fl_Window.H>#include <FL/Fl_Input.H>#include <FL/Fl_Output.H>#include <FL/Fl_Int_Input.H>#include <FL/Fl_Multiline_Output.H>#include <FL/Fl_Secret_Input.H>#include <FL/Fl_Button.H>#include <FL/Fl_Return_Button.H>#include <FL/Fl_Check_Button.H>#include <FL/Fl_Toggle_Button.H>#include <Flek/Flve_Combo.H>/****************************************************************************************** Wx_Combo控件 ******************************************************************************************/#define flv_ctrl(x) ((x>='a' && x<='z'?x-('a'-'A'):x)|0x100)#define flv_alt(x) ((x>='a' && x<='z'?x-('a'-'A'):x)|0x200)#define flv_shift(x) ((x>='a' && x<='z'?x-('a'-'A'):x)|0x400)class Wx_Flvt_Input : public Fl_Input{public: Wx_Flvt_Input( int x, int y, int w, int h, const char *l=0 ) : Fl_Input(x,y,w,h,l) { type_ = 0; }; void type (int type) { type_ = type; } int type (void) { return type_; }protected: int handle(int event); int type_; void draw(void);};class Wx_Flv_Combo_Item{public: Wx_Flv_Combo_Item(); virtual ~Wx_Flv_Combo_Item(); const char *item(void); void item(const char *v); long value(void); void value(long v);protected: char *vitem; long vvalue;};class Wx_Flv_Combo_Items{public: Wx_Flv_Combo_Items(); ~Wx_Flv_Combo_Items(); int count(void) {return vcount; } void add( const char *item, long v=0L ); void insert( int index, const char *item, long v=0L ); void remove( int index ); void change( int i, const char *item, long v ); void change( int i, const char *item ); void change( int i, long v ); void sort(void); void clear(void); int index(void) {return vcurrent;}; void index(int i); int findi( const char *v ); // Find starting with v (-1 not found) int find( const char *v ); // Find text return index (-1 not found) int find( long v ); // Find value return index (-1 not found) Wx_Flv_Combo_Item *current(void); Wx_Flv_Combo_Item &operator[](int index);private: void make_room_for( int n ); Wx_Flv_Combo_Item **list; // Array of item pointers int vcount; // # of item pointers defined int vallocated; // # of item pointers allocated int vcurrent; // Current item index};class Wx_Flve_Combo : public Fl_Widget{public: Wx_Flve_Combo(int x, int y, int w, int h, const char *l ); ~Wx_Flve_Combo(); virtual void resize(int x, int y, int w, int h); void list_title(const char *v); void open_list(void); const char *value(); void value(const char *v); int display_rows() { return vdisplay_rows; }; void display_rows(int v); int drop_key(void) { return vdrop_key; } int drop_key( int v ) { return vdrop_key = v; } bool incremental_search(void) { return vincremental_search; } bool incremental_search(bool v) { return (vincremental_search=v); } bool list_only(void) { return vlist_only; } bool list_only(bool v); Wx_Flv_Combo_Items item; Fl_Window *list; Fl_Input *input; int type (void) { return type_; } void type (int type) { type_=type; } int htype (void) { return ((Wx_Flvt_Input *)input)->type(); } void htype (int type) { ((Wx_Flvt_Input *)input)->type(type); }protected: uchar type_; //added by wangxin 20020618 //type_=0 //type_=1 bool vincremental_search; bool vlist_only; int vdrop_key; char *vlist_title; int vdisplay_rows; int handle(int event); void draw(void);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -