Exemple #1
0
/********************************************************************************************

>	MsgResult TipsDlg::Message(Msg* pMessage)

	Author:		Colin_Barfoot (Xara Group Ltd) <*****@*****.**>
	Created:	03/08/96
	Purpose:	Dispatches messages to various other member functions beginning On...

********************************************************************************************/
MsgResult TipsDlg::Message(Msg* pMessage)
{
	if (IS_OUR_DIALOG_MSG(pMessage))
	{
		m_pCurrentMsg = (DialogMsg*)pMessage;
		
		switch (m_pCurrentMsg->DlgMsg)
		{
			case DIM_CREATE:
			{
				break;
			}

			case DIM_REDRAW:
			{	
				// Get the redraw information from the message
				ReDrawInfoType* pReDrawInfo = (ReDrawInfoType*) m_pCurrentMsg->DlgMsgParam;
				OnRedraw(pReDrawInfo);
				break;
			}

			case DIM_COMMIT:
				OnCommit();		// and fall through...

			case DIM_CANCEL:
				Close();		// Close and destroy the dialog 
				delete m_pTipTextGadget;
				End();			// WARNING: Destroys this!!!
				return (DLG_EAT_IF_HUNGRY((DialogMsg*)pMessage));	// End() destroyed m_...

			case DIM_LFT_BN_CLICKED:
				// A control on the dialog box has been clicked...
				switch (m_pCurrentMsg->GadgetID)
				{
					case _R(IDC_MORE):		// clicked on "Tell me more..."
						OnMoreHelp();
						return (DLG_EAT_IF_HUNGRY(m_pCurrentMsg));

					case _R(IDC_NEXTTIP):
						OnNextTip();
						break;
				}
				break; // DIM_LFT_BN_CLICKED		
		}
	}
	return OK;  
}  
Exemple #2
0
MsgResult RenderDemoDlg::Message(Msg* Message)
{
	// See if it is for us
	if (IS_OUR_DIALOG_MSG(Message))
	{
		// it is
		DialogMsg* Msg = (DialogMsg*)Message;

		// decide what to do
		switch (Msg->DlgMsg)
		{
			// Create message
			case DIM_CREATE :
				break;

			// Close and destroy the dialog 
			case DIM_COMMIT :
			case DIM_CANCEL :
			{
				Close();
				End();
				break;
			}

			case DIM_LFT_BN_CLICKED :
			{
				// See which button was pressed
				if (Msg->GadgetID == _R(IDC_REDRAWBTN))
				{
					// Toggle the colour
					ShowFirst = ShowFirst ? FALSE : TRUE;

					// invalidate the gadget with the picture in it
					InvalidateGadget(_R(IDC_REDRAW_ME));
				}
				break;
			}

			case DIM_REDRAW :
			{
				// This is where all the redrawing is done
				// Which control in the window is sending the redraw message (if there are many
				// grdraw controls you can tell which is which from the Gadget ID
				if (Msg->GadgetID == _R(IDC_REDRAW_ME))
				{
					// Draw the redraw_me control in here
					// Render this control
					RenderControl((ReDrawInfoType*) Msg->DlgMsgParam);
				}
				else
				// there are no other controls that should get a redraw message ever
				{
					// give out an error in debug builds, ignore in retail builds
					ERROR3("Got a redraw message for a control I don't know about");
					break;
				}

				break;
			}
			default:
				break;
		}
		
		// Return
		return (DLG_EAT_IF_HUNGRY(Msg));
	}

	return OK;  
}