|
/*
___ _ __ _ _ __ ____ __ _ _ ______ ____ __ _
| \| | / \ | \ | | / \ / __/ / \ | \ | |/_ _/| _ \ / \ | |
| _/| || <> || \| || | | | | || \| | | | | | | || || |
| | | || || || |\ || | | |___| || |\ | | | | |/ / | || |__
|_| |_||_|| ||_| |_| \__/ \___/ \__/ |_| |_| |_| |_|\_\ \__/ |____|
////////////////////////////////////////////////////////////////////////
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (c) 2002-2003 by Carlos Jim�nez de Parga
All rights reserved.
For any suggestion or failure report, please contact me by:
e-mail: cjimenez@servitel.es
///////////////////////////////////////////////////////////////////////
Version: 0.5
Module : Key.h
Purpose: Header definition for the CKey class
Created: CJP / 02-05-2003
History: CJP / 03-25-2003
*/
#if !defined(AFX_KEY_H__9605DF10_4F30_11D6_AA7A_00105A212DC5__INCLUDED_)
#define AFX_KEY_H__9605DF10_4F30_11D6_AA7A_00105A212DC5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Object.h"
const unsigned char NO_KEY = 0xff; // The 255 value means that no key was pressed
const int WHITE_KEY_UNITS_WIDTH = 4; // Width units of the white keys
const int WHITE_KEY_UNITS_HEIGHT = 16; // Height units of the white keys
const int BLACK_KEY_UNITS_WIDTH = 2; // Width units of the black keys
const int BLACK_KEY_UNITS_HEIGHT = 10; // Height units of the black keys
class CKey : public CObj
{
protected:
CDC *m_dc; // Pointer to the memory DC
unsigned char m_type; // Type of key
CRect m_CRect1,m_CRect2; // CRect objects to define the geometry of the key
COLORREF KeyBlackOnColor,KeyBlackOffColor,KeyWhiteOnColor,KeyWhiteOffColor; // Colors of the keys
public:
unsigned char m_note; // Value of the note
CKey(); // Constructor
virtual ~CKey(); // Destructor
void Initialize(CDC *dc,int px,int py,char type, int scale); // Initializes the key
void SetNote(unsigned char nNote); // Asigns the corresponding note to the key
unsigned char IsPressed(int x,int y); // Detects if the key is under the position x,y
void DrawasNormal(); // Draws the key as normal (not pressed)
void DrawOnClick(); // Draws the key as pressed
void Blit(int x,int y,CWnd *pWnd); // Blits the key in the window
void SetColors(COLORREF KeyBlackDownColor,COLORREF KeyBlackUpColor,COLORREF KeyWhiteDownColor,COLORREF KeyWhiteUpColor); // Sets the colors of the keys
};
#endif // !defined(AFX_KEY_H__9605DF10_4F30_11D6_AA7A_00105A212DC5__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.
I obtained my PhD degree in Computer Graphics at the National Distance Education University (UNED) in October 2019. I also hold a Ms. degree in Software Engineering and Computer Systems and a Bs. degree in Computer Science from the National Distance Education University (UNED).
I have been employed as a C++ software developer in several companies since year 2000.
I currently work as a Tutor-Professor of Symbolic Logic, Discrete Math and Java Object-Oriented Programming at UNED-Cartagena (Spain) since 2015.