aswang
1.0
|
00001 /* 00002 Copyright 2003 Joseph Alvis 00003 00004 This file is part of Aswang. 00005 00006 Aswang is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU Lesser General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 Aswang is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public License 00017 along with Aswang. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #pragma once 00021 #include "window.h" 00022 00023 namespace aswang { 00024 class Dialog : public window { 00025 public: 00026 typedef std::map<unsigned long,window *> childMap_type; 00027 private: 00028 unsigned long tid; 00029 bool modeless; 00030 protected: 00031 childMap_type childMap; 00032 public: 00033 Dialog(unsigned long templateID=0,bool isModeless=true) : window((window *)NULL),tid(templateID),modeless(isModeless) {} 00034 Dialog(window *p,unsigned long templateID=0,bool isModeless=true) : window(p),tid(templateID),modeless(isModeless) {} 00035 virtual ~Dialog() {} 00036 00037 virtual void Create(int x,int y,int width,int height); 00038 virtual void Create(); 00039 virtual const _TCHAR *GetClassName() const {return TEXT("Dialog");} 00040 00041 virtual LRESULT OnFail(UINT msg,WPARAM wParam,LPARAM lParam); 00042 virtual LRESULT OnClose(); 00043 virtual LRESULT OnInitDialog(HWND win,unsigned long param); 00044 00045 HWND GetItem(unsigned long id); 00046 AswangStr GetItemText(unsigned long id,unsigned long maxLength=1024); 00047 void SetItemText(unsigned long id,AswangStr txt); 00048 LRESULT SendItemMessage(unsigned long id,unsigned long message,WPARAM wParam,LPARAM lParam); 00049 void bind(window *childWindow,unsigned long id) { 00050 childWindow->SetParent(this); 00051 childMap[id] = childWindow; 00052 } 00053 00054 HWND operator [] (unsigned long id); 00055 00056 static int Loop(); 00057 static bool DispatchDialogMessage(MSG &msg); 00058 }; 00059 }