Blender  V2.59
sound_header.c
Go to the documentation of this file.
00001 /*
00002  * $Id: sound_header.c 37185 2011-06-04 17:03:46Z ton $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version. 
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2008 Blender Foundation.
00021  * All rights reserved.
00022  *
00023  * 
00024  * Contributor(s): Blender Foundation
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00034 #include <string.h>
00035 #include <stdio.h>
00036 
00037 
00038 #include "MEM_guardedalloc.h"
00039 
00040 #include "BLI_blenlib.h"
00041 #include "BLI_utildefines.h"
00042 
00043 
00044 #include "BKE_context.h"
00045 
00046 #include "ED_screen.h"
00047 #include "ED_types.h"
00048 #include "ED_util.h"
00049 
00050 #include "BIF_gl.h"
00051 #include "BIF_glutil.h"
00052 
00053 #include "UI_interface.h"
00054 #include "UI_resources.h"
00055 #include "UI_view2d.h"
00056 
00057 #include "sound_intern.h"
00058 
00059 
00060 /* ************************ header area region *********************** */
00061 
00062 static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
00063 {
00064         
00065 }
00066 
00067 static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg))
00068 {
00069         ScrArea *curarea= CTX_wm_area(C);
00070         uiBlock *block;
00071         short yco= 0, menuwidth=120;
00072         
00073         block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP);
00074         uiBlockSetButmFunc(block, do_viewmenu, NULL);
00075         
00076         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, 
00077                                          menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
00078         
00079         if(curarea->headertype==HEADERTOP) {
00080                 uiBlockSetDirection(block, UI_DOWN);
00081         }
00082         else {
00083                 uiBlockSetDirection(block, UI_TOP);
00084                 uiBlockFlipOrder(block);
00085         }
00086         
00087         uiTextBoundsBlock(block, 50);
00088         uiEndBlock(C, block);
00089         
00090         return block;
00091 }
00092 
00093 static void do_sound_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event)
00094 {
00095         switch(event) {
00096         }
00097 }
00098 
00099 
00100 void sound_header_buttons(const bContext *C, ARegion *ar)
00101 {
00102         ScrArea *sa= CTX_wm_area(C);
00103         uiBlock *block;
00104         int xco, yco= 3;
00105         
00106         block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
00107         uiBlockSetHandleFunc(block, do_sound_buttons, NULL);
00108         
00109         xco= ED_area_header_standardbuttons(C, block, yco);
00110         
00111         if((sa->flag & HEADER_NO_PULLDOWN)==0) {
00112                 int xmax;
00113                 
00114                 xmax= GetButStringLength("View");
00115                 uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C), 
00116                                                  "View", xco, yco-2, xmax-3, UI_UNIT_Y, "");
00117                 xco+=UI_UNIT_X+xmax;
00118         }
00119         
00120         uiBlockSetEmboss(block, UI_EMBOSS);
00121 
00122         /* always as last  */
00123         UI_view2d_totRect_set(&ar->v2d, xco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
00124         
00125         uiEndBlock(C, block);
00126         uiDrawBlock(C, block);
00127 }
00128 
00129