dropdown_helper.h

Go to the documentation of this file.
00001 #ifndef _DROPDOWN_HELPER_H_
00002 #define _DROPDOWN_HELPER_H_
00003 
00004 
00005 class cfg_dropdown_history
00006 {
00007         enum {separator = '\n'};
00008         cfg_string data;
00009         unsigned max;
00010         void build_list(pfc::ptr_list_t<char> & out);
00011         void parse_list(const pfc::ptr_list_t<char> & src);
00012 public:
00013         cfg_dropdown_history(const GUID & p_guid,unsigned p_max = 10,const char * init_vals = "") : data(p_guid,init_vals) {max = p_max;}
00014         void setup_dropdown(HWND wnd);
00015         void setup_dropdown(HWND wnd,UINT id) {setup_dropdown(GetDlgItem(wnd,id));}
00016         void add_item(const char * item);
00017         bool is_empty();
00018         void on_context(HWND wnd,LPARAM coords);
00019 };
00020 
00021 // ATL-compatible message map entry macro for installing dropdown list context menus.
00022 #define DROPDOWN_HISTORY_HANDLER(ctrlID,var) \
00023         if(uMsg == WM_CONTEXTMENU) { \
00024                 const HWND source = (HWND) wParam; \
00025                 if (source != NULL && source == GetDlgItem(ctrlID)) { \
00026                         var.on_context(source,lParam);  \
00027                         lResult = 0;    \
00028                         return TRUE;    \
00029                 }       \
00030         }
00031 
00032 #endif //_DROPDOWN_HELPER_H_

Generated on Fri Apr 25 18:49:33 2008 for foobar2000 SDK by  doxygen 1.5.5