Go to the documentation of this file.00001
00002 #ifndef vgui_win32_dialog_impl_h_
00003 #define vgui_win32_dialog_impl_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <vgui/internals/vgui_dialog_impl.h>
00017 #include <vgui/impl/win32/vgui_win32_adaptor.h>
00018 #include <vgui/vgui_command.h>
00019
00020 #include <windows.h>
00021
00022 #define IDC_STATIC -1
00023 #define DLG_ID_START 0x8000
00024
00025 typedef struct tag_inline_tab_data
00026 {
00027 unsigned short childId;
00028 HWND hWnd;
00029 vgui_win32_adaptor *adaptor;
00030 } inline_tab_data;
00031
00032
00033 typedef struct tag_callback_control_data
00034 {
00035 unsigned short child_id;
00036 vgui_command_sptr cmnd;
00037 } callback_control_data;
00038
00039
00040 class vgui_win32_dialog_impl : public vgui_dialog_impl
00041 {
00042 public:
00043 vgui_win32_dialog_impl(const char*, HWND hWndParent = NULL);
00044 ~vgui_win32_dialog_impl();
00045
00046
00047
00048 void* pushbutton_field_widget(const char*, const void*);
00049 void* choice_field_widget(const char*, const vcl_vector<vcl_string>&, int&);
00050 void* inline_tableau_widget(const vgui_tableau_sptr tab, unsigned width, unsigned height);
00051 void modal(bool m) { is_modal = m; }
00052 bool ask();
00053 virtual void run();
00054
00055
00056
00057 void dialog_dispatcher(int item_id);
00058
00059
00060 virtual LRESULT DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
00061 virtual void OnOK();
00062 virtual void OnCancel();
00063 virtual BOOL OnBrowse(HWND hDlg, WORD wCtrlId);
00064 virtual BOOL OnColor(HWND hDlg, WORD wCtrlId, LPTSTR lpColor);
00065
00066
00067 int get_inline_tableau_size() { return inline_tableaus.size(); }
00068
00069
00070 vgui_win32_adaptor* get_current_tab() { return inline_tableaus.front().adaptor; }
00071
00072 protected:
00073 COLORREF ColorStringToRGB(LPTSTR lpColor);
00074
00075 bool ok_clicked;
00076 bool is_modal;
00077
00078 HWND hWndParent;
00079
00080 HWND hWnd;
00081
00082 private:
00083
00084 void FindDialogSize(int &width, int &height,
00085 int &max_length, int &fbsr_count,
00086 int cxChar, int cyChar, int width_sep, int height_sep,
00087 int button_length, int edit_length, int browser_length);
00088
00089
00090 void DrawImageOnButton(HDC hDC, RECT* lprcItem, HBITMAP hBitmap, unsigned w, unsigned h, BOOL isDisabled);
00091
00092
00093
00094 bool IsFileBrowserButton(unsigned short ctrl_id);
00095
00096
00097 bool IsColorChooserButton(unsigned short ctrl_id);
00098
00099
00100 bool IsCallbackControl(unsigned short ctrl_id);
00101
00102
00103 vgui_win32_adaptor* find_adaptor(unsigned short ctrl_id);
00104
00105
00106 vcl_vector<inline_tab_data> inline_tableaus;
00107
00108
00109
00110 vcl_vector<unsigned short> fb_ids, cc_ids;
00111
00112
00113 vcl_vector<callback_control_data> callback_controls;
00114 };
00115
00116
00117 #endif // vgui_win32_dialog_impl_h_