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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-06 19:40:14 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-06 19:40:14 +0300
commit84e2de8ca7a86334c604e4476cf2938c8b444fcb (patch)
treeffc5051f2064d28259a81bea763b4e01cfaf9869 /source/blender/editors/include/UI_interface.h
parent14f180fa04bd9732d603f15e3acccbc803adb8f9 (diff)
2.5: ID datablock button back, previously known as std_libbuttons. The
way this worked in 2.4x wasn't really clean, with events going all over the place and using dubious variables such as G.but->lockpoin or G.sima->menunr. It works as follows now, for example: xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID**)&sima->image, ID_IM, &sima->pin, xco, yco, sima_idpoin_handle, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_OPEN|UI_ID_DELETE|UI_ID_ALONE|UI_ID_PIN); The last two parameters are a callback function, and a list of events or functionalities that are supported. The callback function will then get the ID pointer + event to handle.
Diffstat (limited to 'source/blender/editors/include/UI_interface.h')
-rw-r--r--source/blender/editors/include/UI_interface.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index a81d956f01e..9f832a3db30 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -33,6 +33,7 @@
/* Struct Declarations */
struct ID;
+struct Main;
struct ListBase;
struct ARegion;
struct wmWindow;
@@ -395,10 +396,25 @@ struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
* - PickerButtons: buttons like the color picker (for code sharing).
* - AutoButR: RNA property button with type automatically defined. */
-typedef void (*uiIDPoinFuncFP)(struct bContext *C, char *str, struct ID **idpp);
-
-uiBut *uiDefIDPoinBut(struct uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str,
+#define UI_ID_RENAME 1
+#define UI_ID_BROWSE 2
+#define UI_ID_ADD_NEW 4
+#define UI_ID_OPEN 8
+#define UI_ID_ALONE 16
+#define UI_ID_DELETE 32
+#define UI_ID_LOCAL 64
+#define UI_ID_AUTO_NAME 128
+#define UI_ID_FAKE_USER 256
+#define UI_ID_PIN 512
+#define UI_ID_BROWSE_RENDER 1024
+#define UI_ID_FULL (UI_ID_RENAME|UI_ID_BROWSE|UI_ID_ADD_NEW|UI_ID_OPEN|UI_ID_ALONE|UI_ID_DELETE|UI_ID_LOCAL)
+
+typedef void (*uiIDPoinFuncFP)(struct bContext *C, char *str, struct ID **idpp);
+typedef void (*uiIDPoinFunc)(struct bContext *C, struct ID *id, int event);
+
+uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str,
short x1, short y1, short x2, short y2, void *idpp, char *tip);
+int uiDefIDPoinButs(uiBlock *block, struct Main *main, struct ID *parid, struct ID **id_p, int id_code, short *pin_p, int x, int y, uiIDPoinFunc func, int events);
uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip);
@@ -434,9 +450,12 @@ uiBut *uiFindInlink(uiBlock *block, void *poin);
* uiButSetCompleteFunc is for tab completion.
*
* uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used,
- * in case events, operators or RNA are not sufficient to handle the button. */
+ * in case events, operators or RNA are not sufficient to handle the button.
+ *
+ * uiButSetNFunc will free the argument with MEM_freeN. */
typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2);
+typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2);
typedef void (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg);
typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
@@ -445,6 +464,7 @@ void uiBlockSetButmFunc (uiBlock *block, uiMenuHandleFunc func, void *arg);
void uiBlockSetFunc (uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2);
void uiButSetFunc (uiBut *but, uiButHandleFunc func, void *arg1, void *arg2);
+void uiButSetNFunc (uiBut *but, uiButHandleNFunc func, void *argN, void *arg2);
void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg);