Click here to Skip to main content
15,897,149 members
Articles / Desktop Programming / MFC

A 2D data visualisation class

Rate me:
Please Sign up or sign in to vote.
4.54/5 (34 votes)
20 Mar 2000 316.4K   17.6K   175  
A comprehensive set of classes for displaying 2 dimensional data
/*
This file was created by Paul Barvinko (pbarvinko@yahoo.com).
This file is distributed "as is", e.g. there are no warranties 
and obligations and you could use it in your applications on your
own risk. 
Your comments and questions are welcome.
If using in your applications, please mention author in credits for your app.
*/
#include "stdafx.h"
#include "graph_general.h"
#include "graphwnd.h"

CGraphWnd* CGraphBaseClass::get_main_graph_window()
{
    CWnd* wnd = dynamic_cast<CWnd*>(this);
    CGraphWnd* res_wnd = dynamic_cast<CGraphWnd*>(wnd);
    while(res_wnd == NULL)
    {
	wnd = wnd->GetOwner();
	res_wnd = dynamic_cast<CGraphWnd*>(wnd);
    };
    return res_wnd;
}

void CGraphBaseClass::EnumerateParentWindows(BaseClassWndCallbackFunc enum_func, void* user_data)
{
    CWnd* wnd = dynamic_cast<CWnd*>(this);
    do
    {
	CGraphBaseClass* res_wnd = dynamic_cast<CGraphBaseClass*>(wnd);
	if (res_wnd != NULL)
	{
	    if ((*enum_func)(res_wnd, user_data) != 0)
	    {
		break;
	    };
	};
	wnd = wnd->GetOwner();
    } while(wnd != NULL);

}

int AppendMenuForAllParents(CGraphBaseClass* base_class, void* param)
{
    CMenu* menu = reinterpret_cast<CMenu*>(param);
    base_class->AppendMenuItems(menu);
    return 0;
}

int OnRBMenuCommandForAllParents(CGraphBaseClass* base_class, void* param)
{
    UINT command_id = reinterpret_cast<UINT>(param);
    base_class->OnRBMenuCommand(command_id);
    return 0;
}

int AppendPropertyPageForAllParents(CGraphBaseClass* base_class, void* param)
{
    CPropertySheet* prop_sheet = reinterpret_cast<CPropertySheet*>(param);
    base_class->AppendPropertyPage(prop_sheet);
    return 0;
}

int ReleasePropertyPageForAllParents(CGraphBaseClass* base_class, void* param)
{
    UINT res_status = reinterpret_cast<UINT>(param);
    base_class->ReleasePropertyPage(res_status);
    return 0;
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions