Click here to Skip to main content
15,891,136 members
Articles / Programming Languages / C++

Multi-dialog management through client area sharing

,
Rate me:
Please Sign up or sign in to vote.
4.95/5 (30 votes)
30 Sep 2005CPOL10 min read 62.5K   1.7K   56  
An article on multi-dialog management through client area sharing.
// Created by: Mircea Puiu
// On: Sep, 2005
// 
// Classes:
//           CManagedObject		- for the contained managed object
//           CManageMore		- for the workspace management support
//           CMMQueryDlg		- for the "bring-in-view" interface

#if !defined(AFX_MANAGEMORE_H__INCLUDED_)
#define AFX_MANAGEMORE_H__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ManageMore.h : header file
//
#include <afxtempl.h>

#define WM_MM_BRING_IN_VIEW		WM_APP + 123	// Need to bring a managed dialog in view

/////////////////////////////////////////////////////////////////////////////
// CManagedObject

class CManagedObject
{
public:
	CManagedObject() { pManagedDlg = NULL; };
	~CManagedObject() {};
	CDialog *pManagedDlg;
	CString	strName;
};
/////////////////////////////////////////////////////////////////////////////
// CManageMore dialog

/////////////////////////////////////////////////////////////////////////////

class CManageMore: public CDialog
{
// Construction / destruction
public:
	CManageMore();
	virtual ~CManageMore();

// Attributes
public:
protected:
	CRect m_rcManagedArea;
	CDialog* m_pMainDlg;
	CList <CManagedObject, CManagedObject> m_listDialogs;

// Methods
public:
	POSITION GetManagedDialogPosition(char *chName);
	void SelectBringDialogInView();
	bool BringDialogInView(char *dialogname);
	void ScrollManagedArea(int deltaX, int deltaY);
	CDialog* GetManagedDialog(char *chName);
	CRect AddManagedDialog(CDialog *pDlg, char *chName, unsigned short idDlgResource, CPoint ptAt);
	void Destroy();
	void Create(CDialog *pMainDlg, CRect rcArea);

// Implementation
protected:
	afx_msg LRESULT OnBringInView(WPARAM, LPARAM lpDlgPos);
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////
// CMMQueryDlg dialog

#define MM_IDD_DIALOG_QUERY		9999
#define MM_IDC_COMBOBOX			9998

/////////////////////////////////////////////////////////////////////////////

class CMMQueryDlg : public CDialog
{
// Construction
public:
	CMMQueryDlg(CWnd* pParent = NULL);   // standard constructor

// Attributes
public:
	CString m_strPreselection;
	CString m_strSelection;
protected:
	CList <CString, CString> m_listDlgNames;

// Methods
public:
	void RemoveAllNames();
	void AddName(char *dlgname);

// Overrides
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation
protected:
	virtual BOOL OnInitDialog();
	afx_msg void OnSelchangeComboNames();
	DECLARE_MESSAGE_MAP()
};

// =============================================================================================

#endif // !defined(AFX_MANAGEMORE_H__INCLUDED_)

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)
Europe Europe
More than 30 years of software development experience.
(also playing the SCRUM Master role depending on the project)

Written By
Chief Technology Officer
United States United States
At this software thing longer than I care to mention. These days primarily a VC++ and SQL Server guy.

Comments and Discussions