00001 #ifndef __VISUALIZERFRAME_H 00002 #define __VISUALIZERFRAME_H 00003 00004 //#ifdef WIN32 00005 //#include "stdafx.h" 00006 //#endif 00007 00008 #include "wx/wxprec.h" 00009 #include "VisualizerNode.h" 00010 #include "VisualizerListener.h" 00011 #include <vector> 00012 00013 00014 #ifndef WX_PRECOMP 00015 #include "wx/wx.h" 00016 #endif 00017 00018 #ifdef __BORLANDC__ 00019 #pragma hdrstop 00020 #endif 00021 00022 #if !wxUSE_THREADS 00023 #error "This sample requires thread support!" 00024 #endif // wxUSE_THREADS 00025 00026 class PbVisualizerThread; 00027 00028 class VisualizerFrame: public wxFrame 00029 { 00030 public: 00031 VisualizerFrame(); 00032 virtual void OnPaint(wxPaintEvent&); 00033 void CloseMe(wxEvent&); 00034 static void* VisualizerThread(void*); 00035 void VisualizerThreadImpl(); 00036 void DrawStuff(wxDC* dc, int width, int height); 00037 void setUpdateTime(int milliseconds); 00038 void OnRefreshEvent(wxUpdateUIEvent&); 00039 void addMessage(VisualizerNodeMessage*); 00040 00041 private: 00042 void getInitialNeighborNodes(); 00043 void loadBitmaps(); 00044 void drawNodes(wxDC* dc); 00045 DECLARE_EVENT_TABLE() 00046 PbVisualizerThread* m_VisualizerThread; 00047 double startAngle; 00048 VisualizerListener m_listener; 00049 00050 vector<Node*> m_neighborNodes; 00051 00052 wxBitmap* m_pLogoGraphic; 00053 wxBitmap* m_pLegendGraphic; 00054 wxBitmap* m_pNormalNodeIcon; 00055 wxBitmap* m_pNoConnectionsNodeIcon; 00056 wxBitmap* m_pNattedNodeIcon; 00057 wxBitmap* m_pCensoredNodeIcon; 00058 00059 ThreadMessageQueue<VisualizerNodeMessage> m_nodeMessageQueue; 00060 00061 void calculateNodes(); 00062 }; 00063 00064 #endif