00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "pent_include.h"
00020 #include "TargetGump.h"
00021
00022 #include "GUIApp.h"
00023 #include "GumpNotifyProcess.h"
00024 #include "Item.h"
00025 #include "getObject.h"
00026
00027 #include "IDataSource.h"
00028 #include "ODataSource.h"
00029
00030 DEFINE_RUNTIME_CLASSTYPE_CODE(TargetGump,ModalGump);
00031
00032 TargetGump::TargetGump() : ModalGump(), target_tracing(false)
00033 {
00034
00035 }
00036
00037
00038 TargetGump::TargetGump(int x, int y)
00039 : ModalGump(x, y, 0, 0), target_tracing(false)
00040 {
00041
00042 }
00043
00044 TargetGump::~TargetGump()
00045 {
00046
00047 }
00048
00049 void TargetGump::PaintThis(RenderSurface* surf, sint32 lerp_factor, bool scaled)
00050 {
00051
00052 }
00053
00054 void TargetGump::InitGump(Gump* newparent, bool take_focus)
00055 {
00056 ModalGump::InitGump(newparent, take_focus);
00057
00058
00059 CreateNotifier();
00060
00061 GUIApp* guiapp = GUIApp::get_instance();
00062 guiapp->pushMouseCursor();
00063 guiapp->setMouseCursor(GUIApp::MOUSE_TARGET);
00064 }
00065
00066 void TargetGump::Close(bool no_del)
00067 {
00068 GUIApp* guiapp = GUIApp::get_instance();
00069 guiapp->popMouseCursor();
00070
00071 ModalGump::Close(no_del);
00072 }
00073
00074 bool TargetGump::PointOnGump(int mx, int my)
00075 {
00076
00077
00078 if (target_tracing) return false;
00079
00080 return ModalGump::PointOnGump(mx, my);
00081 }
00082
00083 void TargetGump::OnMouseUp(int button, int mx, int my)
00084 {
00085 target_tracing = true;
00086
00087 parent->GumpToScreenSpace(mx, my);
00088
00089 Gump* desktopgump = parent;
00090 ObjId objid = desktopgump->TraceObjId(mx, my);
00091 Item *item = getItem(objid);
00092
00093 if (item) {
00094
00095 pout << "Target result: ";
00096 item->dumpInfo();
00097
00098 process_result = objid;
00099 Close();
00100 }
00101
00102 target_tracing = false;
00103 }
00104
00105 uint32 TargetGump::I_target(const uint8* , unsigned int )
00106 {
00107 TargetGump* targetgump = new TargetGump(0, 0);
00108 targetgump->InitGump(0);
00109
00110 return targetgump->GetNotifyProcess()->getPid();
00111 }
00112
00113
00114
00115 void TargetGump::saveData(ODataSource* ods)
00116 {
00117 CANT_HAPPEN_MSG("Trying to save ModalGump");
00118 }
00119
00120 bool TargetGump::loadData(IDataSource* ids, uint32 versin)
00121 {
00122 CANT_HAPPEN_MSG("Trying to load ModalGump");
00123 return false;
00124 }