2 shunfurh shunfurh 于 2017.09.11 22:48 提问

WIMP

A window manager takes care of the details of creating, displaying, moving, and resizing a collection of windows in a graphical user interface. It also handles input events (like mouse clicks) related to these window management tasks. Your project is to write a WIndow Manager Program (WIMP).
The WIMP controls a screen of size 1024 * 1024 (measured in pixels), with the upper left-hand pixel at (0, 0). The x-coordinates range from 0 at the left edge of the screen to 1023 at the right edge, and the y-coordinates range from 0 at the top of the screen to 1023 at the bottom. All coordinates are integers. The user can create and manipulate rectangular windows by moving the mouse and clicking the mouse button. A window has 4 distinct areas:

Area Location and Size
Close box upper left hand corner of the window (25 *25 pixels)
Zoom box upper right hand corner of the window (25 *25 pixels)
Motion bar fills the top 25 pixels of the window, excluding zoom and close boxes
Data area remainder of the window
A window will always be at least 51 * 26 so that all four areas are nonempty. Each window is assigned a unique integer identifier, starting at 0 (the first window created has id 0, the second one created has id 1, and so on). Identifiers are not reused.

The WIMP accepts the following events:

Event Meaning
DN x y user pressed mouse button at location (x, y)
UP x y user released mouse button at location (x, y)
AT x y user moved mouse to location (x, y)
CR l t r b create new window with positions left, top, right, and bottom
RE redraw all windows from back to front
ZZ exit the WIMP
The values x, y, l, t, r, and b are all nonnegative integers within the dimensions of the screen. The CR event always generates a properly formed window. Because windows can overlap, on a RE event they must be redrawn from back (least recently on top) to front (most recently on top). This ensures that they appear correctly overlapped to the user.

It is the job of the WIMP to keep track of all windows, even if some are overlapping. The rules it uses are:

  1. A new window is always completely visible (`on top' of all other windows).

  2. A DN event anywhere on a visible part of a window selects that window and puts it on top, making the entire window visible. A DN event that is not in the visible part of any window does not affect the currently selected window.

  3. Closing and zooming both require a DN event followed by an UP event in the appropriate box. There may be one or more AT events in between. The DN and UP events must be in the same box, but they don't have to be in the exact same location.

  4. Closing a window removes it from the screen.

  5. Zooming is a toggle that either makes the window occupy the entire screen, or returns the window to its initial size.

  6. A DN event in the motion bar allows the window to be relocated. The motion stops with an UP event. The window moves the same distance and direction that the mouse moved between the DN and UP events.

  7. AT events while moving a window must output the window's current position. AT events at any other time do not generate any output.

  8. Windows occupying the full screen cannot be moved.

  9. Windows can partially move off the visible screen.

  10. AT events happen.

Input

The input file contains one or more lines, each of which contains a single event. A ZZ event signals the end of the input. The events are all part of the same session.

Output

For each user action, output the corresponding message. On an RE event, the location of all windows must be output from back-to-front using the format shown.

Action Message
Create window Created window n at l, t, r, b'
Select window
Selected window n'
Close window Closed window n'
Move window
Moved window n to l, t, r, b'
Zoom window Resized window n to l, t, r, b'
Redraw
Window n at l, t, r, b'

Sample Input

CR 0 0 200 200
CR 50 50 250 250
RE
DN 195 5
AT 50 50
UP 198 6
AT 100 100
AT 1000 1000
DN 1020 10
UP 1020 10
RE
DN 100 100
UP 800 0
DN 0 700
UP 1023 1023
DN 50 10
AT 70 70
UP 100 100
DN 60 60
UP 60 60
RE
ZZ

Sample Output

Created window 0 at 0, 0, 200, 200
Created window 1 at 50, 50, 250, 250
Window 0 at 0, 0, 200, 200
Window 1 at 50, 50, 250, 250
Selected window 0
Resized window 0 to 0, 0, 1023, 1023
Selected window 0
Resized window 0 to 0, 0, 200, 200
Window 1 at 50, 50, 250, 250
Window 0 at 0, 0, 200, 200
Selected window 0
Selected window 0
Moved window 0 to 20, 60, 220, 260
Moved window 0 to 50, 90, 250, 290
Selected window 1
Closed window 1
Window 0 at 50, 90, 250, 290

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.27 22:11
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
在Windows server 2003 下搭建WIMP环境
这是在windows server 2003下IIS + mysql + php 环境搭建 在试验中用到的压缩包: http://data.99pan.com/download/280115_21_8621297061683467848.html (存在我的网盘里,已共享) 每天有个好心情!!
图形用户界面(GUI)详细发展历史
图形用户界面(GUI)详细发展历史 2004-11-7 2:14:00来源:本站整理作者:蓝点559我要评论(0)     History of the graphical user interface The graphical user interface, or "GUI", is a computer interface that uses graphic icons
GUI的发展史图形用户界面这一概念是70年代由施乐公司帕洛阿尔托研究中心提出。我们现在据说的普遍意义上的GUI便是由此产生的
图形用户界面这一概念是70年代由施乐公司帕洛阿尔托研究中心提出。我们现在据说的普遍意义上的GUI便是由此产生的。 ◆1973年施乐公司帕洛阿尔托研究中心(Xerox PARC)施乐研究机构工作小组最先建构了WIMP(也就是视窗,图标,菜单和点选器/下拉菜单)的范例,并率先在施乐一台实验性的计算机上使用。
人机交互课间
人机交互的目标: 研制“能听、能说、能理解人类语言的计算机”,最理想的是,人们可以和计算机交谈,而不像现在这样仅限于窗口、图标、鼠标,指针(WIMP)界面。
近8成PHP应用基于Windows WIMP再造黄金搭档
 互操作性并不是一个新概念,但是,随着技术、市场以及社会因素的改变,现在,应用系统的互操作性成为了大家都关注的热点。首先,随着技术的日新月异,我们身边充斥着各种各样的异构环境,人们谈论更多的是网路服务;其次,技术推动了全球化的进程,分布式的劳动力为我们创造了大量的应用系统;第三,工作和家庭的界限变得越来越模糊,人们希望自己的移动终端,手持设备可以与网络服务随时随地进行对接,这一切都离不开互操作
Implicit declaration of function 'inet_addr' is invalid in C99
inet_addr implicit declaration
现代计算机图形界面的发展与变迁
首页>IT资讯>网络 现代计算机图形界面的发展与变迁 2013-3-25 8:25:04来源:腾讯数码作者:刘鼎责编:悠悠 评论:0 对于大部分用户来说,打开电脑后使用鼠标点击图标,开启窗口似乎天经地义,习以为常。然而,在我们熟悉的桌面背后,隐藏着重要的理念革新。国外著名科技网站The Verge撰稿人杰西·希格斯(Jesse Hicks)带领我们回顾了半个世纪
鼠标手势的工效学研究进展
鼠标手势的研究文献:鼠标手势作为鼠标输入和手势输入的结合体,在基于WIMP的人机交互环境中开始得到日益广泛的关注和应用。文章在简要回顾鼠标手势的发展历程基础上,重点介绍鼠标手势近年来用户体验相关研究成果,总结了典型的鼠标手势识别模型及算法,并探讨了鼠标手势的商业应用和发展前景。
UIDT:一种基于摄像头的用户界面模型
为了弥补WIMP界面模型对视觉交互描述的不足,提出一种基于视觉交互的用户界面模型.首先在分析和 总结视觉交互过程的基础上,以活动理论为基础,提出一种以用户为中心、面向任务和基于事件驱动的用户界面模 型;然后描述了该模型的组成结构及其相互关系;最后给出了一个基于此模型的视频手势交互系统实例.实验结果 表明,该模型能够有效地支持视觉交互设计,使用户界面满足可用性要求.
scala学习-Description Resource Path Location Type value toDF is not a member of org.apache.spark.rdd.R
编译如下代码时,出现value toDF is not a member of org.apache.Spark.rdd.RDD[People] 错误val rdd : RDD[People]= sparkSession.sparkContext.textFile(hdfsFile,2).map(line => line.split(“,”)).map(arr => People(arr(0),a