-
首页
-
C4D R23.110 C++ SDK
GeUserArea Class Reference
#include <c4d_gui.h>
详细描述
A class that can be used to create custom GUI components.
There are already dozens of predefined buttons in the GUI easy available. But if one wants to make his own button, one needs to use the
GeUserArea
class.
Every user area has a specified drawing area and several commands for drawing lines or text. So it is possible to developer whatever needed, either a 3D trackball or a tree like object manager.
The message sequence when the user area is created:
-
Init()
(only once)
-
GetMinSize()
-
Sized()
-
InitValues()
-
DrawMsg()
The message sequence if the user area is scaled:
-
Sized()
-
DrawMsg()
Does not require special allocation, but must be attached to a dialog with
GeDialog::AttachUserArea()
.
Internal Representation
|
CUserArea *
|
Get
()
|
void
|
Set
(CUserArea *t_cu)
|
Override
|
virtual
Bool
|
Init
(void)
|
virtual
Bool
|
InitValues
(void)
|
virtual
Bool
|
GetMinSize
(
Int32
&w,
Int32
&h)
|
virtual void
|
Sized
(
Int32
w,
Int32
h)
|
virtual
OBSOLETE
|
Draw
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2)
|
virtual void
|
DrawMsg
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2, const
BaseContainer
&msg)
|
virtual
Bool
|
InputEvent
(const
BaseContainer
&msg)
|
virtual
Bool
|
CoreMessage
(
Int32
id, const
BaseContainer
&msg)
|
virtual void
|
Timer
(const
BaseContainer
&msg)
|
virtual
Int32
|
消息
(const
BaseContainer
&msg,
BaseContainer
&result)
|
Draw
|
void
|
DrawSetPen
(const
向量
&color)
|
void
|
DrawSetPen
(
Int32
id)
|
void
|
DrawSetPen
(const
GeData
&d)
|
void
|
DrawSetOpacity
(
Float
opacity)
|
void
|
DrawSetTextCol
(
Int32
fg,
Int32
bg)
|
void
|
DrawSetTextCol
(const
向量
&fg,
Int32
bg)
|
void
|
DrawSetTextCol
(
Int32
fg, const
向量
&bg)
|
void
|
DrawSetTextCol
(const
向量
&fg, const
向量
&bg)
|
void
|
DrawSetTextCol
(const
GeData
&fg, const
GeData
&bg)
|
Bool
|
GetColorRGB
(
Int32
colorid,
Int32
&r,
Int32
&g,
Int32
&b) const
|
void
|
ActivateFading
(
Int32
milliseconds)
|
void
|
AdjustColor
(
Int32
colorid,
Int32
highlightid,
Float
percent)
|
void
|
DrawLine
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2,
Float
lineWidth=1.0,
LINESTYLE
lineStyle=
LINESTYLE::NORMAL
)
|
void
|
DrawFrame
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2,
Float
lineWidth=1.0,
LINESTYLE
lineStyle=
LINESTYLE::NORMAL
)
|
void
|
DrawRectangle
(
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2)
|
void
|
DrawBitmap
(
BaseBitmap
*bmp,
Int32
wx,
Int32
wy,
Int32
ww,
Int32
wh,
Int32
x,
Int32
y,
Int32
w,
Int32
h,
Int32
mode)
|
void
|
DrawText
(const
maxon::String
&txt,
Int32
x,
Int32
y,
Int32
flags=(0|(0<< 4)))
|
void
|
DrawBezierLine
(const
Vector2d
&startPoint, const
maxon::Block
< const
BezierPoint
> &bezierPoints,
Bool
closed,
Float
lineWidth=1.0,
LINESTYLE
lineStyle=
LINESTYLE::NORMAL
)
|
void
|
DrawBezierFill
(const
Vector2d
&startPoint, const
maxon::Block
< const
BezierPoint
> &bezierPoints,
Bool
closed)
|
void
|
DrawPolyLine
(const
maxon::Block
< const
Vector2d
> &p,
Bool
closed,
Float
lineWidth=1.0,
LINESTYLE
lineStyle=
LINESTYLE::NORMAL
)
|
void
|
DrawPolyFill
(const
maxon::Block
< const
Vector2d
> &p,
Bool
closed)
|
void
|
DrawEllipseLine
(const
Vector2d
¢erPoint, const
Vector2d
&radius,
Float
lineWidth=1.0,
LINESTYLE
lineStyle=
LINESTYLE::NORMAL
)
|
void
|
DrawEllipseFill
(const
Vector2d
¢erPoint, const
Vector2d
&radius)
|
void
|
DrawCustomButton
(
Int32
x,
Int32
y,
Int32
w,
Int32
h, const
Int32
*ids,
Bool
nofill,
Bool
focus)
|
void
|
FillBitmapBackground
(
BaseBitmap
*bmp,
Int32
offsetx,
Int32
offsety)
|
void
|
DrawSetFont
(
Int32
fontid)
|
Int32
|
DrawGetTextWidth
(const
maxon::String
&text) const
|
Int32
|
DrawGetTextWidth_ListNodeName
(
BaseList2D
*node,
Int32
fontid=
FONT_STANDARD
) const
|
Int32
|
DrawGetFontHeight
() const
|
Int32
|
DrawGetFontBaseLine
() const
|
void
|
DrawSetTextRotation
(
Float
textrotation)
|
Border
|
void
|
GetBorderSize
(
Int32
type,
Int32
*l,
Int32
*t,
Int32
*r,
Int32
*b) const
|
void
|
DrawBorder
(
Int32
type,
Int32
x1,
Int32
y1,
Int32
x2,
Int32
y2)
|
Bool
|
CheckDropArea
(const
BaseContainer
&msg,
Bool
horiz,
Bool
vert) const
|
构造函数 & 析构函数文档编制
◆
GeUserArea()
Constructs a user area that is not attached to any dialog.
-
注意
-
The user area must be attached to a dialog with
GeDialog::AttachUserArea()
before it can be used.
◆
~GeUserArea()
Destroys the user area.
成员函数文档编制
◆
MAXON_DISALLOW_COPY_AND_ASSIGN()
◆
Get()
Gets the internal representation of the user area.
Needed by some areas in the API for historical reasons.
-
返回
-
The internal user area representation.
nullptr
if the user area is not attached to a dialog.
◆
Set()
void Set
|
(
|
CUserArea *
|
t_cu
|
)
|
|
Sets the internal representation of the user area.
Needed by some areas in the API for historical reasons.
-
参数
-
[in]
|
t_cu
|
An internal user area representation.
|
◆
GetDialog()
Gets the user area's parent dialog.
-
返回
-
The pointer to the user area's parent dialog.
◆
Init()
virtual
Bool
Init
|
(
|
void
|
|
)
|
|
|
virtual
|
Called once when the user area is initialized by the GUI, before the layout is calculated.
Override this function to initialize anything.
-
返回
-
true
if successful, or
false
to signalize an error.
◆
InitValues()
virtual
Bool
InitValues
|
(
|
void
|
|
)
|
|
|
virtual
|
Called after the layout is calculated, before the user area is drawn.
Override this function to initialize anything.
-
返回
-
true
if successful, or
false
to signalize an error.
◆
GetMinSize()
Called to specify a minimum size for the user area.
Override this function to set the minimum size of the user area to
w
and
h
.
-
参数
-
[in]
|
w
|
Assign the minimum width in pixels.
|
[in]
|
h
|
Assign the minimum height in pixels.
|
-
返回
-
true
if successful, or
false
to signalize an error.
◆
Sized()
Called when the user area is resized.
Override this function to update anything.
-
参数
-
[in]
|
w
|
The new width in pixels.
|
[in]
|
h
|
The new height in pixels.
|
◆
Draw()
Deprecated
.
◆
DrawMsg()
Called to draw the user area.
Use the drawing functions to update the user area in the region specified by the rectangle from (
x1
,
y1
) to (
x2
,
y2
).
Remember to use
OffScreenOn()
to avoid flickering.
-
参数
-
[in]
|
x1
|
The upper left X coordinate.
|
[in]
|
y1
|
The upper left Y coordinate.
|
[in]
|
x2
|
The lower right X coordinate.
|
[in]
|
y2
|
The lower right Y coordinate.
|
[in]
|
msg
|
The draw container.
|
◆
InputEvent()
Called when an input event is received.
The information about the input event is stored in the
msg
container. See
Input Events
了解更多信息。
-
另请参阅
-
MOUSEMOVE_DELTA
.
-
参数
-
[in]
|
msg
|
The event container.
|
-
返回
-
true
if the event was handled, otherwise
false
.
◆
CoreMessage()
Called when a core message is received.
The message type is given by
id
and the message information is stored in
msg
.
-
另请参阅
-
The article
Core Messages
了解更多信息。
-
参数
-
[in]
|
id
|
The message type:
EVMSG
|
[in]
|
msg
|
The core message container.
|
-
返回
-
Currently not used.
◆
Timer()
Called when a timer event is received.
To subscribe to timer events use
SetTimer()
.
-
参数
-
[in]
|
msg
|
The timer message container.
|
◆
Message()
Called when a message is received.
Override this function to react to more messages than covered by the other virtual functions. Normally this is not necessary.
-
注意
-
If overriden, include a call to the base version of this function,
GeUserArea::Message()
.
-
另请参阅
-
The article
GUI Messages
了解更多信息。
-
参数
-
[in]
|
msg
|
The message container.
|
[in]
|
result
|
A container to place results in.
|
-
返回
-
Depends on the message.
◆
Redraw()
void Redraw
|
(
|
Bool
|
threaded
=
false
|
)
|
|
Forces the user area to redraw itself.
-
参数
-
[in]
|
threaded
|
Must be set to
true
if the function is called from another thread than the main
Cinema 4D
thread.
|
◆
SendParentMessage()
Sends a custom message to the parent dialog.
-
另请参阅
-
The article
GUI Messages
了解更多信息。
-
参数
-
[in]
|
msg
|
The message container.
|
-
返回
-
true
if successful, otherwise
false
.
◆
GetId()
Gets the ID of the user area.
-
返回
-
The user area ID.
◆
GetWidth()
Gets the width in pixels of the user area.
-
返回
-
The user area's width.
◆
GetHeight()
Int32
GetHeight
|
(
|
|
)
|
const
|
Gets the height in pixels of the user area.
-
返回
-
The user area's height.
◆
IsEnabled()
Checks the enabled state of the user area.
-
返回
-
true
if the user area is enabled in the dialog, otherwise
false
.
◆
IsR2L()
Checks if the user area has to be drawn in right-to-left layout mode.
-
返回
-
true
if the user area is in right-to-left layout mode, otherwise
false
.
◆
HasFocus()
Checks if the user area has the focus.
-
返回
-
true
if the user area has the focus in the dialog, otherwise
false
.
◆
LayoutChanged()
void LayoutChanged
|
(
|
void
|
|
)
|
|
Tells
Cinema 4D
that the user area has new dimensions. That causes
Cinema 4D
to call:
-
GetMinSize()
-
Sized()
-
InitValues()
-
Draw()
The dialog's layout is recalculated in this process.
◆
SetTimer()
void SetTimer
|
(
|
Int32
|
timer
|
)
|
|
Initializes the timer clock, so that
Timer()
is called every
timer
milliseconds. Use
SetTimer(0)
to stop the timer.
-
注意
-
Depending on the speed of the computer, the operating system, the complexity of the dialog and the threads running in the background, there is no guarantee that event messages will occur on a regular basis.
Using a value of
500
ms should be no problem but using a value of 1 ms one might get events with the following time spaces:
3
ms,
76
ms,
15
ms,
19
ms,
67
ms etc.
-
警告
-
Keep in mind that using small timer values results in heavy message traffic in the application which may slow down
Cinema 4D
(and all other applications running on the computer) to a point where nothing is working any longer besides the dialog.
-
参数
-
[in]
|
timer
|
The timer interval in milliseconds. Pass
0
to stop the timer.
|
◆
GetInputState()
Polls a certain channel of a device for the current input state.
If the return value is
true
, the container stored in
res
is like an input event message, otherwise no state was available.
For a list of valid devices and channels, see
Input Events
.
-
参数
-
[in]
|
askdevice
|
The device to ask.
|
[in]
|
askchannel
|
The channel of the device.
|
[in]
|
res
|
The result container.
|
-
返回
-
true
if an input state could be retrieved, otherwise
false
.
◆
GetInputEvent()
Gets the next input event for a certain device from the event queue.
If the return value is
true
, the container stored in
res
is like an input event message, otherwise no state was available.
For a list of valid devices and channels, see
Input Events
.
-
参数
-
[in]
|
askdevice
|
The device to poll.
|
[in]
|
res
|
The result container.
|
-
返回
-
true
if an input event could be retrieved, otherwise
false
.
◆
KillEvents()
Flushes all events from the window message queue.
For example if looping while the mouse is down (polling), call this function to flush all key downs/mouse clicks that are made during the loop.
◆
IsHotkeyDown()
Checks the standard navigation hotkeys.
-
参数
-
[in]
|
id
|
The hotkey to check:
HOTKEY
|
-
返回
-
A value != 0 if the hotkey is pressed.
◆
DrawSetPen()
[1/3]
void DrawSetPen
|
(
|
const
向量
&
|
color
|
)
|
|
Sets the draw color.
-
参数
-
[in]
|
color
|
A color vector.
|
◆
DrawSetPen()
[2/3]
void DrawSetPen
|
(
|
Int32
|
id
|
)
|
|
Sets the draw color.
-
参数
-
[in]
|
id
|
A color constant:
COLOR
|
◆
DrawSetPen()
[3/3]
void DrawSetPen
|
(
|
const
GeData
&
|
d
|
)
|
|
Set the draw color.
-
参数
-
[in]
|
d
|
A color data. Can be either a color vector or a color constant in the
GeData
.
|
◆
DrawSetOpacity()
void DrawSetOpacity
|
(
|
Float
|
opacity
|
)
|
|
Sets the opacity value.
-
参数
-
[in]
|
opacity
|
The opacity.
|
◆
DrawSetTextCol()
[1/5]
Sets the text foreground and background color.
-
参数
-
[in]
|
fg
|
A color constant for the foreground:
COLOR
|
[in]
|
bg
|
A color constant for the background:
COLOR
|
◆
DrawSetTextCol()
[2/5]
void DrawSetTextCol
|
(
|
const
向量
&
|
fg
,
|
|
|
Int32
|
bg
|
|
)
|
|
|
Sets the text foreground and background color.
-
参数
-
[in]
|
fg
|
A color vector for the foreground.
|
[in]
|
bg
|
A color constant for the background:
COLOR
|
◆
DrawSetTextCol()
[3/5]
void DrawSetTextCol
|
(
|
Int32
|
fg
,
|
|
|
const
向量
&
|
bg
|
|
)
|
|
|
Sets the text foreground and background color.
-
参数
-
[in]
|
fg
|
A color constant for the foreground:
COLOR
|
[in]
|
bg
|
A color vector for the background.
|
◆
DrawSetTextCol()
[4/5]
void DrawSetTextCol
|
(
|
const
向量
&
|
fg
,
|
|
|
const
向量
&
|
bg
|
|
)
|
|
|
Sets the text foreground and background color.
-
参数
-
[in]
|
fg
|
A color vector for the foreground.
|
[in]
|
bg
|
A color vector for the background.
|
◆
DrawSetTextCol()
[5/5]
void DrawSetTextCol
|
(
|
const
GeData
&
|
fg
,
|
|
|
const
GeData
&
|
bg
|
|
)
|
|
|
Sets the text foreground and background color.
-
参数
-
[in]
|
fg
|
A color data for the foreground. Can be either a color vector or a color ID.
|
[in]
|
bg
|
A color data for the background. Can be either a color vector or a color ID.
|
◆
GetColorRGB()
Gets the RGB values associated with a color constant.
-
参数
-
[in]
|
colorid
|
A color constant:
COLOR
|
[out]
|
r
|
Assigned the red component of the color.
|
[out]
|
g
|
Assigned the green component of the color.
|
[out]
|
b
|
Assigned the blue component of the color.
|
-
返回
-
true
if successful, otherwise
false
.
◆
ActivateFading()
void ActivateFading
|
(
|
Int32
|
milliseconds
|
)
|
|
Activates the fading.
-
参数
-
[in]
|
milliseconds
|
The time for the fading in milliseconds.
|
◆
AdjustColor()
Sets the blend colors for user area fading.
-
参数
-
[in]
|
colorid
|
A color constant to fade from:
COLOR
|
[in]
|
highlightid
|
A color constant to fade to:
COLOR
|
[in]
|
percent
|
A fading percentage.
|
◆
DrawLine()
Draws a line with the current pen color between (
x1
,
y1
) and (
x2
,
y2
).
-
参数
-
[in]
|
x1
|
The X start coordinate.
|
[in]
|
y1
|
The Y start coordinate.
|
[in]
|
x2
|
The X end coordinate.
|
[in]
|
y2
|
The Y end coordinate.
|
◆
DrawFrame()
Draws a rectangular frame with the current pen color between (
x1
,
y1
) and (
x2
,
y2
).
-
参数
-
[in]
|
x1
|
The X coordinate of the first corner.
|
[in]
|
y1
|
The Y coordinate of the first corner.
|
[in]
|
x2
|
The X coordinate of the opposite corner.
|
[in]
|
y2
|
The Y coordinate of the opposite corner.
|
[in]
|
lineWidth
|
Line width to draw the line.
|
◆
DrawRectangle()
Fills a rectangular area with the current pen color between (
x1
,
y1
) and (
x2
,
y2
).
-
参数
-
[in]
|
x1
|
The X coordinate of the first corner.
|
[in]
|
y1
|
The Y coordinate of the first corner.
|
[in]
|
x2
|
The X coordinate of the opposite corner.
|
[in]
|
y2
|
The Y coordinate of the opposite corner.
|
◆
DrawBitmap()
Draws a bitmap into the user area.
The region (
x
,
y
) to (
x
+
w
,
y
+
h
) from the bitmap will be scaled and transformed into the region (
wx
,
wy
) to (
wx
+
ww
,
wy
+
wh
) of the destination area.
-
注意
-
BMP_ALLOWALPHA
can be combined with the other
BMP
modes for parameter
mode
.
-
参数
-
[in]
|
bmp
|
The bitmap to draw. The caller owns the pointed bitmap.
|
[in]
|
wx
|
The X coordinate of the upper left corner of the destination area.
|
[in]
|
wy
|
The Y coordinate of the upper left corner of the destination area.
|
[in]
|
ww
|
The width of the destination area.
|
[in]
|
wh
|
The height of the destination area.
|
[in]
|
x
|
The X coordinate of the upper left corner of the bitmap area.
|
[in]
|
y
|
The Y coordinate of the upper left corner of the bitmap area.
|
[in]
|
w
|
The width of the bitmap area.
|
[in]
|
h
|
The height of the bitmap area.
|
[in]
|
mode
|
Can be a combination of the following flags:
BMP
|
◆
DrawText()
Draws the string txt with the upper left corner at the position (
x
,
y
).
-
注意
-
使用
DrawGetTextWidth
and
DrawGetFontHeight
to find out where to place the text.
-
参数
-
[in]
|
txt
|
The text to draw.
|
[in]
|
x
|
The X coordinate of the upper left corner for the text to draw.
|
[in]
|
y
|
The Y coordinate of the upper left corner for the text to draw.
|
[in]
|
flags
|
The draw text flags:
DRAWTEXT
|
◆
DrawBezierLine()
Draws concatenated Bezier curves.
-
参数
-
[in]
|
startPoint
|
The XY coordinate of the upper left corner of the drawn curve.
|
[in]
|
bezierPoints
|
An array containing a struct of Bezier curves points.
|
[in]
|
closed
|
若
true
, the last point of the last segment connects back to the starting point (
startPoint
).
|
[in]
|
lineWidth
|
The width of the Bezier curve. Default 1.0.
|
[in]
|
lineStyle
|
The line style of the Bezier curve.
|
◆
DrawBezierFill()
◆
DrawPolyLine()
◆
DrawPolyFill()
◆
DrawEllipseLine()
◆
DrawEllipseFill()
◆
DrawCustomButton()
◆
FillBitmapBackground()
Fills a bitmap with the current pen color.
-
注意
-
The
offsetx
and
offsety
parameters are used when the background is a pattern and are given in local coordinates of the user area. These can be used to make semi-transparent bitmap blits.
-
参数
-
[in]
|
bmp
|
The bitmap to fill. The caller owns the pointed bitmap.
|
[in]
|
offsetx
|
The X offset in pixels.
|
[in]
|
offsety
|
The Y offset in pixels.
|
◆
DrawSetFont()
void DrawSetFont
|
(
|
Int32
|
fontid
|
)
|
|
Sets the text font.
-
参数
-
[in]
|
fontid
|
The font to use:
FONT
|
◆
DrawGetTextWidth()
Retrieves the width in pixels of
text
, if it were drawn in the current font.
-
参数
-
[in]
|
text
|
The string to measure.
|
-
返回
-
The text width in pixels.
◆
DrawGetTextWidth_ListNodeName()
Retrieves the width in pixels of the name of
node
.
-
参数
-
[in]
|
node
|
The node to check.
|
[in]
|
fontid
|
The font:
FONT
|
-
返回
-
The text width in pixels.
◆
DrawGetFontHeight()
Int32
DrawGetFontHeight
|
(
|
|
)
|
const
|
Retrieves the height in pixels of a line of text in the current font.
-
返回
-
The height in pixels.
◆
DrawGetFontBaseLine()
Int32
DrawGetFontBaseLine
|
(
|
|
)
|
const
|
Retrieves the base line of the current font.
-
返回
-
The base line of the current font.
◆
DrawSetTextRotation()
void DrawSetTextRotation
|
(
|
Float
|
textrotation
|
)
|
|
Rotates the font for drawing.
-
注意
-
Rotation is clockwise and must be reset to
0
after drawing.
-
参数
-
[in]
|
textrotation
|
The text rotation in degree.
|
◆
SetClippingRegion()
Specifies the clipping region for the
Draw()
函数。
-
注意
-
The clipping region can be set to the whole user area with
OffScreenOn
automatically, so normally this function is not necessary.
-
警告
-
Without specifying a dedicated clipping region everything will be painted, even outside the user area.
-
参数
-
[in]
|
x
|
The X coordinate of the upper left corner of the clipping region.
|
[in]
|
y
|
The Y coordinate of the upper left corner of the clipping region.
|
[in]
|
w
|
The width of the clipping region.
|
[in]
|
h
|
The height of the clipping region.
|
◆
ClearClippingRegion()
void ClearClippingRegion
|
(
|
void
|
|
)
|
|
Clears any clipping region set with
SetClippingRegion
.
◆
OffScreenOn()
[1/2]
Bool
OffScreenOn
|
(
|
void
|
|
)
|
|
Enables double buffering to avoid blinking and flickering effects. Automatically sets the clipping area to the whole user area.
The GUI will automatically switch planes. Just call this function before drawing things.
-
返回
-
true
if double buffering could be enabled, otherwise
false
.
◆
OffScreenOn()
[2/2]
Enables double buffering to avoid blinking and flickering effects. Sets the clipping area to the rectangular area determined by
x
,
y
,
w
and
h
.
-
参数
-
[in]
|
x
|
The X coordinate of the upper left corner of the clipping area.
|
[in]
|
y
|
The Y coordinate of the upper left corner of the clipping area.
|
[in]
|
w
|
The width of the clipping area.
|
[in]
|
h
|
The height of the clipping area.
|
-
返回
-
true
if double buffering could be enabled, otherwise
false
.
◆
ScrollArea()
Scrolls the area from (
x
,
y
) to (
x
+
w
,
y
+
h
) in the direction specified by
xdiff
and
ydiff
.
-
参数
-
[in]
|
xdiff
|
The X distance to scroll.
|
[in]
|
ydiff
|
The Y distance to scroll.
|
[in]
|
x
|
The X coordinate of the upper left corner of the area to scroll.
|
[in]
|
y
|
The Y coordinate of the upper left corner of the area to scroll.
|
[in]
|
w
|
The width of the area to scroll.
|
[in]
|
h
|
The height of the area to scroll.
|
◆
GetPixelRatio()
Float
GetPixelRatio
|
(
|
|
)
|
const
|
Private
. Always returns
1.0
except for user areas shown on OS X Retina displays, where it returns
2.0
.
-
返回
-
Always
1.0
except for user areas shown on OS X Retina displays.
◆
Local2Global()
[1/2]
Transforms local coordinates (relative to the top left corner of the user area) to global window coordinates (relative to the top left corner of the application window). Stores the result in *
x
and *
y
.
-
参数
-
[in,out]
|
x
|
The local X coordinate. Assigned the global window coordinate.
|
[in,out]
|
y
|
The local Y coordinate. Assigned the global window coordinate.
|
-
返回
-
true
if the coordinates were converted, otherwise
false
.
◆
Local2Global()
[2/2]
◆
Global2Local()
[1/2]
Transforms global window coordinates (relative to the top left corner of the application window) to local coordinates (relative to the top left corner of the user area). Stores the result in *
x
and *
y
.
-
参数
-
[in,out]
|
x
|
The global window X coordinate. Assigned the local coordinate.
|
[in,out]
|
y
|
The global window Y coordinate. Assigned the local coordinate.
|
-
返回
-
true
if the coordinates were converted, otherwise
false
.
◆
Global2Local()
[2/2]
◆
Local2Screen()
[1/2]
Transforms local coordinates (relative to the top left corner of the user area) to screen coordinates (relative to the top left corner of the system screen). Stores the result in *
x
and *
y
.
-
参数
-
[in,out]
|
x
|
The local X coordinate. Assigned the screen coordinate.
|
[in,out]
|
y
|
The local Y coordinate. Assigned the screen coordinate.
|
-
返回
-
true
if the coordinates were converted, otherwise
false
.
◆
Local2Screen()
[2/2]
◆
Screen2Local()
[1/2]
Transforms screen coordinates (relative to the top left corner of the system screen) to local coordinates (relative to the top left corner of the user area). Stores the result in *
x
and *
y
.
-
参数
-
[in,out]
|
x
|
The screen X coordinate. Assigned the converted local coordinate.
|
[in,out]
|
y
|
The screen Y coordinate. Assigned the converted local coordinate.
|
-
返回
-
true
if the coordinates were converted, otherwise
false
.
◆
Screen2Local()
[2/2]
◆
GetDragPosition()
Extracts local drag coordinates from a drag and drop event. Stores the result in *
x
and *
y
.
-
另请参阅
-
The article
Drag and Drop
了解更多信息。
-
参数
-
[in]
|
msg
|
The original message.
|
[out]
|
x
|
Assigned the local X position.
|
[out]
|
y
|
Assigned the local Y position.
|
-
返回
-
true
if the drag position was extracted, otherwise
false
.
◆
GetDragObject()
Extracts the object from a drag and drop message. Stores the result in *
type
and *
object
.
-
另请参阅
-
The article
Drag and Drop
了解更多信息。
-
参数
-
[in]
|
msg
|
The original message.
|
[out]
|
type
|
Assigned the type of the object.
|
[out]
|
object
|
Assigned a pointer to the object.
Cinema 4D
owns the pointed object.
|
-
返回
-
true
if the drag object was extracted, otherwise
false
.
◆
HandleMouseDrag()
Starts a drag and drop operation.
-
另请参阅
-
The article
Drag and Drop
了解更多信息。
-
参数
-
[in]
|
msg
|
The mouse event message that triggered the drag and drop.
|
[in]
|
type
|
The type of data passed:
DRAGTYPE
|
[in]
|
data
|
A pointer to the data passed.
|
[in]
|
dragflags
|
The drag flags.
Private
.
|
-
返回
-
true
if the user moved the mouse and a drag and drop operation was initiated.
false
if the user did not move the mouse, so that the original event is a normal mouse click event.
◆
SetDragDestination()
Sets the correct cursor during drag and drop handling.
-
另请参阅
-
The article
Drag and Drop
了解更多信息。
-
参数
-
[in]
|
cursor
|
A mouse cursor:
MOUSE
|
-
返回
-
true
if the cursor could be set, otherwise
false
.
◆
GetBorderSize()
Retrieves the space required to draw a border.
-
参数
-
[in]
|
type
|
The border type:
BORDER
|
[out]
|
l
|
Assigned the space to the left.
|
[out]
|
t
|
Assigned the space on the top.
|
[out]
|
r
|
Assigned the space to the right.
|
[out]
|
b
|
Assigned the space on the bottom.
|
◆
DrawBorder()
Draws a border within the rectangle from (
x1
,
y1
) to (
x2
,
y2
).
-
参数
-
[in]
|
type
|
The border type:
BORDER
|
[in]
|
x1
|
The X coordinate of the first corner.
|
[in]
|
y1
|
The Y coordinate of the first corner.
|
[in]
|
x2
|
The X coordinate of the opposite corner.
|
[in]
|
y2
|
The Y coordinate of the opposite corner.
|
◆
CheckDropArea()
Checks the drag position in a drag event message against the user area's position in the layout. The check can be limited to only
X
or
Y
coordinates.
-
参数
-
[in]
|
msg
|
The drag message.
|
[in]
|
horiz
|
若
true
the drag position is checked against the horizontal bounds of the region.
|
[in]
|
vert
|
若
true
the drag position is checked against the vertical bounds of the region.
|
-
返回
-
true
if the drag message is within the bounds specified, otherwise
false
.
◆
MouseDragStart()
Starts a mouse drag. Only call this when a mouse down message is received. Then repeatedly poll with
MouseDrag
during the drag.
-
参数
-
[in]
|
button
|
The mouse button that is pressed:
BFM_INPUT_CHANNEL
|
[in]
|
mx
|
The X position of the mouse.
|
[in]
|
my
|
The Y position of the mouse.
|
[in]
|
flag
|
The mouse drag flags:
MOUSEDRAGFLAGS
|
◆
MouseDrag()
Polls the mouse during a drag started with MouseDragStart.
To check for qualifiers see the
channels
container:
while
(
MouseDrag
(&dx, &dy, &channels)==
MOUSEDRAGRESULT::CONTINUE
)
{
if
(channels.
GetInt32
(
BFM_INPUT_QUALIFIER
) &
QSHIFT
) shift =
true
;
if
(channels.
GetInt32
(
BFM_INPUT_QUALIFIER
) &
QCTRL
) ctrl =
true
;
...
}
-
参数
-
[out]
|
mx
|
Assigned the X delta-coordinate of the mouse (the amount the mouse has moved).
|
[out]
|
my
|
Assigned the Y delta-coordinate of the mouse (the amount the mouse has moved).
|
[out]
|
channels
|
Assigned the channels values. See
Input Events
.
Also contains these
PEN
values:
PEN
|
-
返回
-
The mouse drag result:
MOUSEDRAGRESULT
◆
MouseDragEnd()
Ends a mouse drag started with
MouseDragStart
.
-
返回
-
The mouse drag result:
MOUSEDRAGRESULT
Friends And Related Function Documentation
◆
GeDialog
Member Data Documentation
◆
owncu
◆
cu
◆
dlg
If the user area is attached to a dialog this points to the dialog, otherwise
nullptr
. Can be used by derived classes.
@ BFM_INPUT_QUALIFIER
Int32 A bit mask with the qualifiers at the time when the event occurred: QUALIFIER
定义:
gui.h:684
@ QSHIFT
Shift.
定义:
gui.h:38
@ CONTINUE
Drag still in progress.
MOUSEDRAGRESULT MouseDrag(Float *mx, Float *my, BaseContainer *channels)
Int32 GetInt32(Int32 id, Int32 preset=0) const
定义:
c4d_basecontainer.h:303