shumate/shumate-vector-value-private.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Copyright (C) 2021 James Westman <james@jwestman.net> | ||
| 3 | * | ||
| 4 | * This library is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU Lesser General Public | ||
| 6 | * License as published by the Free Software Foundation; either | ||
| 7 | * version 2.1 of the License, or (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This library is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * Lesser General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU Lesser General Public | ||
| 15 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | #include <gtk/gtk.h> | ||
| 21 | #include <json-glib/json-glib.h> | ||
| 22 | |||
| 23 | #include "shumate-vector-sprite.h" | ||
| 24 | #include "shumate-vector-value.h" | ||
| 25 | |||
| 26 | #define SHUMATE_VECTOR_COLOR_BLACK ((GdkRGBA) {.red=0, .green=0, .blue=0, .alpha=1}) | ||
| 27 | |||
| 28 | |||
| 29 | typedef struct { | ||
| 30 | GdkRGBA text_color; | ||
| 31 | char *string; | ||
| 32 | ShumateVectorSprite *sprite; | ||
| 33 | double font_scale; | ||
| 34 | gboolean has_text_color : 1; | ||
| 35 | gboolean has_font_scale : 1; | ||
| 36 | } ShumateVectorFormatPart; | ||
| 37 | |||
| 38 | typedef struct { | ||
| 39 | guint8 case_sensitive : 1; | ||
| 40 | } ShumateVectorCollator; | ||
| 41 | |||
| 42 | struct _ShumateVectorValue { | ||
| 43 | ShumateVectorValueType type; | ||
| 44 | |||
| 45 | union { | ||
| 46 | double number; | ||
| 47 | gboolean boolean; | ||
| 48 | struct { | ||
| 49 | char *string; | ||
| 50 | GdkRGBA color; | ||
| 51 | int color_state; | ||
| 52 | }; | ||
| 53 | GPtrArray *array; | ||
| 54 | struct { | ||
| 55 | ShumateVectorSprite *image; | ||
| 56 | char *image_name; | ||
| 57 | }; | ||
| 58 | GPtrArray *formatted_string; | ||
| 59 | ShumateVectorCollator collator; | ||
| 60 | }; | ||
| 61 | }; | ||
| 62 | |||
| 63 | #define SHUMATE_VECTOR_VALUE_INIT ((ShumateVectorValue) {.type = 0}) | ||
| 64 | |||
| 65 | gboolean shumate_vector_value_set_from_g_value (ShumateVectorValue *self, const GValue *value); | ||
| 66 | gboolean shumate_vector_value_set_from_json_literal (ShumateVectorValue *self, JsonNode *node, GError **error); | ||
| 67 | |||
| 68 | void shumate_vector_value_free (ShumateVectorValue *self); | ||
| 69 | void shumate_vector_value_copy (ShumateVectorValue *self, ShumateVectorValue *out); | ||
| 70 | void shumate_vector_value_steal (ShumateVectorValue *self, ShumateVectorValue *out); | ||
| 71 | |||
| 72 | 3952 | G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (ShumateVectorValue, shumate_vector_value_unset) | |
| 73 | |||
| 74 | GPtrArray *shumate_vector_value_get_array (ShumateVectorValue *self); | ||
| 75 | |||
| 76 | void shumate_vector_value_set_image (ShumateVectorValue *self, ShumateVectorSprite *image, const char *image_name); | ||
| 77 | gboolean shumate_vector_value_get_image (ShumateVectorValue *self, ShumateVectorSprite **image); | ||
| 78 | |||
| 79 | void shumate_vector_value_set_formatted (ShumateVectorValue *self, GPtrArray *format_parts); | ||
| 80 | gboolean shumate_vector_value_get_formatted (ShumateVectorValue *self, GPtrArray **format_parts); | ||
| 81 | void shumate_vector_format_part_free (ShumateVectorFormatPart *self); | ||
| 82 |
2/6✗ Branch 466 → 467 not taken.
✗ Branch 466 → 474 not taken.
✓ Branch 468 → 469 taken 2 times.
✗ Branch 468 → 470 not taken.
✓ Branch 474 → 475 taken 2 times.
✗ Branch 474 → 643 not taken.
|
12 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ShumateVectorFormatPart, shumate_vector_format_part_free) |
| 83 | |||
| 84 | void shumate_vector_value_set_collator (ShumateVectorValue *self, ShumateVectorCollator *collator); | ||
| 85 | gboolean shumate_vector_value_get_collator (ShumateVectorValue *self, ShumateVectorCollator *collator); | ||
| 86 | |||
| 87 | char *shumate_vector_value_as_string (ShumateVectorValue *self); | ||
| 88 |