Blender  V2.59
BKE_suggestions.h
Go to the documentation of this file.
00001 /*      
00002  * $Id: BKE_suggestions.h 34962 2011-02-18 13:05:18Z jesterking $ 
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  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 #ifndef BKE_SUGGESTIONS_H
00030 #define BKE_SUGGESTIONS_H
00031 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 /* ****************************************************************************
00041 Suggestions should be added in sorted order although a linear sorting method is
00042 implemented. The list is then divided up based on the prefix provided by
00043 update_suggestions:
00044 
00045 Example:
00046   Prefix: ab
00047   aaa <-- first
00048   aab
00049   aba <-- firstmatch
00050   abb <-- lastmatch
00051   baa
00052   bab <-- last
00053 **************************************************************************** */
00054 
00055 struct Text;
00056 
00057 typedef struct SuggItem {
00058         struct SuggItem *prev, *next;
00059         char *name;
00060         char type;
00061 } SuggItem;
00062 
00063 typedef struct SuggList {
00064         SuggItem *first, *last;
00065         SuggItem *firstmatch, *lastmatch;
00066         SuggItem *selected;
00067         int top;
00068 } SuggList;
00069 
00070 /* Free all text tool memory */
00071 void free_texttools(void);
00072 
00073 /* Used to identify which Text object the current tools should appear against */
00074 void texttool_text_set_active(Text *text);
00075 void texttool_text_clear(void);
00076 short texttool_text_is_active(Text *text);
00077 
00078 /* Suggestions */
00079 void texttool_suggest_add(const char *name, char type);
00080 void texttool_suggest_prefix(const char *prefix);
00081 void texttool_suggest_clear(void);
00082 SuggItem *texttool_suggest_first(void);
00083 SuggItem *texttool_suggest_last(void);
00084 void texttool_suggest_select(SuggItem *sel);
00085 SuggItem *texttool_suggest_selected(void);
00086 int *texttool_suggest_top(void);
00087 
00088 /* Documentation */
00089 void texttool_docs_show(const char *docs);
00090 char *texttool_docs_get(void);
00091 void texttool_docs_clear(void);
00092 
00093 #ifdef __cplusplus
00094 }
00095 #endif
00096 
00097 #endif