00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef XAP_Win32DialogHelper_H
00023 #define XAP_Win32DialogHelper_H
00024
00025
00026
00027 #ifdef _MSC_VER
00028 #pragma warning(disable: 4355)
00029 #endif
00030
00031 #include <commctrl.h>
00032
00033
00034
00035
00036 #if defined(__MINGW32__) && !defined(ListView_GetSelectionMark)
00037 #define LVM_GETSELECTIONMARK (LVM_FIRST+66)
00038 #define ListView_GetSelectionMark(w) (INT)SNDMSG((w),LVM_GETSELECTIONMARK,0,0)
00039 #endif
00040
00041
00042 #include "xap_Frame.h"
00043 #include "xap_Win32FrameImpl.h"
00044 #include "ut_Xpm2Bmp.h"
00045
00046 class ABI_EXPORT XAP_Win32Dialog
00047 {
00048 public:
00049 virtual BOOL _onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) = 0;
00050 virtual BOOL _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) = 0;
00051 virtual BOOL _onDeltaPos(NM_UPDOWN * pnmud) = 0;
00052 };
00053
00054 class ABI_EXPORT XAP_Win32DialogHelper
00055 {
00056 public:
00057 XAP_Win32DialogHelper(XAP_Win32Dialog* p_dialog)
00058 : m_pDialog(p_dialog),
00059 m_hDlg(0)
00060 {
00061 }
00062
00063
00064
00065
00066 XAP_Win32DialogHelper(HWND hDlg)
00067 : m_pDialog(0),
00068 m_hDlg(hDlg)
00069 {
00070 }
00071
00072
00073 public:
00074
00075 void runModal( XAP_Frame* pFrame,
00076 XAP_Dialog_Id dialog_id,
00077 UT_sint32 resource_id,
00078 XAP_Dialog* p_dialog);
00079
00080 void runModeless( XAP_Frame* pFrame,
00081 XAP_Dialog_Id dialog_id,
00082 UT_sint32 resource_id,
00083 XAP_Dialog_Modeless* p_dialog);
00084
00085 static BOOL CALLBACK s_dlgProc( HWND hWnd,
00086 UINT msg,
00087 WPARAM wParam,
00088 LPARAM lParam);
00089
00090 void checkButton(UT_sint32 controlId, bool bChecked = true);
00091 void enableControl(UT_sint32 controlId, bool bEnabled = true);
00092 void destroyWindow();
00093 void setDialogTitle(LPCSTR p_str);
00094 int showWindow( int Mode );
00095 int showControl(UT_sint32 controlId, int Mode);
00096 int bringWindowToTop();
00097
00098
00099
00100 int addItemToCombo(UT_sint32 controlId, LPCSTR p_str);
00101 void selectComboItem(UT_sint32 controlId, int index);
00102 int setComboDataItem(UT_sint32 controlId, int nIndex, DWORD dwData);
00103 int getComboDataItem(UT_sint32 controlId, int nIndex);
00104 int getComboSelectedIndex(UT_sint32 controlId) const;
00105 void resetComboContent(UT_sint32 controlId);
00106
00107
00108
00109 void resetContent(UT_sint32 controlId);
00110 int addItemToList(UT_sint32 controlId, LPCSTR p_str);
00111 int getListSelectedIndex(UT_sint32 controlId) const;
00112 int setListDataItem(UT_sint32 controlId, int nIndex, DWORD dwData);
00113 int getListDataItem(UT_sint32 controlId, int nIndex);
00114 void selectListItem(UT_sint32 controlId, int index);
00115 void getListText(UT_sint32 controlId, int index, char *p_str) const;
00116
00117
00118 void setControlText(UT_sint32 controlId, LPCSTR p_str);
00119 void setControlInt(UT_sint32 controlId, int value);
00120 int getControlInt(UT_sint32 controlId) const;
00121
00122 void selectControlText(UT_sint32 controlId,
00123 UT_sint32 start,
00124 UT_sint32 end);
00125
00126 int isChecked(UT_sint32 controlId) const;
00127 void getControlText( UT_sint32 controlId,
00128 LPSTR p_buffer,
00129 UT_sint32 Buffer_length) const;
00130
00131 bool isControlVisible(UT_sint32 controlId) const;
00132
00133 bool isParentFrame( XAP_Frame& frame) const;
00134 void setParentFrame(const XAP_Frame* pFrame);
00135 XAP_Frame* getParentFrame();
00136 void centerDialog();
00137 static void s_centerDialog(HWND hWnd);
00138 static HBITMAP s_loadBitmap(HWND hWnd, UINT nId,
00139 const char* pName,
00140 int width, int height,
00141 const UT_RGBColor & Color);
00142
00143 void setHandle(HWND hWnd){m_hDlg=hWnd;}
00144
00145 private:
00146 XAP_Win32Dialog * m_pDialog;
00147 HWND m_hDlg;
00148 };
00149
00150
00151 #endif