📄 button.h
字号:
//****************************************************************
//This software may not be distributed further without permission from
// Sun Xueshi's Group
//
//This software is distributed WITHOUT ANY WARRANTY. No claims are made
// as to its functionality or purpose.
//
//Authors: 孙学诗
// Date: 12/4/03
//
//****************************************************************
#ifndef BUTTON_H
#define BUTTON_H
#include <string>
#include "bitmap.h"
using namespace std;
enum Status { Up, Down }; //button has two status---up and down
class Button {
friend class CalcObj; //class calcobj may use some data members of class button
public:
Button();
//Initialize parameters of button,
//UpFile and DownFile are two Bitmap file name of UpButton and Downbutton
void Initialize(SimpleWindow &CalcWindow, const string &UpFile, const string &DownFile,
const Position Posn);
void SetStatus(const Status &s); //Mutator: Reset button status
Status GetStatus() const; //Inspector: Get current button status
float GetHeight() const; //Inspector: Get height of button bitmap
float GetWidth() const; //Inspector: Get width of button bitmap
void Draw(); //Mutator: Draw button bitmap
void Flip(); //Mutator: Change button current status to the other
bool IsInside(const Position &MousePosition) const; //Inspector: If mouseclick if on the bitmap, return ture
private:
char ButtonValue; //Each button has a corresponding character value
BitMap UpButton; //Bitmap of Up-status button
BitMap DownButton; //Bitmap of down-status button
Status StatusShowing; //Show current button status
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -