YSTest  PreAlpha_b400_20130424
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
textarea.cpp
浏览该文件的文档.
1 /*
2  Copyright by FrankHB 2011 - 2013.
3 
4  This file is part of the YSLib project, and may only be used,
5  modified, and distributed under the terms of the YSLib project
6  license, LICENSE.TXT. By continuing to use, modify, or distribute
7  this file you indicate that you have read the license and
8  understand and accept it fully.
9 */
10 
28 #include "YSLib/UI/textarea.h"
29 #include "YSLib/UI/ywgtevt.h"
30 
32 
33 using namespace Drawing;
34 
36 
37 TextArea::TextArea(const Rect& r)
38  : Widget(r), TextState(), TextRenderer(*this),
39  Rotation(Drawing::RDeg0)
40 {}
41 TextArea::TextArea(const Rect& r, FontCache& fc)
42  : Widget(r), TextState(fc), TextRenderer(*this),
43  Rotation(Drawing::RDeg0)
44 {}
45 
46 
47 BufferedTextArea::BufferedTextArea(const Rect& r)
48  : Widget(r), TextRegion(),
49  Rotation(Drawing::RDeg0)
50 {
51  //初始化视图。
52  TextRegion::SetSize(GetWidth(), GetHeight());
53 }
54 BufferedTextArea::BufferedTextArea(const Rect& r, FontCache& fc)
55  : Widget(r), TextRegion(fc),
56  Rotation(Drawing::RDeg0)
57 {
58  //初始化视图。
59  TextRegion::SetSize(GetWidth(), GetHeight());
60 }
61 
62 void
63 BufferedTextArea::Refresh(PaintEventArgs&& e)
64 {
65  const auto& g(e.Target);
66  const Rect& r(e.ClipArea);
67 
68  BlitTo(g.GetBufferPtr(), *this, g.GetSize(), r.GetPoint(),
69  r.GetPoint() - e.Location, r.GetSize(), Rotation);
70 }
71 
73 
74 YSL_END
75