• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
34 // more information.
35 //
36 // $hash=de3e738efca85a84422c92fa8504b24ed4efab8a$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_LABEL_BUTTON_CAPI_H_
40 #define CEF_INCLUDE_CAPI_VIEWS_CEF_LABEL_BUTTON_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_image_capi.h"
44 #include "include/capi/views/cef_button_capi.h"
45 #include "include/capi/views/cef_button_delegate_capi.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 struct _cef_menu_button_t;
52 
53 ///
54 // LabelButton is a button with optional text and/or icon. Methods must be
55 // called on the browser process UI thread unless otherwise indicated.
56 ///
57 typedef struct _cef_label_button_t {
58   ///
59   // Base structure.
60   ///
61   cef_button_t base;
62 
63   ///
64   // Returns this LabelButton as a MenuButton or NULL if this is not a
65   // MenuButton.
66   ///
67   struct _cef_menu_button_t*(CEF_CALLBACK* as_menu_button)(
68       struct _cef_label_button_t* self);
69 
70   ///
71   // Sets the text shown on the LabelButton. By default |text| will also be used
72   // as the accessible name.
73   ///
74   void(CEF_CALLBACK* set_text)(struct _cef_label_button_t* self,
75                                const cef_string_t* text);
76 
77   ///
78   // Returns the text shown on the LabelButton.
79   ///
80   // The resulting string must be freed by calling cef_string_userfree_free().
81   cef_string_userfree_t(CEF_CALLBACK* get_text)(
82       struct _cef_label_button_t* self);
83 
84   ///
85   // Sets the image shown for |button_state|. When this Button is drawn if no
86   // image exists for the current state then the image for
87   // CEF_BUTTON_STATE_NORMAL, if any, will be shown.
88   ///
89   void(CEF_CALLBACK* set_image)(struct _cef_label_button_t* self,
90                                 cef_button_state_t button_state,
91                                 struct _cef_image_t* image);
92 
93   ///
94   // Returns the image shown for |button_state|. If no image exists for that
95   // state then the image for CEF_BUTTON_STATE_NORMAL will be returned.
96   ///
97   struct _cef_image_t*(CEF_CALLBACK* get_image)(
98       struct _cef_label_button_t* self,
99       cef_button_state_t button_state);
100 
101   ///
102   // Sets the text color shown for the specified button |for_state| to |color|.
103   ///
104   void(CEF_CALLBACK* set_text_color)(struct _cef_label_button_t* self,
105                                      cef_button_state_t for_state,
106                                      cef_color_t color);
107 
108   ///
109   // Sets the text colors shown for the non-disabled states to |color|.
110   ///
111   void(CEF_CALLBACK* set_enabled_text_colors)(struct _cef_label_button_t* self,
112                                               cef_color_t color);
113 
114   ///
115   // Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>",
116   // where: - FONT_FAMILY_LIST is a comma-separated list of font family names, -
117   // STYLES is an optional space-separated list of style names (case-sensitive
118   //   "Bold" and "Italic" are supported), and
119   // - SIZE is an integer font size in pixels with the suffix "px".
120   //
121   // Here are examples of valid font description strings: - "Arial, Helvetica,
122   // Bold Italic 14px" - "Arial, 14px"
123   ///
124   void(CEF_CALLBACK* set_font_list)(struct _cef_label_button_t* self,
125                                     const cef_string_t* font_list);
126 
127   ///
128   // Sets the horizontal alignment; reversed in RTL. Default is
129   // CEF_HORIZONTAL_ALIGNMENT_CENTER.
130   ///
131   void(CEF_CALLBACK* set_horizontal_alignment)(
132       struct _cef_label_button_t* self,
133       cef_horizontal_alignment_t alignment);
134 
135   ///
136   // Reset the minimum size of this LabelButton to |size|.
137   ///
138   void(CEF_CALLBACK* set_minimum_size)(struct _cef_label_button_t* self,
139                                        const cef_size_t* size);
140 
141   ///
142   // Reset the maximum size of this LabelButton to |size|.
143   ///
144   void(CEF_CALLBACK* set_maximum_size)(struct _cef_label_button_t* self,
145                                        const cef_size_t* size);
146 } cef_label_button_t;
147 
148 ///
149 // Create a new LabelButton. A |delegate| must be provided to handle the button
150 // click. |text| will be shown on the LabelButton and used as the default
151 // accessible name.
152 ///
153 CEF_EXPORT cef_label_button_t* cef_label_button_create(
154     struct _cef_button_delegate_t* delegate,
155     const cef_string_t* text);
156 
157 #ifdef __cplusplus
158 }
159 #endif
160 
161 #endif  // CEF_INCLUDE_CAPI_VIEWS_CEF_LABEL_BUTTON_CAPI_H_
162