Welcome to mirror list, hosted at ThFree Co, Russian Federation.

widgets.hpp « qt_tstfrm - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5b331fd2f9d0645b05789ceef5c3c3446dffe6af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once

#include <QtGui/QWidget>

#include <QtOpenGL/qgl.h>

#include "../base/start_mem_debug.hpp"
#include "../std/shared_ptr.hpp"
#include "../yg/screen.hpp"
#include "../map/drawer_yg.hpp"

namespace qt
{
  template <class TScreen, class TBase> class BaseDrawWidget : public TBase
  {
    typedef TBase base_type;

  public:
    typedef TScreen screen_t;

    BaseDrawWidget(QWidget * pParent) : base_type(pParent)
    {
    }

  protected:
    /// Override this function to make drawing and additional resize processing.
    //@{
    virtual void DoDraw(shared_ptr<screen_t> p) = 0;
    virtual void DoResize(int w, int h) = 0;
    //@}
  };

  /// Widget uses yg for drawing.
  template <class T> class GLDrawWidgetT : public BaseDrawWidget<T, QGLWidget>
  {
    typedef BaseDrawWidget<T, QGLWidget> base_type;
  protected:

    shared_ptr<T> m_p;

  public:

    shared_ptr<T> GetDrawer() {return m_p;}

    GLDrawWidgetT(QWidget * pParent) : base_type(pParent){}
    virtual ~GLDrawWidgetT();

  protected:
    /// Overriden from QGLWidget.
    //@{
    virtual void initializeGL() = 0;
    virtual void paintGL();
    virtual void resizeGL(int w, int h);
    //@}
  };
}

#include "../base/stop_mem_debug.hpp"