Click here to Skip to main content
15,895,746 members
Articles / Desktop Programming / MFC

PicZoom: A Photo Viewer Created in OpenGL

Rate me:
Please Sign up or sign in to vote.
4.86/5 (64 votes)
16 Feb 2011CPOL16 min read 161K   11.6K   151  
PicZoom: A Photo Viewer created in OpenGL
#include "GLWindowBase.h"
#pragma once

class GLVertexBuffer;
class GLTexture;
/*
This class handles all operations related to a Button.
The drawing and mouse message handling is handled in this class.
The resource ID of bitmap is provided to this class, and ID of Message
to send to parentWindow( PicZoomDlg) is also provide to this class.
Whenever user press the button, this class will send message to PicZoomDlg.
*/
class GLButton : public GLWindowBase
{
public:

    GLButton( HWND hParentWindow_i );
    virtual ~GLButton();
    virtual void SetRegion( const int nLeft_i, const int nTop_i,
                    const int nWidth_i, const int nHeight_i );
    virtual void SetImage( const int nResourceID_i );
    virtual bool SetupButton();
    virtual void SetLButtonMessage( const int nMessageToParent_i );
    virtual bool OnMouseMove( const int nX_i, const int nY_i, const int nFlags_i );
    virtual bool OnLButtonDown( const int nX_i, const int nY_i, const int nFlags_i );
    virtual bool OnLButtonUp( const int nX_i, const int nY_i, const int nFlags_i );
    virtual bool IsWithinRegion( const int nX_i, const int nY_i );
    void SetTransparency( const float fTransparency_i );
    virtual bool Draw();

protected:

    void UpdateVertexBuffer();

protected:

    CRect m_stRegionRect;
    int m_nMsgToParent;
    bool m_bMouseOver;
    int  m_nTextureWidth;
    int  m_ntextureHeight;
    GLVertexBuffer* m_pVertexBuffer;
    GLTexture*      m_pTexture;
    int  m_nResourceID;
    bool m_bACtionStart;
    float m_fTransparency;
    int m_nWidth;
    int m_nHeight;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions