00001 // This is core/vgui/vgui_tview_launcher_tableau.cxx 00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00003 #pragma implementation 00004 #endif 00005 //: 00006 // \file 00007 // \brief See vgui_tview_launcher.h for a description of this file. 00008 // \author Philip C. Pritchett, RRG, University of Oxford 00009 // \date 21 Oct 99 00010 // 00011 // \verbatim 00012 // Modifications 00013 // 04-OCT-2002 K.Y.McGaul - Sort out bug in vgui_event_condition. 00014 // - Launch tview in a dialog box instead of window. 00015 // \endverbatim 00016 00017 00018 #include "vgui_tview_launcher_tableau.h" 00019 #include <vcl_iostream.h> 00020 #include <vgui/vgui.h> 00021 #include <vgui/vgui_adaptor.h> 00022 #include <vgui/vgui_viewer2D_tableau.h> 00023 #include <vgui/vgui_tview_tableau.h> 00024 #include <vgui/vgui_dialog.h> 00025 00026 vgui_tview_launcher_tableau::vgui_tview_launcher_tableau() 00027 : c_graph(vgui_key('g'), vgui_SHIFT) { } 00028 00029 vcl_string vgui_tview_launcher_tableau::type_name() const 00030 { 00031 return "vgui_tview_launcher_tableau"; 00032 } 00033 00034 bool vgui_tview_launcher_tableau::handle(const vgui_event& e) 00035 { 00036 if (c_graph(e)) { 00037 go(e.origin); 00038 return true; 00039 } 00040 00041 if (e.type == vgui_DRAW || e.type == vgui_DRAW_OVERLAY) 00042 return true; 00043 00044 return false; 00045 } 00046 00047 static void launch(const void* t) 00048 { 00049 // a static_cast may not cast away const. 00050 void *Pv = const_cast<void*>(t); 00051 static_cast<vgui_tview_launcher_tableau*>(Pv)->go(vgui_adaptor::current); 00052 } 00053 00054 void vgui_tview_launcher_tableau::get_popup(const vgui_popup_params& /*params*/, vgui_menu &m) 00055 { 00056 m.add("View tableau hierarchy", launch, this); 00057 } 00058 00059 void vgui_tview_launcher_tableau::go(vgui_adaptor* a) 00060 { 00061 if (!a) { 00062 vcl_cerr << __FILE__ ": a = 0\n"; 00063 return; 00064 } 00065 vgui_tview_tableau_new tview(a->get_tableau()); 00066 vgui_viewer2D_tableau_new viewer(tview); 00067 00068 vgui_dialog tview_dialog("Tableau hierarchy"); 00069 tview_dialog.inline_tableau(viewer, 300,300); 00070 tview_dialog.set_ok_button("close"); 00071 tview_dialog.set_cancel_button(0); 00072 tview_dialog.ask(); 00073 this->post_redraw(); 00074 }
1.5.1