You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

240 lines
3.6 KiB

//! GHOST_Types.h
use super::*;
use libc::{
c_int,
};
use std::{
marker::{
PhantomData,
},
};
/// Trait for opaque types that represent GHOST handles
/// API maps vaguely to `GHOST_DECLARE_HANDLE`.
pub trait GhostHandle{}
/// Opaque handle type for GHOST C++ object.
#[repr(C)]
pub struct Handle<T>(c_int, PhantomData<T>)
where T: GhostHandle;
pub type GHOST_TInt8 = libc::c_char;
pub type GHOST_TUns8 = libc::c_uchar;
pub type GHOST_TUns16 = libc::c_ushort;
pub type GHOST_TInt32 = libc::c_int;
pub type GHOST_TUns32 = libc::c_uint;
// -- skip MSVC specific shit. I'm not testing on that
pub type GHOST_TInt64 = libc::c_longlong;
pub type GHOST_TUns64 = libc::c_ulonglong;
pub type GHOST_TUserDataPtr = PVoidMut;
#[repr(C)]
pub struct GHOST_GLSettings
{
pub flags: c_int,
}
#[repr(C)]
pub enum GHOST_GLFlags
{
StereoVisual = 1<<0,
DebugContext = 1<<1,
AlphaBackground = 1<<2,
}
#[repr(C)]
pub enum GHOST_DialogOptions
{
DialogWarning = 1<<0,
DialogError = 1<<1,
}
pub type DialogOptions = GHOST_DialogOptions;
#[repr(C)]
pub enum GHOST_TSuccess
{
Failure = 0,
Success,
}
#[repr(C)]
pub enum GHOST_TTabletMode
{
None = 0,
Stylus,
Eraser,
}
impl Default for GHOST_TTabletMode
{
#[inline]
fn default() -> Self
{
Self::None
}
}
#[repr(C)]
pub enum GHOST_TTabletAPI
{
None = 0,
Native,
Wintab,
}
impl Default for GHOST_TTabletAPI
{
#[inline]
fn default() -> Self
{
Self::None
}
}
#[repr(C)]
pub struct GHOST_TabletData
{
pub active: GHOST_TTabletMode,
pub pressure: f32,
pub xtilt: f32,
pub ytilt: f32,
}
impl GHOST_TabletData
{
pub const fn none() -> Self{
Self{active: GHOST_TTabletMode::None, pressure: 1.0, xtilt: 0.0, ytilt: 0.0}
}
}
impl Default for GHOST_TabletData
{
#[inline] fn default() -> Self
{
Self::none()
}
}
#[repr(C)]
pub enum GHOST_TVisibility
{
Not =0,
Partially,
Fully,
}
impl Default for GHOST_TVisibility
{
#[inline]
fn default() -> Self
{
Self::Not
}
}
#[repr(C)]
pub enum GHOST_TFireTimeConstant
{
Never = 0xFFFFFFFF,
}
#[repr(C)]
pub enum GHOST_TModifierKeyMask {
LeftShift = 0,
RightShift,
LeftAlt,
RightAlt,
LeftControl,
RightControl,
OS,
NumMasks
}
#[repr(C)]
pub enum GHOST_TWindowState {
Normal = 0,
Maximized,
Minimized,
FullScreen,
Embedded,
// Modified,
// UnModified,
}
#[repr(C)]
pub enum GHOST_TWindowOrder
{
Top =0,
Bottom,
}
#[repr(C)]
pub enum GHOST_TDrawingContextType {
None = 0,
OpenGL,
//D3D, //lol nope
}
#[repr(C)]
pub enum GHOST_TButtonMask{
Left = 0,
Middle,
Right,
Button4,
Button5,
/* Trackballs and programmable buttons */
Button6,
Button7,
NumMasks // Should we even keep this? I guess yeah for ABI compatability
}
#[repr(C)]
pub enum GHOST_TEventType {
Unknown = 0,
CursorMove,
ButtonDown,
ButtonUp,
Wheel,
Trackpad,
//#ifdef WITH_INPUT_NDOF
// NDOFMotion, /// N degree of freedom device motion event
// NDOFButton, /// N degree of freedom device button event
//#endif
KeyDown,
KeyUp,
// KeyAuto,
QuitRequest,
WindowClose,
WindowActivate,
WindowDeactivate,
WindowUpdate,
WindowSize,
WindowMove,
WindowDPIHintChanged,
DraggingEntered,
DraggingUpdated,
DraggingExited,
DraggingDropDone,
OpenMainFile, // Needed for Cocoa to open double-clicked .blend file at startup
NativeResolutionChange, // Needed for Cocoa when window moves to other display
Timer,
ImeCompositionStart,
ImeComposition,
ImeCompositionEnd,
NumEventTypes
}