⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdia.cpp

📁 飞虹 vision仿windows开发
💻 CPP
字号:
#include"\sunshine\include\mdia.h"
#include"\sunshine\include\app.h"
#include"\sunshine\include\define.h"
#include"\sunshine\include\mlistite.h"
#include<string.h>
#include<alloc.h>
#include<bios.h>
#include<iostream.h>
#define ALT_F4 0x6b00
#define ESC 0x011b
MDialog::MDialog(int tx,int ty,int tw,int th,char *idname,char *top)
	:MWindowObj(tx,ty,tw,th,idname)
  {
	 if(top) { topic=new char(strlen(top)+1);
				  strcpy(topic,top);
				}
	 Add(*new MKey(x()+7,y()+7,20,20,*this));
	 firstrun=1;
  }
MDialog::~MDialog()
 {
	 Restore();
	 delete topic;
 }
STATE MDialog::Save()
 {
  Mouse am(1);
  rscreen=farmalloc(imagesize(x(),y(),x()+w()-1,y()+h()-1));
  getimage(x(),y(),x()+w()-1,y()+h()-1,rscreen);
  return SUCC;
 }
void MDialog::Restore()
 {
	Mouse am(1);
	putimage(x(),y(),rscreen,COPY_PUT);
	farfree(rscreen);
 }
void MDialog::UnFocus()
 {
	int x1=x(),y1=y(),x2=x()+w()-1,y2=y()+h()-1;
	Mouse am(1);
	setfillstyle(SOLID_FILL,LIGHTGRAY);
	bar(x1,y1,x2,y2);
	setfillstyle(SOLID_FILL,BLUE);
	bar(x1,y1,x2,y1+5);bar(x2-5,y1,x2,y2);
	bar(x1,y2-5,x2,y2);bar(x1,y1,x1+5,y2);
	bar(x1+7,y1+7,x2-7,y1+26);
	setcolor(WHITE);
	line(x1+6,y1+6,x2-6,y1+6);
	line(x1+6,y1+6,x1+6,y2-6);
	line(x2-6,y1+6,x2-6,y1+24);
	Write(topic,x1+(w()-1)/2-Length(topic)/2,y1+7,WHITE);
 }
void MDialog::GetFocus()
 {
 }
int MDialog::Process()
 {
	int i=0,value,key;
	char *tempname;
	if(firstrun){ firstrun=0;Save();
					  UnFocus();return 1;
					}
	while(1)
	 {
		//first process key info
      key=bioskey(1);
		if(key)
		 {
		  switch(key){
			case ALT_F4:
			case ESC:  return DEL; //eaten the key
			}
		 }
		tempname=winobj[i]->GetId();
		value=winobj[i]->Process();
		if(value==DEL) return DEL;
		if(value==DIALOG_DEL) Del(tempname);
		if(Mes==CLOSE) return DEL;
		i++;i=(i>=number?0:i);
	 }
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -