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: eb67d83af177d72b5b84e92a0693e54b47aa9821 (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
#pragma once

#include <QtOpenGL/qgl.h>

#include "../map/drawer.hpp"

#include "../std/shared_ptr.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 our graphics library for drawing.
  template <class T> class GLDrawWidgetT : public BaseDrawWidget<T, QGLWidget>
  {
    typedef BaseDrawWidget<T, QGLWidget> base_type;

  protected:
    shared_ptr<T> m_p;

  public:
    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);
    //@}
  };
}