Click here to Skip to main content
15,892,059 members
Articles / Mobile Apps

The StateWizard VC++ Add-in and Engine with Source Code

Rate me:
Please Sign up or sign in to vote.
4.73/5 (24 votes)
26 Mar 2009CPOL12 min read 190.6K   2.8K   132  
A cross-platform state-oriented application framework and a ClassWizard-like round-trip UML dynamic modeling/development tool that runs in popular IDEs. Aims at providing concurrent, distributed, and real-time application development tools for Win32/Linux
/**********************************************************************
UML StateWizard provides its software under the LGPL License and 
zlib/libpng License for open source projects.

Email us at info@intelliwizard.com for any information, suggestions and 
feature requestions.

Home Page: http://www.intelliwizard.com
*************************************************************************/

// StateChartDlg.cpp : implementation file
//

#include "stdafx.h"
#include "StateTree.h"
#include "StateChartDlg.h"
#include "resource.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#ifdef _DUMMY_DEBUG
#define new SME_DEBUG_NEW
#define delete SME_DEBUG_DELETE
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// StateChartDlg dialog


StateChartDlg::StateChartDlg(CWnd* pParent /*=NULL*/)
: CDialog(StateChartDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(StateChartDlg)
	// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void StateChartDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(StateChartDlg)
	// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(StateChartDlg, CDialog)
	//{{AFX_MSG_MAP(StateChartDlg)
	ON_WM_CREATE()
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_CLOSE_DLG, OnViewClose)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// StateChartDlg message handlers



int StateChartDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	// TODO: Add your specialized creation code here
	// graph create:
	CRect rcl(0,0,800,400);

	m_StateChartView.Create(NULL, "", WS_CHILD | WS_HSCROLL | WS_VSCROLL, rcl, this, NULL);
	m_StateChartView.m_pStateTree = m_pStateTree;
	m_StateChartView.ShowWindow(SW_SHOW);

	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	return 0;
}

void StateChartDlg::OnSize(UINT nType, int cx, int cy) 
{
	CRect rclClient; 

	GetClientRect(&rclClient);

	m_StateChartView.SetWindowPos(NULL, 0, 0, rclClient.Width(), rclClient.Height(), SWP_NOZORDER | SWP_NOACTIVATE);

	// Set to -1 means it is first time to initialize state view or it is set by left button click
	if (m_StateChartView.m_bSizeChange == -1)
		m_StateChartView.m_bSizeChange = 0;
	// Set to 1 means the window has been enlarged
	else if (m_StateChartView.m_bSizeChange == 0)
		m_StateChartView.m_bSizeChange = 1;

	CDialog::OnSize(nType, cx, cy);

	// TODO: Add your message handler code here

}

///////////////////////////////////////////////////////////////////////////////////////////
// DESCRIPTION: Initialize the AddApp(state) dialog
// INPUT: None
// OUTPUT: None
// Note: 
///////////////////////////////////////////////////////////////////////////////////////////
BOOL StateChartDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	// TODO: Add extra initialization here	
//.	SME_TRACE("Create draw state chart dialog!\n");

	m_hIcon = AfxGetApp()->LoadIcon(IDI_APP); 
	SetIcon(m_hIcon, FALSE); //small icon
//	SetIcon(NULL, TRUE);
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void StateChartDlg::OnDestroy() 
{
	m_StateChartView.DestroyWindow();
	CDialog::OnDestroy();

	if (m_hIcon) DestroyIcon(m_hIcon);
	// TODO: Add your message handler code here
//.	SME_TRACE("Destroy draw state chart dialog!\n");
//.	SME_ALLOC_MEM_SIZE();
}

LRESULT StateChartDlg::OnViewClose(WPARAM wParam, LPARAM lParam)
{
	OnCancel();
	return TRUE;
}

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
Software Developer (Senior)
United States United States
Alex "Question is more important than the answer."

Comments and Discussions