pebble_rust/pebble/internal/
types.rs

1/*
2 * Copyright (c) 2019, Andrew Foote. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6    * Redistributions of source code must retain the above copyright
7      notice, this list of conditions and the following disclaimer.
8    * Redistributions in binary form must reproduce the above copyright
9      notice, this list of conditions and the following disclaimer in the
10      documentation and/or other materials provided with the distribution.
11    * Neither the name of the copyright holder nor the
12      names of its contributors may be used to endorse or promote products
13      derived from this software without specific prior written permission.
14
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*/
26
27#![allow(non_camel_case_types)]
28
29pub enum Window {}
30pub enum Layer {}
31pub enum TextLayer {}
32pub enum ClickRecognizer {}
33pub enum GBitmap {}
34pub enum GContext {}
35pub enum BitmapLayer {}
36
37#[repr(C)]
38pub struct tm {
39    pub tm_sec: u32,
40    pub tm_min: u32,
41    pub tm_hour: u32,
42    pub tm_mday: u32,
43    pub tm_mon: u32,
44    pub tm_year: u32,
45    pub tm_wday: u32,
46    pub tm_yday: u32,
47    pub tm_isdst: u32
48}
49
50#[derive(Copy, Clone)]
51#[repr(C)]
52pub struct GPoint {
53    pub x: u16,
54    pub y: u16,
55}
56
57#[derive(Copy, Clone)]
58#[repr(C)]
59pub struct GSize {
60    pub w: u16,
61    pub h: u16,
62}
63
64#[derive(Copy, Clone)]
65#[repr(C)]
66pub struct GRect {
67    pub origin: GPoint,
68    pub size: GSize,
69}
70
71#[repr(C)]
72pub struct WindowHandlers {
73    pub load: extern fn(*mut Window),
74    pub appear: extern fn(*mut Window),
75    pub disappear: extern fn(*mut Window),
76    pub unload: extern fn(*mut Window),
77}
78
79#[repr(C)]
80pub enum GCompOp {
81    GCompOpAssign,
82    GCompOpAssignInverted,
83    GCompOpOr,
84    GCompOpAnd,
85    GCompOpClear,
86    GCompOpSet
87}
88
89#[repr(C)]
90pub enum GColor {
91    GColorClear = -1,
92    GColorBlack = 0,
93    GColorWhite = 1
94}
95
96#[repr(C)]
97pub enum TimeUnits {
98    SECOND_UNIT=1,
99    MINUTE_UNIT,
100    HOUR_UNIT,
101    DAY_UNIT,
102    MONTH_UNIT,
103    YEAR_UNIT
104}
105
106#[allow(non_camel_case_types)]
107#[repr(u8)]
108pub enum c_void {
109    __variant1,
110    __variant2,
111}
112
113#[allow(non_camel_case_types)]
114pub type c_char = u8;