2.5
[blender.git] / source / blender / editors / space_info / info_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) 2008 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
44 #include "ED_screen.h"
45 #include "ED_types.h"
46 #include "ED_util.h"
47
48 #include "WM_api.h"
49 #include "WM_types.h"
50
51 #include "BIF_gl.h"
52 #include "BIF_glutil.h"
53
54 #include "UI_interface.h"
55 #include "UI_resources.h"
56 #include "UI_view2d.h"
57
58 #include "info_intern.h"
59
60
61 /* ************************ header area region *********************** */
62
63 static void do_viewmenu(bContext *C, void *arg, int event)
64 {
65         
66 }
67
68 static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
69 {
70         ScrArea *curarea= CTX_wm_area(C);
71         uiBlock *block;
72         short yco= 0, menuwidth=120;
73         
74         block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
75         uiBlockSetButmFunc(block, do_viewmenu, NULL);
76         
77         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, 
78                                          menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
79         
80         if(curarea->headertype==HEADERTOP) {
81                 uiBlockSetDirection(block, UI_DOWN);
82         }
83         else {
84                 uiBlockSetDirection(block, UI_TOP);
85                 uiBlockFlipOrder(block);
86         }
87         
88         uiTextBoundsBlock(block, 50);
89         uiEndBlock(C, block);
90         
91         return block;
92 }
93
94
95 static void do_info_buttons(bContext *C, void *arg, int event)
96 {
97         switch(event) {
98         }
99 }
100
101
102 void info_header_buttons(const bContext *C, ARegion *ar)
103 {
104         ScrArea *sa= CTX_wm_area(C);
105         uiBlock *block;
106         int xco, yco= 3;
107         
108         block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
109         uiBlockSetHandleFunc(block, do_info_buttons, NULL);
110         
111         xco= ED_area_header_standardbuttons(C, block, yco);
112         
113         if((sa->flag & HEADER_NO_PULLDOWN)==0) {
114                 int xmax;
115                 
116                 /* pull down menus */
117                 uiBlockSetEmboss(block, UI_EMBOSSP);
118                 
119                 xmax= GetButStringLength("File");
120                 uiDefPulldownBut(block, dummy_viewmenu, sa, "File",     xco, yco, xmax-3, 22, "");
121                 xco+= xmax;
122                 
123                 xmax= GetButStringLength("Add");
124                 uiDefPulldownBut(block, dummy_viewmenu, sa, "Add",      xco, yco, xmax-3, 22, "");
125                 xco+= xmax;
126                 
127                 xmax= GetButStringLength("Timeline");
128                 uiDefPulldownBut(block, dummy_viewmenu, sa, "Timeline", xco, yco, xmax-3, 22, "");
129                 xco+= xmax;
130                 
131                 xmax= GetButStringLength("Game");
132                 uiDefPulldownBut(block, dummy_viewmenu, sa, "Game",     xco, yco, xmax-3, 22, "");
133                 xco+= xmax;
134                 
135                 xmax= GetButStringLength("Render");
136                 uiDefPulldownBut(block, dummy_viewmenu, sa, "Render",   xco, yco, xmax-3, 22, "");
137                 xco+= xmax;
138                 
139                 xmax= GetButStringLength("Help");
140                 uiDefPulldownBut(block, dummy_viewmenu, NULL, "Help",   xco, yco, xmax-3, 22, "");
141                 xco+= xmax;
142                 
143                 
144                 
145         }
146         
147         uiBlockSetEmboss(block, UI_EMBOSS);
148
149         /* always as last  */
150         UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
151         
152         uiEndBlock(C, block);
153         uiDrawBlock(block);
154 }
155
156