Blender  V2.93
BKE_workspace.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #pragma once
22 
23 #include "BLI_compiler_attrs.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 struct Main;
30 struct bScreen;
31 struct bToolRef;
32 
33 /* -------------------------------------------------------------------- */
34 /* Create, delete, init */
35 
36 struct WorkSpace *BKE_workspace_add(struct Main *bmain, const char *name);
37 void BKE_workspace_remove(struct Main *bmain, struct WorkSpace *workspace);
38 
40  const int winid);
41 void BKE_workspace_instance_hook_free(const struct Main *bmain,
42  struct WorkSpaceInstanceHook *hook);
43 
44 struct WorkSpaceLayout *BKE_workspace_layout_add(struct Main *bmain,
45  struct WorkSpace *workspace,
46  struct bScreen *screen,
47  const char *name) ATTR_NONNULL();
48 void BKE_workspace_layout_remove(struct Main *bmain,
49  struct WorkSpace *workspace,
50  struct WorkSpaceLayout *layout) ATTR_NONNULL();
51 
52 void BKE_workspace_relations_free(ListBase *relation_list);
53 
54 /* -------------------------------------------------------------------- */
55 /* General Utils */
56 
57 struct WorkSpaceLayout *BKE_workspace_layout_find(const struct WorkSpace *workspace,
58  const struct bScreen *screen)
61  const struct bScreen *screen,
62  struct WorkSpace **r_workspace)
63  ATTR_NONNULL(1, 2);
64 
66  const struct WorkSpace *workspace,
67  struct WorkSpaceLayout *start,
68  bool (*callback)(const struct WorkSpaceLayout *layout, void *arg),
69  void *arg,
70  const bool iter_backward);
71 
72 void BKE_workspace_tool_remove(struct WorkSpace *workspace, struct bToolRef *tref)
73  ATTR_NONNULL(1, 2);
74 
75 /* -------------------------------------------------------------------- */
76 /* Getters/Setters */
77 
78 #define GETTER_ATTRS ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
79 #define SETTER_ATTRS ATTR_NONNULL(1)
80 
83  struct WorkSpace *workspace) SETTER_ATTRS;
87  const int winid,
88  struct WorkSpace *workspace,
89  struct WorkSpaceLayout *layout) SETTER_ATTRS;
93  const int winid,
94  struct WorkSpace *workspace,
95  struct bScreen *screen) SETTER_ATTRS;
96 
98 void BKE_workspace_layout_name_set(struct WorkSpace *workspace,
99  struct WorkSpaceLayout *layout,
100  const char *new_name) ATTR_NONNULL();
102 
104  const struct WorkSpaceInstanceHook *hook, const struct WorkSpace *workspace) GETTER_ATTRS;
105 
106 bool BKE_workspace_owner_id_check(const struct WorkSpace *workspace, const char *owner_id)
107  ATTR_NONNULL();
108 
109 void BKE_workspace_id_tag_all_visible(struct Main *bmain, int tag) ATTR_NONNULL();
110 
111 #undef GETTER_ATTRS
112 #undef SETTER_ATTRS
113 
114 #ifdef __cplusplus
115 }
116 #endif
#define GETTER_ATTRS
Definition: BKE_workspace.h:78
void BKE_workspace_active_layout_set(struct WorkSpaceInstanceHook *hook, const int winid, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) SETTER_ATTRS
Activate a layout.
Definition: workspace.c:594
void BKE_workspace_layout_remove(struct Main *bmain, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL()
Definition: workspace.c:386
struct WorkSpaceLayout * BKE_workspace_layout_add(struct Main *bmain, struct WorkSpace *workspace, struct bScreen *screen, const char *name) ATTR_NONNULL()
Definition: workspace.c:367
void BKE_workspace_tool_remove(struct WorkSpace *workspace, struct bToolRef *tref) ATTR_NONNULL(1
bool BKE_workspace_owner_id_check(const struct WorkSpace *workspace, const char *owner_id) ATTR_NONNULL()
struct WorkSpaceInstanceHook * BKE_workspace_instance_hook_create(const struct Main *bmain, const int winid)
struct WorkSpace * BKE_workspace_active_get(struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
Definition: workspace.c:535
struct WorkSpaceLayout * BKE_workspace_active_layout_for_workspace_get(const struct WorkSpaceInstanceHook *hook, const struct WorkSpace *workspace) GETTER_ATTRS
void BKE_workspace_active_screen_set(struct WorkSpaceInstanceHook *hook, const int winid, struct WorkSpace *workspace, struct bScreen *screen) SETTER_ATTRS
Definition: workspace.c:607
struct WorkSpace * BKE_workspace_add(struct Main *bmain, const char *name)
Definition: workspace.c:307
void BKE_workspace_relations_free(ListBase *relation_list)
Definition: workspace.c:397
void BKE_workspace_layout_name_set(struct WorkSpace *workspace, struct WorkSpaceLayout *layout, const char *new_name) ATTR_NONNULL()
Definition: workspace.c:621
void BKE_workspace_instance_hook_free(const struct Main *bmain, struct WorkSpaceInstanceHook *hook)
struct bScreen * BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
void BKE_workspace_id_tag_all_visible(struct Main *bmain, int tag) ATTR_NONNULL()
Definition: workspace.c:519
const char * BKE_workspace_layout_name_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS
#define SETTER_ATTRS
Definition: BKE_workspace.h:79
void BKE_workspace_active_set(struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace) SETTER_ATTRS
Definition: workspace.c:539
struct WorkSpaceLayout * BKE_workspace_layout_find_global(const struct Main *bmain, const struct bScreen *screen, struct WorkSpace **r_workspace) ATTR_NONNULL(1
struct WorkSpaceLayout struct WorkSpaceLayout * BKE_workspace_layout_iter_circular(const struct WorkSpace *workspace, struct WorkSpaceLayout *start, bool(*callback)(const struct WorkSpaceLayout *layout, void *arg), void *arg, const bool iter_backward)
struct WorkSpaceLayout * BKE_workspace_active_layout_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
void BKE_workspace_remove(struct Main *bmain, struct WorkSpace *workspace)
Definition: workspace.c:321
struct bScreen * BKE_workspace_layout_screen_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS
struct WorkSpaceLayout * BKE_workspace_layout_find(const struct WorkSpace *workspace, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
#define ATTR_NONNULL(...)
void BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() ATTR_WARN_UNUSED_RESULT
DEGForeachIDComponentCallback callback
Definition: BKE_main.h:116
Wrapper for bScreen.
struct bScreen * screen