00001
00036 #ifndef INC_MGUI_FORM_GOOGLESEARCH_H
00037 #define INC_MGUI_FORM_GOOGLESEARCH_H
00038
00039 #ifndef INC_MGUI_COMBOBOX_H
00040 #include <mgui/combobox.h>
00041 #endif
00042
00043 #ifndef INC_MGUI_EDIT_H
00044 #include <mgui/edit.h>
00045 #endif
00046
00047 #ifndef INC_MGUI_FORMLIST_H
00048 #include <mgui/formlist.h>
00049 #endif
00050
00051 #ifndef INC_MGUI_FORMTABBED_H
00052 #include <mgui/formtabbed.h>
00053 #endif
00054
00055 #ifndef INC_MGUI_TOOLTIP_H
00056 #include <mgui/tooltip.h>
00057 #endif
00058
00059 #ifndef INC_MGUI_TIMER_H
00060 #include <mgui/timer.h>
00061 #endif
00062
00063 #ifndef INC_MI32_MITHREAD_H
00064 #include <mi32/mithread.h>
00065 #endif
00066
00067 #ifndef INC_MI32_CRITSEC_H
00068 #include <mi32/critsec.h>
00069 #endif
00070
00071 #ifndef INC_MGUI_FORMEXTENTS_H
00072 #include <mgui/formextents.h>
00073 #endif
00074
00075 #ifndef INC_MGUI_FORMRADIOBUTTONS_H
00076 #include <mgui/formradiobuttons.h>
00077 #endif
00078
00079 #ifndef INC_MGUI_GRID_H
00080 #include <mgui/grid.h>
00081 #endif
00082
00083 #ifndef INC_MGUI_DLGSHELL_H
00084 #include <mgui/dlgshell.h>
00085 #endif
00086
00087 #ifndef INC_SOA_GEONAMES_H
00088 #include <soa/geonames.h>
00089 #endif
00090
00091
00092
00093 #ifdef DEBUG_SEARCH
00094 #ifndef INC_MGUI_HTML_H
00095 #include <mgui/html.h>
00096 #endif
00097 #endif
00098
00099
00100 namespace MGUI {
00101
00102 class FORM_GOOGLESEARCH : public MGUI::FORM_COMPOSITE {
00103 public:
00104 typedef fastdelegate::FastDelegate<void(const MISTRING& name, const MISTRING& url)> DELEGATE_ONDOUBLECLICK;
00105
00106 FORM_GOOGLESEARCH ();
00107 virtual ~FORM_GOOGLESEARCH ();
00108
00110 ERRVALUE Create (
00111 MGUI::LAYOUT_PANE_BASE& ParentPane
00112 );
00113
00114 void SetDelegateOnDoubleClick(DELEGATE_ONDOUBLECLICK delegate) {m_delegate = delegate;}
00115
00116 private:
00117 #ifndef GENERATING_DOXYGEN_OUTPUT
00118
00119 int m_FieldStatus;
00120 int m_FieldName;
00121 int m_FieldURL;
00122 int m_FieldPath;
00123 int m_FieldDescription;
00124 int m_FieldAuthor;
00125 int m_FieldElements;
00126 int m_FieldExtents;
00127 int m_Offset;
00128 int m_PageText;
00129 int m_PagePlaces;
00130 int m_PageExtents;
00131 int m_PageElements;
00132 int m_PageResults;
00133 int m_FilteredResults;
00134
00135 #ifdef DEBUG_SEARCH
00136 MGUI::FORM_HTML m_formhtml;
00137 #endif
00138 MGUI::FORM_TABBED m_TabForm;
00139 MGUI::CTRL_EDIT_STRING m_SearchText;
00140 MGUI::CTRL_PUSHBUTTON m_SearchBtn;
00141 MGUI::CTRL_LABEL m_ResultsLabel;
00142 MGUI::CTRL_LABEL m_FilteredResultsLabel;
00143 MGUI::FORM_LIST m_URLList;
00144 MGUI::CTRL_PUSHBUTTON m_NextBtn;
00145 MGUI::CTRL_PUSHBUTTON m_PrevBtn;
00146 DELEGATE_ONDOUBLECLICK m_delegate;
00147
00148 class MyJob;
00149 MILIST<MyJob*> m_Jobs;
00150 MITHREAD::CRITICALSECTION m_JobSync;
00151 MITHREAD::POOL m_Pool;
00152 MITHREAD::QUEUE m_Queue;
00153 void OnJobDone (MITHREAD::ID id);
00154 bool m_StopJobs;
00155 class KMLData;
00156 MILIST<KMLData> m_KMLData;
00157 MGUI::TIMER m_timer;
00158
00159 bool OnDraw(MGUI::FORM_LIST::CUSTOMDRAW& draw);
00160 bool OnDoubleClick(int itemnum, int fieldnum, const MGUI::POINT& point, MGUI::POINTERBUTTON button, MGUI::KEYSTATE keystate);
00161 void OnPageActivate ();
00162 bool OnPointerButtonDown (int itemnum, int fieldnum, const MGUI::POINT& point, POINTERBUTTON button, KEYSTATE keystate);
00163 bool OnPointerButtonUp (int itemnum, int fieldnum, const MGUI::POINT& point, POINTERBUTTON button, KEYSTATE keystate);
00164 bool OnToolTip (int itemnum, int fieldnum, MGUI::CTRL_TOOLTIP& tooltip);
00165 void OnTimer ();
00166
00167
00168 MISTRING m_GoogleKey;
00169 SOA::GEONAMES m_Geonames;
00170 MILIST<SOA::GEONAMES::RECORD> m_GeonamesList;
00171 DPOINT2D m_GeonamesLocation;
00172 MGUI::FORM_RADIOBUTTONS m_GeonamesRadio;
00173 MGUI::CTRL_EDIT_STRING m_GeonamesText;
00174 MGUI::CTRL_PUSHBUTTON m_GeonamesButton;
00175 MGUI::CTRL_GRID m_GeonamesGrid;
00176 MGUI::CTRL_LABEL m_GeonamesResults;
00177 MGUI::FORM_EDIT_NUMBER m_BufferEditNumber;
00178 void OnGetGoogleKey();
00179 void OnSetBufferSize();
00180 void OnSearchGeonames();
00181 void OnSelectGrid(int row, int col);
00182 void SearchPaneSetSensitive();
00183
00184 class GOOGLEKEYSHELL : public MGUI::DLGSHELL {
00185 public:
00186 GOOGLEKEYSHELL ();
00187
00188 ~GOOGLEKEYSHELL ();
00189
00190 void GetKey(MISTRING& key) {key = m_Key.GetValue();}
00191
00192 private:
00193 MGUI::CTRL_LABEL m_Label;
00194 MGUI::CTRL_EDIT_STRING m_Key;
00195 MGUI::CTRL_PUSHBUTTON m_Button;
00196 void OnGetKey();
00197
00198 ERRVALUE v_CreateContent();
00199 };
00200
00201 GOOGLEKEYSHELL m_GoogleKeyShell;
00202
00203 MGUI::CTRL_TOGGLEBUTTON m_ExtentsToggle;
00204 MGUI::FORM_COMBOBOX m_ContainmentCombo;
00205 MGUI::CTRL_TOGGLEBUTTON m_NoGlobalExtentsToggle;
00206 MGUI::CTRL_LABEL m_ContainmentLabel;
00207 MGUI::FORM_EDIT_EXTENTS m_FormExtents;
00208 MGUI::FORM_RADIOBUTTONS m_MatchExtentsRadio;
00209
00210
00211 MGUI::CTRL_COMBOBOX m_ElementsCombo;
00212 MGUI::FORM_EDIT_NUMBER m_ElementsValue;
00213
00214 void Search();
00215 void NextSearch();
00216 void PrevSearch();
00217
00218 #endif // GENERATING_DOXYGEN_OUTPUT
00219 };
00220
00221 }
00222
00223 #endif