Blender V2.61 - r43446

rna_text_api.c

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * Contributor(s): Campbell Barton
00019  *
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00028 #include <stdlib.h>
00029 #include <stdio.h>
00030 
00031 #include "RNA_define.h"
00032 
00033 #ifdef RNA_RUNTIME
00034 
00035 #include "WM_api.h"
00036 #include "WM_types.h"
00037 
00038 static void rna_Text_clear(Text *text)
00039 {
00040     clear_text(text);
00041     WM_main_add_notifier(NC_TEXT|NA_EDITED, text);
00042 }
00043 
00044 static void rna_Text_write(Text *text, const char *str)
00045 {
00046     write_text(text, str);
00047     WM_main_add_notifier(NC_TEXT|NA_EDITED, text);
00048 }
00049 
00050 #else
00051 
00052 void RNA_api_text(StructRNA *srna)
00053 {
00054     FunctionRNA *func;
00055     PropertyRNA *prop;
00056 
00057     func= RNA_def_function(srna, "clear", "rna_Text_clear");
00058     RNA_def_function_ui_description(func, "clear the text block");
00059 
00060     func= RNA_def_function(srna, "write", "rna_Text_write");
00061     RNA_def_function_ui_description(func, "write text at the cursor location and advance to the end of the text block");
00062     prop= RNA_def_string(func, "text", "Text", 0, "", "New text for this datablock");
00063     RNA_def_property_flag(prop, PROP_REQUIRED);
00064 }
00065 
00066 #endif