📄 miconb.cpp
字号:
#include"\sunshine\include\miconb.h"
#include"\sunshine\include\define.h"
#include<iostream.h>
#include<string.h>
MIconB::MIconB(int x1,int y1,char *filename,char *text1)
: MIcon(x1,y1,filename)
{
text=new char[strlen(text1)+1];
strcpy(text,text1);
w(60);h(50);
flag=0;
pf=0;
firstrun=1;
focus=1;
}
MIconB::~MIconB()
{
delete text;
}
void MIconB::UnFocus()
{
if(firstrun) MIcon::UnFocus();
Mouse am(1);
setfillstyle(SOLID_FILL,WHITE);
bar(x()-3,y()+h()+2,x()+Length(text)+1,y()+h()+18);
Write(text,x()-2,y()+h()+3,BLACK);
}
void MIconB::GetFocus()
{
Mouse am(1);
setfillstyle(SOLID_FILL,BLUE);
bar(x()-3,y()+h()+2,x()+Length(text)+1,y()+h()+18);
Write(text,x()-2,y()+h()+3,WHITE);
}
int MIconB::Process()
{
START_RUN;
Mouse am;
if(am.x()<x()||am.y()<y()||am.x()>(x()+w()-1)||
am.y()>(y()+h()-1))
{
if(!focus) UnFocus();
pf=0;flag=0;focus=1;return 1;
}
if(!am.lp()&&pf) {if(!flag) gettime(&oldt);flag=1;return 1;}
if(am.lp()&&!pf) {pf=1;return 1;}
if(am.lp()&&flag)
{
pf=0;flag=0;
gettime(&t);
if(t.ti_min!=oldt.ti_min||t.ti_hour!=oldt.ti_hour||
t.ti_sec!=oldt.ti_sec) return 1;
if(t.ti_hund-oldt.ti_hund<=20)return F();
}
if(focus){GetFocus();focus=0;}
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -