Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F624145
widget.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
widget.h
View Options
#ifndef _paintown_gui_widget_h
#define _paintown_gui_widget_h
#include
"rectarea.h"
#include
"coordinate.h"
#include
"util/graphics/bitmap.h"
#include
"util/pointer.h"
namespace
Graphics
{
class
Bitmap
;
}
class
Token
;
class
Font
;
namespace
Gui
{
struct
ColorInfo
{
ColorInfo
();
Graphics
::
Color
body
;
int
bodyAlpha
;
Graphics
::
Color
border
;
int
borderAlpha
;
};
/*! Trasformations for widgets
* Eventually this could be expanded and used as something to perform changes on widgets but for now it remains to be just a place holder
* ************************
* radius - rounded corners
*/
class
Transformations
{
public
:
Transformations
();
Transformations
(
const
Transformations
&
);
virtual
~
Transformations
();
Transformations
&
operator
=
(
const
Transformations
&
);
virtual
inline
void
setRadius
(
double
radius
){
this
->
radius
=
radius
;
}
virtual
inline
double
getRadius
()
const
{
return
this
->
radius
;
}
private
:
double
radius
;
};
class
Widget
{
public
:
Widget
();
Widget
(
const
Widget
&
);
virtual
~
Widget
();
// copy
Widget
&
operator
=
(
const
Widget
&
);
void
setCoordinates
(
const
Token
*
token
);
void
setColors
(
const
Token
*
token
);
void
setTransforms
(
const
Token
*
token
);
//! New position data
Coordinate
location
;
//! Colors
ColorInfo
colors
;
//! Transformations
Transformations
transforms
;
// Logic
virtual
void
act
(
const
Font
&
)
=
0
;
// Render
virtual
void
render
(
const
Graphics
::
Bitmap
&
)
=
0
;
/* default behavior is just to call render() */
virtual
void
render
(
const
Graphics
::
Bitmap
&
,
const
Font
&
);
// draw box
static
void
drawBox
(
int
radius
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
const
Gui
::
ColorInfo
&
,
const
Graphics
::
Bitmap
&
);
protected
:
Util
::
ReferenceCount
<
Graphics
::
Bitmap
>
checkWorkArea
(
const
Graphics
::
Bitmap
&
parent
);
};
}
#endif
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sat, Nov 14, 10:01 PM (1 d, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
138907
Default Alt Text
widget.h (1 KB)
Attached To
Mode
R75 R-Tech1
Attached
Detach File
Event Timeline