📄 mcheck.cpp
字号:
#include"\sunshine\include\mcheck.h"
#include"\sunshine\include\app.h"
#include<string.h>
MCheck::MCheck(int x,int y,char *topic,char *idname,int sta)
: MObj(x,y,Length(topic)+20,16,idname)
{
text=new char[strlen(topic)+1];
strcpy(text,topic);
CS=sta;
firstrun=1;
}
MCheck::~MCheck()
{
delete text;
}
void MCheck::UnFocus()
{
Mouse am(1);
setfillstyle(SOLID_FILL,LIGHTGRAY);
bar(x(),y(),x()+15,y()+15);
setcolor(WHITE);
line(x(),y(),x()+15,y());
line(x(),y(),x(),y()+15);
setcolor(DARKGRAY);
line(x()+15,y()+1,x()+15,y()+15);
line(x()+15,y()+15,x(),y()+15);
Write(text,x()+20,y(),BLACK);
}
void MCheck::GetFocus()
{
Mouse am(1);
if(CS) Checked();
else UnChecked();
}
void MCheck::Checked()
{
setcolor(BLUE);
line(x()+3,y()+h()-8,x()+3,y()+h()-3);
line(x()+4,y()+h()-7,x()+4,y()+h()-3);
line(x()+3,y()+h()-3,x()+13,y()+3);
}
void MCheck::UnChecked()
{
setfillstyle(SOLID_FILL,LIGHTGRAY);
bar(x()+1,y()+1,x()+14,y()+14);
}
int MCheck::Process()
{
Mouse am;
if(firstrun)
{
firstrun=0;UnFocus();
if(CS) Checked();
return 1;
}
if(!am.lp()) return 1;
if(am.x()<x()||am.y()<y()||am.x()>(x()+w()-1) ||
am.y()>(y()+h()-1)) return 1;
while(am.lp()) am.Reset();
if(am.x()<x()||am.y()<y()||am.x()>(x()+w()-1) ||
am.y()>(y()+h()-1)) return 1;
if(CS) CS=0;
else CS=1;
GetFocus();
if(CS) return F();
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -