Click here to Skip to main content
15,892,927 members
Articles / Desktop Programming / MFC

The SBJ MVC Framework - The Design View, Responding to Model Change

Rate me:
Please Sign up or sign in to vote.
4.87/5 (22 votes)
19 Mar 2009CPOL13 min read 81.2K   2.4K   51  
A Model-View-Controller Framework that integrates with the MFC Doc/View architecture.
#pragma once

/**
	Platform.h contains system wide #pragma settings and #defines. It should be the first 
	included file in the stdafx.h file of any SbjDev module.
*/

#pragma message("Including Platform.h")

// SBJ 07.11.17 Use XP controls
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")

#pragma warning (disable : 4290)	// C++ Exception Specification ignored
#pragma warning (disable : 4097)	// typedef-name used as synonym for class-name 
#pragma warning (disable:4800)		// forcing value to bool 'true' or 'false' (performance warning)
#pragma warning (disable:4505)		// unreferenced local function has been removed
#pragma warning (disable:4514)      // unreferenced inline function has been removed

#pragma warning(disable:4996)  // This function or variable may be unsafe. Consider using

// Lib and DLL naming /////////////////////////////////////////////////////////////////////////////////////////////


#ifdef _DEBUG
	#ifdef _UNICODE
		#define _CFG_SUFFIX "UD"
	#else
		#define _CFG_SUFFIX "D"
	#endif
#else
	#ifdef _UNICODE
		#define _CFG_SUFFIX "U"
	#else
		#ifdef _DEBUGGING
			#define _CFG_SUFFIX "RD"
		#else
			#define _CFG_SUFFIX ""
		#endif
	#endif
#endif

#define MAKE_LIBNAME(libName) _T(#libName)_T(_CFG_SUFFIX)_T(".lib")

#define MAKE_DLLNAME(dllName) _T(#dllName)_T(_CFG_SUFFIX)_T(".dll")

#define LIBLINK_MSG(libName) _T("Automatically linking with static library ")MAKE_LIBNAME(libName)

#define DLLLINK_MSG(libName) MAKE_DLLNAME(libName)_T(" automatically linking with import library ")MAKE_LIBNAME(libName)

// SBJ 07.04.10 The following handle new versioned DLLs and Implibs
#define COMMON_VERSION "2090"

#define MAKE_VERSIONED_LIBNAME(libName) _T(#libName)_T(COMMON_VERSION)_T(_CFG_SUFFIX)_T(".lib")

#define MAKE_VERSIONED_DLLNAME(dllName) _T(#dllName)_T(COMMON_VERSION)_T(_CFG_SUFFIX)_T(".dll")

#define MAKE_VERSIONED_DLLBASENAME(dllName) _T(#dllName)_T(COMMON_VERSION)

#define VERSIONED_DLLLINK_MSG(libName) MAKE_VERSIONED_DLLNAME(libName)_T(" automatically linking with import library ")MAKE_VERSIONED_LIBNAME(libName)

// Registered Windows message creation ////////////////////////////////////////////////////////////////

#define DECLARE_USER_MESSAGE(name, guid) \
     static const UINT name = ::RegisterWindowMessage(_T(#name)_T(#guid));

#define DECLARE_REGISTERED_MESSAGE(name, guid) \
	static const UINT name = ::RegisterWindowMessage(_T(#name)_T(#guid));
	
#define DECLARE_ID(name, guid) \
	static const UINT name = ::RegisterClipboardFormat(_T(#name)_T(#guid));


#define DECLARE_REGISTERED_CLIPFORMAT(name, guid) \
	static const CLIPFORMAT name = (CLIPFORMAT)::RegisterClipboardFormat(_T(#name)_T(#guid)); \
	static LPCTSTR STR_##name = _T(#name);



// determine number of elements in an array (not bytes) for MBCS & Unicode
#ifndef _countof
#define _countof(array) (sizeof(array)/sizeof(array[0]))
#endif
#ifndef ELEMENTS
#define ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
#endif

#define localNS  // use to identify anonymous namespace members

/*HTREEITEM is defined as typedef struct _TREEITEM* HTREEITEM; for typesafety.
In native C++, not having struct _TREEITEM define is not a problem, but in
managed C++ functions that return HTREEITEM (such as CTreeCtrl::InsertItem()) 
will throw TypeLoadException when the CLR is trying to resolve struct _TREEITEM*.
*/
struct _TREEITEM { _TREEITEM() {} };

#include <afxwin.h>         // MFC core and standard components

// COM ///////////////////////////
#include <comdef.h>

// STL Headers (alphabetical order)/////////////////////

#include <algorithm> 
#include <bitset> 
#include <cassert> 
#include <cctype> 
#include <cerrno> 
#include <cfloat> 
#include <ciso646> 
#include <climits> 
#include <clocale> 
#include <cmath> 
#include <complex> 
#include <csetjmp> 
#include <csignal> 
#include <cstdarg> 
#include <cstddef> 
#include <cstdio> 
#include <cstdlib> 
#include <cstring> 
#include <ctime> 
#include <cwchar> 
#include <cwctype> 
#include <deque> 
#include <exception> 
#include <fstream> 
#include <functional> 
#include <hash_map> 
#include <hash_set> 
#include <iomanip> 
#include <ios> 
#include <iosfwd> 
#include <iostream> 
#include <istream> 
#include <iterator> 
#include <limits> 
#include <list> 
#include <locale> 
#include <map> 
#include <memory> 
#include <new> 
#include <numeric> 
#include <ostream> 
#include <queue> 
#include <set> 
#include <sstream> 
#include <stack> 
#include <stdexcept> 
#include <streambuf> 
#include <string> 
#include <strstream> 
#include <utility> 
#include <vector> 

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
SBJ
United States United States
Real name is Steve Johnson. Programming since 1979. Started on a Heathkit Micro with a DEC LSI-11 and UCSD Pascal. Moved to PCs & DOS as soon as Turbo Pascal became available. Did some Assembly, ISR, TSR etc. All this while working for a Manufacturing Co. for 8 years. Had my own solo Co. doing barcode labeling software for 4 years (terrible business man, all I wanted to do was code). Since then working for various software companies. Moved to Windows around the time of 3.1 with Borland C then C++. Then on to VC++ and MFC, and just about anything I could get my hands on or had to learn for my job, and been at it ever since. Of course recently I've been playing with .NET, ASP, C#, WPF etc.

Comments and Discussions