00001 #ifndef OglGui_Cluster_h
00002 #define OglGui_Cluster_h
00003
00004 #ifndef OglGui_Window_h
00005 #include "OglGui/Window.h"
00006 #endif
00007
00008 #include "OglGui/SetImageInterface.h"
00009 #include "Link/OGL/WndRegion.h"
00010
00011 namespace OglGui {
00012
00013 class Cluster : public Window
00014 {
00015 public:
00016 Cluster(Window* wnd, int x, int y, int w, int h) :
00017 Window(wnd, x, y, w, h)
00018 {
00019 Init(w,h);
00020 }
00021
00022 void DetailImageInterface(SetImageInterface* si) { mDetailImageI = si; }
00023
00024
00025 void InitClusterViewers()
00026 {
00027 LIST* obj;
00028 OGLWND* oglWnd = GetOGLWND();
00029 OGLVIEW* view;
00030
00031 ForAllElements(obj, oglWnd->objectList)
00032 {
00033 view = (OGLVIEW*) obj->info;
00034 view->OnDrawView = RgnOnDrawView;
00035 }
00036 }
00037
00038 virtual void InitDisplayFunc()
00039 {
00040 Window::InitDisplayFunc();
00041 RegionInitDisplayFunc(GetOGLWND());
00042 }
00043
00044 virtual void DisplayFunc()
00045 {
00046 Window::DisplayFunc();
00047 RegionDisplayFunc(GetOGLWND());
00048 }
00049
00050 virtual void MouseFunc(int msg, int btn, int state, int x, int y)
00051 {
00052 if (msg==oglMouseDown && mDetailImageI)
00053 {
00054 OGLVIEW* oglView = viewSys.FindView(mOglWnd, x, y);
00055 mDetailImageI->SetImage(oglView ? oglView->im : NULL);
00056 }
00057 Window::MouseFunc(msg, btn, state, x, y);
00058 RegionMouseFunc(GetOGLWND(), msg, btn, state, x, y);
00059 }
00060
00061 virtual void KeyboardFunc(int c, int state)
00062 {
00063 Window::KeyboardFunc(c, state);
00064 RegionKeyboardFunc(GetOGLWND(), c, state);
00065 }
00066
00067 private:
00068 void Init(int w, int h)
00069 {
00070 mDetailImageI = 0;
00071 OGLWND* oglWnd = GetOGLWND();
00072 oglSys.AllowPicking(mOglWnd, 1, 1);
00073 oglSys.SetAllowCameraMove(oglWnd, true);
00074 }
00075
00076 SetImageInterface* mDetailImageI;
00077 };
00078
00079 };
00080 #endif OglGui_ClusterApp_h