Rework of volume shading
[blender-staging.git] / source / blender / editors / space_logic / logic_header.c
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2009 Blender Foundation.
21  * All rights reserved.
22  *
23  * 
24  * Contributor(s): Blender Foundation
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include <string.h>
30 #include <stdio.h>
31
32 #include "DNA_space_types.h"
33 #include "DNA_scene_types.h"
34 #include "DNA_screen_types.h"
35 #include "DNA_windowmanager_types.h"
36
37 #include "MEM_guardedalloc.h"
38
39 #include "BLI_blenlib.h"
40
41 #include "BKE_context.h"
42 #include "BKE_screen.h"
43 #include "BKE_main.h"
44
45 #include "ED_screen.h"
46 #include "ED_types.h"
47 #include "ED_util.h"
48
49 #include "WM_api.h"
50 #include "WM_types.h"
51
52 #include "BIF_gl.h"
53 #include "BIF_glutil.h"
54
55 #include "UI_interface.h"
56 #include "UI_resources.h"
57 #include "UI_view2d.h"
58
59 #include "logic_intern.h"
60
61 /* ************************ header area region *********************** */
62
63
64 static void do_logic_buttons(bContext *C, void *arg, int event)
65 {
66 //      SpaceLogic *slogic= CTX_wm_space_logic(C);
67 }
68
69 static uiBlock *logic_addmenu(bContext *C, ARegion *ar, void *arg_unused)
70 {
71 //      SpaceLogic *slogic= CTX_wm_space_logic(C);
72         uiBlock *block;
73         short yco= 0, menuwidth=120;
74         
75         block= uiBeginBlock(C, ar, "logic_addmenu", UI_EMBOSSP);
76 //      uiBlockSetButmFunc(block, do_logic_addmenu, NULL);
77         
78         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
79         
80         uiTextBoundsBlock(block, 50);
81         uiBlockSetDirection(block, UI_TOP);
82         uiEndBlock(C, block);
83         
84         return block;
85 }       
86
87 void logic_header_buttons(const bContext *C, ARegion *ar)
88 {
89         ScrArea *sa= CTX_wm_area(C);
90 //      SpaceLogic *slogic= CTX_wm_space_logic(C);
91         uiBlock *block;
92         short xco, yco= 3;
93         
94         block= uiBeginBlock(C, ar, "header logic", UI_EMBOSS);
95         uiBlockSetHandleFunc(block, do_logic_buttons, NULL);
96         
97         xco= ED_area_header_standardbuttons(C, block, yco);
98         
99         if((sa->flag & HEADER_NO_PULLDOWN)==0) {
100                 int xmax;
101         
102                 xmax= GetButStringLength("View");
103                 uiDefPulldownBut(block, logic_addmenu, NULL, 
104                                           "View", xco, yco, xmax-3, 20, "");
105                 xco+= xmax;
106                 
107                 xmax= GetButStringLength("Select");
108                 uiDefPulldownBut(block, logic_addmenu, NULL, 
109                                                  "Select", xco, yco, xmax-3, 20, "");
110                 xco+= xmax;
111                 
112                 xmax= GetButStringLength("Add");
113                 uiDefPulldownBut(block, logic_addmenu, NULL, 
114                                                  "Add", xco, yco, xmax-3, 20, "");
115                 xco+= xmax;
116         }
117         
118         uiBlockSetEmboss(block, UI_EMBOSS);
119         
120         UI_view2d_totRect_set(&ar->v2d, xco+XIC+100, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
121         
122         uiEndBlock(C, block);
123         uiDrawBlock(C, block);
124 }
125
126