Click here to Skip to main content
15,885,216 members
Articles / Desktop Programming / MFC

The Diffraction Grating Calculator

Rate me:
Please Sign up or sign in to vote.
4.40/5 (5 votes)
30 Oct 2010GPL38 min read 41.3K   678   6  
An MFC Windows program related to Concave Diffraction Gratings using VTK libraries.
// Column selection

#ifndef GRIDCOLDEF_H
#define GRIDCOLDEF_H

class GridColDef
{
public:
	int nId;					   //column id
	LPTSTR lpzLabel;			//label	
	LPTSTR lpzDescription;	//description
	int nDefaultSize;			//default col size; if -1 auto size col
	int nCurSize;				//current col size; if 0 hide col otherwise use default size

   GridColDef() { nCurSize = -1; nDefaultSize = -1; };
	~GridColDef()
	{
      try
      {
         if ( lpzLabel == lpzDescription )
         {
            if(lpzLabel) delete [] lpzLabel;
         }
         else
         {
            if(lpzLabel) delete [] lpzLabel;
            if(lpzDescription) delete [] lpzDescription;
         }
      }
      catch (...) { /* do nothing */ }
	};
   static inline int GetWidthForGivenLabel(LPTSTR lpzLabel)
   {
      if ( !lpzLabel )
         return 60;
      int nLen = 5 * ((int) (_tcslen(lpzLabel)+1));
      if ( nLen >= 150 )
         return nLen+10;
      return 150;
   };
}; 

#endif /* ! defined (GRIDCOLDEF_H) */

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 GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
Italy Italy
Senior Software Developer in C/C++ and Oracle.
Ex-physicist holding a Ph.D. on x-ray lasers.

Comments and Discussions