1 /* 2 * Copyright © 2014 Red Hat, Inc. All rights reserved. 3 * Copyright © 2014 Ding-Yi Chen <dchen@redhat.com> 4 * 5 * This file is part of the ibus-chewing Project. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 */ 21 22 /** 23 * SECTION:MakerDialogPropertySpec 24 * @short_description: A MakerDialog property spec defines the characteristics of a property. 25 * @title: MakerDialog Property 26 * @stability: Stable 27 * @include: MakerDailogPropertySpec.h 28 * 29 * A MakerDialog property spec defines the characteristics of a property, 30 * including value type, display names, default value, and valid values. 31 */ 32 33 #ifndef _MAKER_DIALOG_PROPERTY_SPEC_H_ 34 #define _MAKER_DIALOG_PROPERTY_SPEC_H_ 35 #include <glib.h> 36 #include <glib-object.h> 37 38 /** 39 * MkdgPropertyFlags: 40 * @MKDG_PROPERTY_FLAG_INVISIBLE: The property is not visible in UI. 41 * @MKDG_PROPERTY_FLAG_INSENSITIVE: The property is gray-out and not editable. 42 * @MKDG_PROPERTY_FLAG_NO_NEW: The property does not accept new values. 43 * @MKDG_PROPERTY_FLAG_HAS_TRANSLATION: The property should show translated value. 44 * @MKDG_PROPERTY_FLAG_NO_BACKEND: The property has no backend, thus will not be saved. 45 * 46 * MakerDialog flag controls how the property displayed in UI. 47 */ 48 typedef enum { 49 MKDG_PROPERTY_FLAG_INVISIBLE = 1, 50 MKDG_PROPERTY_FLAG_INSENSITIVE = 1 << 1, 51 MKDG_PROPERTY_FLAG_NO_NEW = 1 << 2, 52 MKDG_PROPERTY_FLAG_HAS_TRANSLATION = 1 << 3, 53 MKDG_PROPERTY_FLAG_NO_BACKEND = 1 << 4 54 } MkdgPropertyFlags; 55 56 typedef struct _PropertyContext PropertyContext; 57 58 typedef gboolean(*MkdgApplyFunc) (PropertyContext * ctx, gpointer userData); 59 60 /** 61 * MkdgPropertySpec: 62 * @valueType: Type of the value. 63 * @key: A unique Property ID. 64 * @pageName: The name of the tab that contain this property (Translatable). 65 * @label: Label in UI (Translatable). 66 * @subSection: Sub-section in backend. 67 * @defaultValue: String represented string value. 68 * @validValues: NULL terminated valid values. 69 * @min: Minimum valid value for numeric types. 70 * @max: Maximum valid value for numeric types. 71 * @applyFunc: Callback function for apply the value. 72 * @propertyFlags: Property Flags. 73 * @tooltip: Tooltip of this property (Translatable). 74 * @auxData: Auxiliary data that might be needed somewhere. 75 * 76 * A Property Spec describe the characteristic of a property. 77 */ 78 79 typedef struct { 80 GType valueType; 81 gchar key[30]; 82 gchar pageName[50]; 83 gchar label[200]; 84 gchar subSection[200]; 85 gchar defaultValue[100]; 86 const gchar **validValues; 87 gchar *translationContext; 88 89 gint min; 90 gint max; 91 92 MkdgApplyFunc applyFunc; 93 94 MkdgPropertyFlags propertyFlags; 95 const gchar *tooltip; 96 gpointer auxData; 97 } MkdgPropertySpec; 98 99 #endif /* _MAKER_DIALOG_PROPERTY_SPEC_H_ */ 100