Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

wndctrl.h

00001 // $Id: wndctrl.h,v 1.1.1.1 2003/06/24 15:33:15 sjcomp Exp $
00002 // Copyright (c) 2003, Alexander Shyrokov aka SJ
00003 // E-mail: sjcomp[@]users.sourceforge.com
00004 // Web:    http://sjgui.sourceforge.net
00005 //
00006 // This code is under BSD license agreement.
00007 //
00008 // Alexander Shyrokov makes no representations about the suitability of this software 
00009 // for any purpose. It is provided "AS IS" without express or implied warranty.
00010 
00011 #if !defined(SJWNDCTRL_H_INCLUDED)
00012 #define SJWNDCTRL_H_INCLUDED
00013 
00014 #include "globals.h"
00015 
00016 namespace sjgui{
00017 
00018     namespace SJGUI_USE_STYLE
00019     {
00020         extern GLfloat def_wnd_ctrl_border_light_color[4]; 
00021         extern GLfloat def_wnd_ctrl_border_dark_color[4]; 
00022         extern GLfloat def_wnd_ctrl_shadow_color[4]; 
00023         extern GLfloat def_wnd_ctrl_bg_color[4]; 
00024         extern GLfloat def_wnd_ctrl_bg_sel_color[4]; 
00025     }
00026 
00027     #define COPY_COL(x,y,z) memcpy(x,y,sizeof(GLfloat)*z)
00028 
00037     class CWndCtrlBase : public CWnd
00038     {
00039         // Draw border flag
00040         bool        m_yDrawBorder;
00041     protected:
00042         GLfloat     m_ShadowColor[4]; 
00043         GLfloat     m_BgColor[4]; 
00044         GLfloat     m_BgSelColor[4]; 
00045         GLfloat     m_BorderLightColor[4]; 
00046         GLfloat     m_BorderDarkColor[4]; 
00047         int         m_iBorderSize; 
00048         virtual void OnUpdatePos()
00049         {
00050             CWnd::OnUpdatePos();
00051             // change client area
00052             m_ClAr.Deflate(m_iBorderSize);
00053         }
00054     public:
00055         CWndCtrlBase():CWnd()
00056         {
00057             SetBgColor(SJGUI_USE_STYLE::def_wnd_ctrl_bg_color);
00058             SetBgSelColor(SJGUI_USE_STYLE::def_wnd_ctrl_bg_sel_color);  
00059             SetShadowColor(SJGUI_USE_STYLE::def_wnd_ctrl_shadow_color);
00060             SetBorderLightColor(SJGUI_USE_STYLE::def_wnd_ctrl_border_light_color);
00061             SetBorderDarkColor(SJGUI_USE_STYLE::def_wnd_ctrl_border_dark_color);
00062             SetBorderSize(0);
00063             m_yDrawBorder=false;
00064         }
00066         void SetBorderSize(int i){assert(i>=0);m_iBorderSize=i;}
00068         int GetBorderSize(){return m_iBorderSize;}
00070         GLfloat* GetBgSelColor(){return m_BgSelColor;};
00072         GLfloat* GetBgColor(){return m_BgColor;};
00074         GLfloat* GetShadowColor(){return m_ShadowColor;};
00076         void SetShadowColor(GLfloat* pC){COPY_COL(m_ShadowColor,pC,4);};
00078         void SetBgColor(GLfloat R,GLfloat G,GLfloat B,GLfloat A=1.0f){m_BgColor[0]=R;m_BgColor[1]=G;m_BgColor[2]=B;m_BgColor[3]=A;};
00080         void SetBgColor(GLfloat* pC){COPY_COL(m_BgColor,pC,4);};
00082         void SetBgSelColor(GLfloat R,GLfloat G,GLfloat B,GLfloat A=1.0f){m_BgSelColor[0]=R;m_BgSelColor[1]=G;m_BgSelColor[2]=B;m_BgSelColor[3]=A;};
00084         void SetBgSelColor(GLfloat* pC){COPY_COL(m_BgSelColor,pC,4);};
00086         void DrawBorder(bool b=true){m_yDrawBorder=b;};
00088         bool IsDrawBorder(){return m_yDrawBorder;};
00090         void SetBorderLightColor(GLfloat* pC){memcpy(m_BorderLightColor,pC,sizeof(GLfloat)*4);}
00092         void SetBorderDarkColor(GLfloat* pC){memcpy(m_BorderDarkColor,pC,sizeof(GLfloat)*4);}
00093     };
00094 
00095     #undef COPY_COL
00096 
00097 } // namespace sjgui
00098 
00099 #endif // !defined(SJWNDCTRL_H_INCLUDED)
sjgui logo
Quick Links:

 News
 Description
 Screen Shots
 Projects
 Downloads
 Source Code
 Help/FAQ
 Want to help?
 Credits
 Disclaimer


Documentation:

 Documentation
 Reference
 Lessons


Useful links:

sjcomp logo
sjcomp

opengl logo

nehe logo

SourceForge.net Logo

Last modified:


Started by Alexander Shyrokov. Generated at Wed Apr 28 12:31:05 2004 for the sjgui by doxygen 1.3.1. SourceForge.net Logo