Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2018-07-06 20:26:12 +0300
committerJulian Eisel <eiseljulian@gmail.com>2018-07-06 20:33:13 +0300
commit29b8adec61b2c88a07d29b78b26aeca26658a166 (patch)
tree145479afe7116421b2128ec151dc160b21991528 /source/blender/editors/interface/interface_intern.h
parent2a199f5093cf6dc537047f9456adffa52b6aa005 (diff)
UI: Add extra padding to menus to draw sub-menu triangles in
Shortcut strings would be offset to the left to make space for the triangles, breaking the alignment with other shortcut strings. Now this alignment is kept by making menus slightly wider if there's a sub-menu triangle visible, making room for the triangle.
Diffstat (limited to 'source/blender/editors/interface/interface_intern.h')
-rw-r--r--source/blender/editors/interface/interface_intern.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 10b4ff58224..0b76e311cc7 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -105,7 +105,8 @@ typedef enum {
UI_WTYPE_PROGRESSBAR,
} uiWidgetTypeEnum;
-#define UI_MENU_WIDTH_MIN (UI_UNIT_Y * 9)
+#define UI_MENU_WIDTH_MIN (UI_UNIT_Y * 9)
+#define UI_MENU_SUBMENU_PADDING (6 * UI_DPI_FAC) /* some extra padding added to menus containing submenu icons */
/* menu scrolling */
#define UI_MENU_SCROLL_ARROW 12
@@ -349,6 +350,13 @@ struct PieMenuData {
float alphafac;
};
+/* uiBlock.content_hints */
+enum eBlockContentHints {
+ /* In a menu block, if there is a single sub-menu button, we add some
+ * padding to the right to put nicely aligned triangle icons there. */
+ BLOCK_CONTAINS_SUBMENU_BUT = (1 << 0),
+};
+
struct uiBlock {
uiBlock *next, *prev;
@@ -395,11 +403,15 @@ struct uiBlock {
int flag;
short alignnr;
+ /* Hints about the buttons of this block. Used to avoid iterating over
+ * buttons to find out if some criteria is met by any. Instead, check this
+ * criteria when adding the button and set a flag here if it's met. */
+ short content_hints; /* eBlockContentHints */
char direction;
char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */
bool auto_open;
- char _pad[7];
+ char _pad[5];
double auto_open_last;
const char *lockstr;