home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / h / vd2 / VDLib / UIProxies.h < prev   
Encoding:
C/C++ Source or Header  |  2009-09-14  |  3.0 KB  |  112 lines

  1. #ifndef f_VD2_VDLIB_UIPROXIES_H
  2. #define f_VD2_VDLIB_UIPROXIES_H
  3.  
  4. #include <vd2/system/event.h>
  5. #include <vd2/system/refcount.h>
  6. #include <vd2/system/vdstl.h>
  7. #include <vd2/system/VDString.h>
  8. #include <vd2/system/win32/miniwindows.h>
  9.  
  10. struct VDUIAccelerator;
  11.  
  12. class VDUIProxyControl : public vdlist_node {
  13. public:
  14.     VDUIProxyControl();
  15.  
  16.     VDZHWND GetHandle() const { return mhwnd; }
  17.  
  18.     virtual void Attach(VDZHWND hwnd);
  19.     virtual void Detach();
  20.  
  21.     virtual VDZLRESULT On_WM_COMMAND(VDZWPARAM wParam, VDZLPARAM lParam);
  22.     virtual VDZLRESULT On_WM_NOTIFY(VDZWPARAM wParam, VDZLPARAM lParam);
  23.  
  24. protected:
  25.     HWND    mhwnd;
  26. };
  27.  
  28. class VDUIProxyMessageDispatcherW32 {
  29. public:
  30.     void AddControl(VDUIProxyControl *control);
  31.     void RemoveControl(VDZHWND hwnd);
  32.     void RemoveAllControls();
  33.  
  34.     VDZLRESULT Dispatch_WM_COMMAND(VDZWPARAM wParam, VDZLPARAM lParam);
  35.     VDZLRESULT Dispatch_WM_NOTIFY(VDZWPARAM wParam, VDZLPARAM lParam);
  36.  
  37. protected:
  38.     size_t Hash(VDZHWND hwnd) const;
  39.     VDUIProxyControl *GetControl(VDZHWND hwnd);
  40.  
  41.     enum { kHashTableSize = 31 };
  42.  
  43.     typedef vdlist<VDUIProxyControl> HashChain;
  44.     HashChain mHashTable[kHashTableSize];
  45. };
  46.  
  47. class IVDUIListViewVirtualItem : public IVDRefCount {
  48. public:
  49.     virtual void GetText(int subItem, VDStringW& s) const = 0;
  50. };
  51.  
  52. class VDUIProxyListView : public VDUIProxyControl {
  53. public:
  54.     VDUIProxyListView();
  55.  
  56.     void AutoSizeColumns();
  57.     void Clear();
  58.     void DeleteItem(int index);
  59.     int GetColumnCount() const;
  60.     int GetItemCount() const;
  61.     int GetSelectedIndex() const;
  62.     void SetSelectedIndex(int index);
  63.     void SetFullRowSelectEnabled(bool enabled);
  64.     void EnsureItemVisible(int index);
  65.     int GetVisibleTopIndex();
  66.     void SetVisibleTopIndex(int index);
  67.     IVDUIListViewVirtualItem *GetVirtualItem(int index) const;
  68.     void InsertColumn(int index, const wchar_t *label, int width);
  69.     int InsertItem(int item, const wchar_t *text);
  70.     int InsertVirtualItem(int item, IVDUIListViewVirtualItem *lvvi);
  71.     void RefreshItem(int item);
  72.     void SetItemText(int item, int subitem, const wchar_t *text);
  73.  
  74.     VDEvent<VDUIProxyListView, int>& OnColumnClicked() {
  75.         return mEventColumnClicked;
  76.     }
  77.  
  78.     VDEvent<VDUIProxyListView, int>& OnItemSelectionChanged() {
  79.         return mEventItemSelectionChanged;
  80.     }
  81.  
  82. protected:
  83.     VDZLRESULT On_WM_NOTIFY(VDZWPARAM wParam, VDZLPARAM lParam);
  84.  
  85.     int            mNextTextIndex;
  86.     VDStringW    mTextW[3];
  87.     VDStringA    mTextA[3];
  88.  
  89.     VDEvent<VDUIProxyListView, int> mEventColumnClicked;
  90.     VDEvent<VDUIProxyListView, int> mEventItemSelectionChanged;
  91. };
  92.  
  93. class VDUIProxyHotKeyControl : public VDUIProxyControl {
  94. public:
  95.     VDUIProxyHotKeyControl();
  96.     ~VDUIProxyHotKeyControl();
  97.  
  98.     bool GetAccelerator(VDUIAccelerator& accel) const;
  99.     void SetAccelerator(const VDUIAccelerator& accel);
  100.  
  101.     VDEvent<VDUIProxyHotKeyControl, VDUIAccelerator>& OnEventHotKeyChanged() {
  102.         return mEventHotKeyChanged;
  103.     }
  104.  
  105. protected:
  106.     VDZLRESULT On_WM_COMMAND(VDZWPARAM wParam, VDZLPARAM lParam);
  107.  
  108.     VDEvent<VDUIProxyHotKeyControl, VDUIAccelerator> mEventHotKeyChanged;
  109. };
  110.  
  111. #endif
  112.