forked from blender/blender
WIP: uv-simple-select #1
@ -239,6 +239,17 @@ enum {
|
||||
UI_BUT_OVERRIDDEN = 1u << 31u,
|
||||
};
|
||||
|
||||
/** #uiBut.dragflag */
|
||||
enum {
|
||||
/** By default only the left part of a button triggers dragging. A questionable design to make
|
||||
* the icon but not other parts of the button draggable. Set this flag so the entire button can
|
||||
* be dragged. */
|
||||
UI_BUT_DRAG_FULL_BUT = (1 << 0),
|
||||
|
||||
/* --- Internal flags. --- */
|
||||
UI_BUT_DRAGPOIN_FREE = (1 << 1),
|
||||
};
|
||||
|
||||
/* Default font size for normal text. */
|
||||
#define UI_DEFAULT_TEXT_POINTS 11.0f
|
||||
|
||||
@ -881,6 +892,9 @@ bool UI_but_flag_is_set(uiBut *but, int flag);
|
||||
void UI_but_drawflag_enable(uiBut *but, int flag);
|
||||
void UI_but_drawflag_disable(uiBut *but, int flag);
|
||||
|
||||
void UI_but_dragflag_enable(uiBut *but, int flag);
|
||||
void UI_but_dragflag_disable(uiBut *but, int flag);
|
||||
|
||||
void UI_but_disable(uiBut *but, const char *disabled_hint);
|
||||
|
||||
void UI_but_type_set_menu_from_pulldown(uiBut *but);
|
||||
@ -1789,9 +1803,12 @@ void UI_but_drag_set_id(uiBut *but, struct ID *id);
|
||||
/**
|
||||
* Set an image to display while dragging. This works for any drag type (`WM_DRAG_XXX`).
|
||||
* Not to be confused with #UI_but_drag_set_image(), which sets up dragging of an image.
|
||||
*
|
||||
* Sets #UI_BUT_DRAG_FULL_BUT so the full button can be dragged.
|
||||
*/
|
||||
void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, float scale);
|
||||
/**
|
||||
* Sets #UI_BUT_DRAG_FULL_BUT so the full button can be dragged.
|
||||
* \param asset: May be passed from a temporary variable, drag data only stores a copy of this.
|
||||
*/
|
||||
void UI_but_drag_set_asset(uiBut *but,
|
||||
@ -1808,6 +1825,8 @@ void UI_but_drag_set_name(uiBut *but, const char *name);
|
||||
* Value from button itself.
|
||||
*/
|
||||
void UI_but_drag_set_value(uiBut *but);
|
||||
|
||||
/** Sets #UI_BUT_DRAG_FULL_BUT so the full button can be dragged. */
|
||||
void UI_but_drag_set_image(
|
||||
uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale, bool use_free);
|
||||
|
||||
|
@ -4224,6 +4224,10 @@ static uiBut *ui_def_but(uiBlock *block,
|
||||
but->flag |= UI_BUT_UNDO;
|
||||
}
|
||||
|
||||
if (ELEM(but->type, UI_BTYPE_COLOR)) {
|
||||
but->dragflag |= UI_BUT_DRAG_FULL_BUT;
|
||||
}
|
||||
|
||||
BLI_addtail(&block->buttons, but);
|
||||
|
||||
if (block->curlayout) {
|
||||
@ -5890,6 +5894,16 @@ void UI_but_drawflag_disable(uiBut *but, int flag)
|
||||
but->drawflag &= ~flag;
|
||||
}
|
||||
|
||||
void UI_but_dragflag_enable(uiBut *but, int flag)
|
||||
{
|
||||
but->dragflag |= flag;
|
||||
}
|
||||
|
||||
void UI_but_dragflag_disable(uiBut *but, int flag)
|
||||
{
|
||||
but->dragflag &= ~flag;
|
||||
}
|
||||
|
||||
void UI_but_disable(uiBut *but, const char *disabled_hint)
|
||||
{
|
||||
UI_but_flag_enable(but, UI_BUT_DISABLED);
|
||||
|
@ -24,6 +24,7 @@ void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, const float scale)
|
||||
{
|
||||
but->imb = imb;
|
||||
but->imb_scale = scale;
|
||||
UI_but_dragflag_enable(but, UI_BUT_DRAG_FULL_BUT);
|
||||
}
|
||||
|
||||
void UI_but_drag_set_asset(uiBut *but,
|
||||
|
@ -86,11 +86,6 @@ enum {
|
||||
/* WARNING: rest of #uiBut.flag in UI_interface.h */
|
||||
};
|
||||
|
||||
/** #uiBut.dragflag */
|
||||
enum {
|
||||
UI_BUT_DRAGPOIN_FREE = (1 << 0),
|
||||
};
|
||||
|
||||
/** #uiBut.pie_dir */
|
||||
enum RadialDirection {
|
||||
UI_RADIAL_NONE = -1,
|
||||
|
@ -247,7 +247,7 @@ bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *region, const wmEv
|
||||
|
||||
BLI_rcti_rctf_copy(&rect, &but->rect);
|
||||
|
||||
if (but->imb || but->type == UI_BTYPE_COLOR) {
|
||||
if (but->dragflag & UI_BUT_DRAG_FULL_BUT) {
|
||||
/* use button size itself */
|
||||
}
|
||||
else if (but->drawflag & UI_BUT_ICON_LEFT) {
|
||||
|
Loading…
Reference in New Issue
Block a user