blender/intern/ghost/GHOST_C-api.h

930 lines
34 KiB
C
Raw Normal View History

/*
* ***** BEGIN GPL LICENSE BLOCK *****
2002-10-12 11:37:38 +00:00
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
2002-10-12 11:37:38 +00:00
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
2010-02-12 13:34:04 +00:00
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2002-10-12 11:37:38 +00:00
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
2002-10-12 11:37:38 +00:00
*/
/** \ingroup GHOST
*
* \file GHOST_C-api.h
* \brief GHOST C-API function and type declarations.
*/
2002-10-12 11:37:38 +00:00
2012-05-19 09:23:08 +00:00
#ifndef __GHOST_C_API_H__
#define __GHOST_C_API_H__
2002-10-12 11:37:38 +00:00
#include "GHOST_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Creates a "handle" for a C++ GHOST object.
* A handle is just an opaque pointer to an empty struct.
* In the API the pointer is casted to the actual C++ class.
* \param name Name of the handle to create.
*/
2002-10-12 11:37:38 +00:00
GHOST_DECLARE_HANDLE(GHOST_SystemHandle);
GHOST_DECLARE_HANDLE(GHOST_TimerTaskHandle);
GHOST_DECLARE_HANDLE(GHOST_WindowHandle);
GHOST_DECLARE_HANDLE(GHOST_EventHandle);
GHOST_DECLARE_HANDLE(GHOST_RectangleHandle);
GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle);
/**
* Definition of a callback routine that receives events.
* \param event The event received.
* \param userdata The callback's user data, supplied to GHOST_CreateSystem.
2002-10-12 11:37:38 +00:00
*/
typedef int (*GHOST_EventCallbackProcPtr)(GHOST_EventHandle event, GHOST_TUserDataPtr userdata);
/**
* Creates the one and only system.
* \return a handle to the system.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_SystemHandle GHOST_CreateSystem(void);
/**
* Disposes the one and only system.
* \param systemhandle The handle to the system
* \return An indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle);
/**
* Creates an event consumer object
* \param eventCallback The event callback routine.
* \param userdata Pointer to user data returned to the callback routine.
2002-10-12 11:37:38 +00:00
*/
2011-12-24 02:32:08 +00:00
extern GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
GHOST_TUserDataPtr userdata);
2002-10-12 11:37:38 +00:00
/**
* Disposes an event consumer object
* \param consumerhandle Handle to the event consumer.
* \return An indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle);
/**
* Returns the system time.
* Returns the number of milliseconds since the start of the system process.
* Based on ANSI clock() routine.
* \param systemhandle The handle to the system
* \return The number of milliseconds.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
/**
* Installs a timer.
* Note that, on most operating systems, messages need to be processed in order
* for the timer callbacks to be invoked.
* \param systemhandle The handle to the system
* \param delay The time to wait for the first call to the timerProc (in milliseconds)
* \param interval The interval between calls to the timerProc (in milliseconds)
* \param timerProc The callback invoked when the interval expires,
* \param userData Placeholder for user data.
* \return A timer task (0 if timer task installation failed).
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData);
2002-10-12 11:37:38 +00:00
/**
* Removes a timer.
* \param systemhandle The handle to the system
* \param timertaskhandle Timer task to be removed.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_TimerTaskHandle timertaskhandle);
2002-10-12 11:37:38 +00:00
/***************************************************************************************
2012-06-30 22:49:33 +00:00
* Display/window management functionality
***************************************************************************************/
2002-10-12 11:37:38 +00:00
/**
* Returns the number of displays on this system.
* \param systemhandle The handle to the system
* \return The number of displays.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
/**
* Returns the dimensions of the main display on this system.
* \param systemhandle The handle to the system
* \param width A pointer the width gets put in
* \param height A pointer the height gets put in
* \return void.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_TUns32 *width,
GHOST_TUns32 *height);
2002-10-12 11:37:38 +00:00
/**
* Returns the dimensions of all displays combine
* (the current workspace).
2014-08-16 00:51:07 +00:00
* No need to worry about overlapping monitors.
* \param systemhandle The handle to the system
* \param width A pointer the width gets put in
* \param height A pointer the height gets put in
* \return void.
*/
extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
GHOST_TUns32 *width,
GHOST_TUns32 *height);
2002-10-12 11:37:38 +00:00
/**
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
* \param systemhandle The handle to the system
* \param title The name of the window (displayed in the title bar of the window if the OS supports it).
* \param left The coordinate of the left edge of the window.
* \param top The coordinate of the top edge of the window.
* \param width The width the window.
* \param height The height the window.
* \param state The state of the window when opened.
* \param type The type of drawing context installed in this window.
* \param stereoVisual Stereo visual for quad buffered stereo.
* \param numOfAASamples Number of samples used for AA (zero if no AA)
* \return A handle to the new window ( == NULL if creation failed).
2002-10-12 11:37:38 +00:00
*/
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
const char *title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const int stereoVisual,
const GHOST_TUns16 numOfAASamples);
2002-10-12 11:37:38 +00:00
/**
* Returns the window user data.
* \param windowhandle The handle to the window
* \return The window user data.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle);
2002-10-12 11:37:38 +00:00
/**
* Changes the window user data.
* \param windowhandle The handle to the window
* \param userdata The window user data.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TUserDataPtr userdata);
2002-10-12 11:37:38 +00:00
/**
* Dispose a window.
* \param systemhandle The handle to the system
* \param windowhandle Handle to the window to be disposed.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_WindowHandle windowhandle);
2002-10-12 11:37:38 +00:00
/**
* Returns whether a window is valid.
* \param systemhandle The handle to the system
* \param windowhandle Handle to the window to be checked.
* \return Indication of validity.
2002-10-12 11:37:38 +00:00
*/
extern int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_WindowHandle windowhandle);
2002-10-12 11:37:38 +00:00
/**
* Begins full screen mode.
* \param systemhandle The handle to the system
* \param setting The new setting of the display.
* \param stereoVisual Option for stereo display.
* \return A handle to the window displayed in full screen.
* This window is invalid after full screen has been ended.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_DisplaySetting *setting,
const int stereoVisual);
2002-10-12 11:37:38 +00:00
/**
* Ends full screen mode.
* \param systemhandle The handle to the system
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle);
/**
* Returns current full screen mode status.
* \param systemhandle The handle to the system
* \return The current status.
2002-10-12 11:37:38 +00:00
*/
extern int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle);
/***************************************************************************************
2012-06-30 22:49:33 +00:00
* Event management functionality
***************************************************************************************/
2002-10-12 11:37:38 +00:00
/**
* Retrieves events from the system and stores them in the queue.
* \param systemhandle The handle to the system
* \param waitForEvent Boolean to indicate that ProcessEvents should
2002-10-12 11:37:38 +00:00
* wait (block) until the next event before returning.
* \return Indication of the presence of events.
2002-10-12 11:37:38 +00:00
*/
extern int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent);
/**
* Retrieves events from the queue and send them to the event consumers.
* \param systemhandle The handle to the system
* \return Indication of the presence of events.
2002-10-12 11:37:38 +00:00
*/
extern int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle);
/**
* Adds the given event consumer to our list.
* \param systemhandle The handle to the system
* \param consumerhandle The event consumer to add.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_EventConsumerHandle consumerhandle);
/**
* Remove the given event consumer to our list.
* \param systemhandle The handle to the system
* \param consumerhandle The event consumer to remove.
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_EventConsumerHandle consumerhandle);
/***************************************************************************************
2012-06-30 22:49:33 +00:00
* Progress bar functionality
***************************************************************************************/
/**
* Sets the progress bar value displayed in the window/application icon
* \param windowhandle The handle to the window
* \param progress The progress % (0.0 to 1.0)
*/
extern GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress);
2002-10-12 11:37:38 +00:00
/**
* Hides the progress bar in the icon
* \param windowhandle The handle to the window
*/
extern GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle);
2002-10-12 11:37:38 +00:00
/***************************************************************************************
2012-06-30 22:49:33 +00:00
* Cursor management functionality
***************************************************************************************/
2002-10-12 11:37:38 +00:00
/**
* Returns the current cursor shape.
* \param windowhandle The handle to the window
* \return The current cursor shape.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle);
/**
* Set the shape of the cursor.
* \param windowhandle The handle to the window
* \param cursorshape The new cursor shape type id.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TStandardCursor cursorshape);
2002-10-12 11:37:38 +00:00
/**
* Set the shape of the cursor to a custom cursor.
* \param windowhandle The handle to the window
* \param bitmap The bitmap data for the cursor.
* \param mask The mask data for the cursor.
* \param hotX The X coordinate of the cursor hotspot.
* \param hotY The Y coordinate of the cursor hotspot.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2],
int hotX,
int hotY);
/**
* Set the shape of the cursor to a custom cursor of specified size.
* \param windowhandle The handle to the window
* \param bitmap The bitmap data for the cursor.
* \param mask The mask data for the cursor.
* \param sizex The width of the cursor
* \param sizey The height of the cursor
* \param hotX The X coordinate of the cursor hotspot.
* \param hotY The Y coordinate of the cursor hotspot.
* \param fg_color, bg_color Colors of the cursor
* \return Indication of success.
2012-05-19 09:23:08 +00:00
*/
extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex, int sizey,
int hotX, int hotY,
int fg_color, int bg_color);
2002-10-12 11:37:38 +00:00
/**
* Returns the visibility state of the cursor.
* \param windowhandle The handle to the window
* \return The visibility state of the cursor.
2002-10-12 11:37:38 +00:00
*/
extern int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle);
/**
* Shows or hides the cursor.
* \param windowhandle The handle to the window
* \param visible The new visibility state of the cursor.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
int visible);
2002-10-12 11:37:38 +00:00
/**
* Returns the current location of the cursor (location in screen coordinates)
* \param systemhandle The handle to the system
* \param x The x-coordinate of the cursor.
* \param y The y-coordinate of the cursor.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 *x,
GHOST_TInt32 *y);
2002-10-12 11:37:38 +00:00
/**
* Updates the location of the cursor (location in screen coordinates).
* Not all operating systems allow the cursor to be moved (without the input device being moved).
* \param systemhandle The handle to the system
* \param x The x-coordinate of the cursor.
* \param y The y-coordinate of the cursor.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 x,
GHOST_TInt32 y);
2002-10-12 11:37:38 +00:00
/**
* Grabs the cursor for a modal operation, to keep receiving
* events when the mouse is outside the window. X11 only, others
* do this automatically.
* \param windowhandle The handle to the window
* \param mode The new grab state of the cursor.
2014-08-12 00:31:07 +00:00
* \param bounds The grab region (optional) - left,top,right,bottom
* \param mouse_ungrab_xy XY for new mouse location (optional) - x,y
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TGrabCursorMode mode,
int bounds[4], const int mouse_ungrab_xy[2]);
2002-10-12 11:37:38 +00:00
/***************************************************************************************
2012-06-30 22:49:33 +00:00
* Access to mouse button and keyboard states.
***************************************************************************************/
2002-10-12 11:37:38 +00:00
/**
* Returns the state of a modifier key (ouside the message queue).
* \param systemhandle The handle to the system
* \param mask The modifier key state to retrieve.
* \param isDown Pointer to return modifier state in.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_TModifierKeyMask mask,
int *isDown);
2002-10-12 11:37:38 +00:00
/**
* Returns the state of a mouse button (ouside the message queue).
* \param systemhandle The handle to the system
* \param mask The button state to retrieve.
* \param isDown Pointer to return button state in.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
2012-05-19 09:23:08 +00:00
GHOST_TButtonMask mask,
int *isDown);
2002-10-12 11:37:38 +00:00
/***************************************************************************************
2012-06-30 22:49:33 +00:00
* Drag'n'drop operations
***************************************************************************************/
/**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
*/
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept);
2002-10-12 11:37:38 +00:00
/**
* Returns the event type.
* \param eventhandle The handle to the event
* \return The event type.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle);
/**
* Returns the time this event was generated.
* \param eventhandle The handle to the event
* \return The event generation time.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle);
/**
* Returns the window this event was generated on,
* or NULL if it is a 'system' event.
* \param eventhandle The handle to the event
* \return The generating window.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle);
/**
* Returns the event data.
* \param eventhandle The handle to the event
* \return The event data.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle);
/**
* Returns the timer callback.
* \param timertaskhandle The handle to the timertask
* \return The timer callback.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle);
/**
* Changes the timer callback.
* \param timertaskhandle The handle to the timertask
* \param timerProc The timer callback.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
2012-05-19 09:23:08 +00:00
GHOST_TimerProcPtr timerProc);
2002-10-12 11:37:38 +00:00
/**
* Returns the timer user data.
* \param timertaskhandle The handle to the timertask
* \return The timer user data.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle);
2002-10-12 11:37:38 +00:00
/**
* Changes the time user data.
* \param timertaskhandle The handle to the timertask
* \param userdata The timer user data.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
GHOST_TUserDataPtr userdata);
2002-10-12 11:37:38 +00:00
/**
* Returns indication as to whether the window is valid.
* \param windowhandle The handle to the window
* \return The validity of the window.
2002-10-12 11:37:38 +00:00
*/
2012-02-27 10:35:39 +00:00
extern int GHOST_GetValid(GHOST_WindowHandle windowhandle);
2002-10-12 11:37:38 +00:00
/**
* Returns the type of drawing context used in this window.
* \param windowhandle The handle to the window
* \return The current type of drawing context.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle);
/**
* Tries to install a rendering context in this window.
* \param windowhandle The handle to the window
* \param type The type of rendering context installed.
* \return Indication as to whether installation has succeeded.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TDrawingContextType type);
2002-10-12 11:37:38 +00:00
/**
* Sets the title displayed in the title bar.
* \param windowhandle The handle to the window
* \param title The title to display in the title bar.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
const char *title);
2002-10-12 11:37:38 +00:00
/**
* Returns the title displayed in the title bar. The title
* should be free'd with free().
*
* \param windowhandle The handle to the window
* \return The title, free with free().
2002-10-12 11:37:38 +00:00
*/
2012-05-19 09:23:08 +00:00
extern char *GHOST_GetTitle(GHOST_WindowHandle windowhandle);
2002-10-12 11:37:38 +00:00
/**
* Returns the window rectangle dimensions.
* These are screen coordinates.
* \param windowhandle The handle to the window
* \return A handle to the bounding rectangle of the window.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle);
/**
* Returns the client rectangle dimensions.
* The left and top members of the rectangle are always zero.
* \param windowhandle The handle to the window
* \return A handle to the bounding rectangle of the window.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle);
/**
* Disposes a rectangle object
* \param rectanglehandle Handle to the rectangle.
2002-10-12 11:37:38 +00:00
*/
void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Resizes client rectangle width.
* \param windowhandle The handle to the window
* \param width The new width of the client area of the window.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TUns32 width);
2002-10-12 11:37:38 +00:00
/**
* Resizes client rectangle height.
* \param windowhandle The handle to the window
* \param height The new height of the client area of the window.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TUns32 height);
2002-10-12 11:37:38 +00:00
/**
* Resizes client rectangle.
* \param windowhandle The handle to the window
* \param width The new width of the client area of the window.
* \param height The new height of the client area of the window.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TUns32 width,
GHOST_TUns32 height);
2002-10-12 11:37:38 +00:00
/**
* Converts a point in screen coordinates to client rectangle coordinates
* \param windowhandle The handle to the window
* \param inX The x-coordinate on the screen.
* \param inY The y-coordinate on the screen.
* \param outX The x-coordinate in the client rectangle.
* \param outY The y-coordinate in the client rectangle.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
2002-10-12 11:37:38 +00:00
/**
* Converts a point in screen coordinates to client rectangle coordinates
* \param windowhandle The handle to the window
* \param inX The x-coordinate in the client rectangle.
* \param inY The y-coordinate in the client rectangle.
* \param outX The x-coordinate on the screen.
* \param outY The y-coordinate on the screen.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
2002-10-12 11:37:38 +00:00
/**
* Returns the state of the window (normal, minimized, maximized).
* \param windowhandle The handle to the window
* \return The state of the window.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle);
/**
* Sets the state of the window (normal, minimized, maximized).
* \param windowhandle The handle to the window
* \param state The state of the window.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TWindowState state);
2002-10-12 11:37:38 +00:00
/**
* Sets the window "modified" status, indicating unsaved changes
* \param windowhandle The handle to the window
* \param isUnsavedChanges Unsaved changes or not
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TUns8 isUnsavedChanges);
2002-10-12 11:37:38 +00:00
/**
* Sets the order of the window (bottom, top).
* \param windowhandle The handle to the window
* \param order The order of the window.
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
2012-05-19 09:23:08 +00:00
GHOST_TWindowOrder order);
2002-10-12 11:37:38 +00:00
/**
* Swaps front and back buffers of a window.
* \param windowhandle The handle to the window
* \return An intean success indicator.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle);
/**
* Sets the swap interval for swapBuffers.
* \param interval The swap interval to use.
* \return A boolean success indicator.
*/
extern GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int interval);
/**
* Gets the current swap interval for swapBuffers.
* \param windowhandle The handle to the window
* \param intervalOut pointer to location to return swap interval (left untouched if there is an error)
* \return A boolean success indicator of if swap interval was successfully read.
*/
extern GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int* intervalOut);
/**
* Gets the current swap interval for swapBuffers.
* \return Number of AA Samples (0 if there is no multisample buffer)
*/
extern GHOST_TUns16 GHOST_GetNumOfAASamples(GHOST_WindowHandle windowhandle);
2002-10-12 11:37:38 +00:00
/**
* Activates the drawing context of this window.
* \param windowhandle The handle to the window
* \return An intean success indicator.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle);
/**
* Invalidates the contents of this window.
* \param windowhandle The handle to the window
* \return Indication of success.
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle);
/**
* Returns the status of the tablet
* \param windowhandle The handle to the window
* \return Status of tablet
*/
extern const GHOST_TabletData *GHOST_GetTabletData(GHOST_WindowHandle windowhandle);
2002-10-12 11:37:38 +00:00
/**
* Access to rectangle width.
* \param rectanglehandle The handle to the rectangle
* \return width of the rectangle
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Access to rectangle height.
* \param rectanglehandle The handle to the rectangle
* \return height of the rectangle
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Gets all members of the rectangle.
* \param rectanglehandle The handle to the rectangle
* \param l Pointer to return left coordinate in.
* \param t Pointer to return top coordinate in.
* \param r Pointer to return right coordinate in.
* \param b Pointer to return bottom coordinate in.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 *l,
GHOST_TInt32 *t,
GHOST_TInt32 *r,
GHOST_TInt32 *b);
2002-10-12 11:37:38 +00:00
/**
* Sets all members of the rectangle.
* \param rectanglehandle The handle to the rectangle
* \param l requested left coordinate of the rectangle
* \param t requested top coordinate of the rectangle
* \param r requested right coordinate of the rectangle
* \param b requested bottom coordinate of the rectangle
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
GHOST_TInt32 b);
2002-10-12 11:37:38 +00:00
/**
* Returns whether this rectangle is empty.
* Empty rectangles are rectangles that have width==0 and/or height==0.
* \param rectanglehandle The handle to the rectangle
* \return intean value (true == empty rectangle)
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Returns whether this rectangle is valid.
2014-08-16 00:51:07 +00:00
* Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, empty rectangles are valid.
* \param rectanglehandle The handle to the rectangle
* \return intean value (true == valid rectangle)
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Grows (or shrinks the rectangle).
* The method avoids negative insets making the rectangle invalid
* \param rectanglehandle The handle to the rectangle
* \param i The amount of offset given to each extreme (negative values shrink the rectangle).
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 i);
2002-10-12 11:37:38 +00:00
/**
* Does a union of the rectangle given and this rectangle.
* The result is stored in this rectangle.
* \param rectanglehandle The handle to the rectangle
* \param anotherrectanglehandle The rectangle that is input for the union operation.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_RectangleHandle anotherrectanglehandle);
2002-10-12 11:37:38 +00:00
/**
* Grows the rectangle to included a point.
* \param rectanglehandle The handle to the rectangle
* \param x The x-coordinate of the point.
* \param y The y-coordinate of the point.
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 x,
GHOST_TInt32 y);
2002-10-12 11:37:38 +00:00
/**
* Returns whether the point is inside this rectangle.
* Point on the boundary is considered inside.
* \param rectanglehandle The handle to the rectangle
* \param x x-coordinate of point to test.
* \param y y-coordinate of point to test.
* \return intean value (true if point is inside).
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 x,
GHOST_TInt32 y);
2002-10-12 11:37:38 +00:00
/**
* Returns whether the rectangle is inside this rectangle.
* \param rectanglehandle The handle to the rectangle
* \param anotherrectanglehandle The rectangle to test.
* \return visibility (not, partially or fully visible).
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_RectangleHandle anotherrectanglehandle);
2002-10-12 11:37:38 +00:00
/**
* Sets rectangle members.
* Sets rectangle members such that it is centered at the given location.
* \param rectanglehandle The handle to the rectangle
* \param cx Requested center x-coordinate of the rectangle
* \param cy Requested center y-coordinate of the rectangle
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 cx,
GHOST_TInt32 cy);
2002-10-12 11:37:38 +00:00
/**
* Sets rectangle members.
* Sets rectangle members such that it is centered at the given location,
* with the width requested.
* \param rectanglehandle The handle to the rectangle
* \param cx requested center x-coordinate of the rectangle
* \param cy requested center y-coordinate of the rectangle
* \param w requested width of the rectangle
* \param h requested height of the rectangle
2002-10-12 11:37:38 +00:00
*/
extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
GHOST_TInt32 h);
2002-10-12 11:37:38 +00:00
/**
* Clips a rectangle.
* Updates the rectangle given such that it will fit within this one.
* This can result in an empty rectangle.
* \param rectanglehandle The handle to the rectangle
* \param anotherrectanglehandle The rectangle to clip
* \return Whether clipping has occurred
2002-10-12 11:37:38 +00:00
*/
extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
2012-05-19 09:23:08 +00:00
GHOST_RectangleHandle anotherrectanglehandle);
/**
2014-08-16 00:51:07 +00:00
* Return the data from the clipboard
* \param selection Boolean to return the selection instead, X11 only feature.
* \return clipboard data
*/
2012-05-19 09:23:08 +00:00
extern GHOST_TUns8 *GHOST_getClipboard(int selection);
/**
* Put data to the Clipboard
* \param buffer the string buffer to set.
* \param selection Set the selection instead, X11 only feature.
*/
2.5: Text Editor back. There was very little structure in this code, using many globals and duplicated code. Now it should be better structured. Most things should work, the main parts that are not back yet are the python plugins and markers. Notes: * Blenfont is used for drawing the text, nicely anti-aliased. * A monospace truetype font was added, since that is needed for the text editor. It's Bitstream Vera Sans Mono. This is the default gnome terminal font, but it doesn't fit entirely well with the other font I think, can be changed easily of course. * Clipboard copy/cut/paste now always uses the system clipboard, the code for the own cut buffer was removed. * The interface buttons should support copy/cut/paste again now as well. * WM_clipboard_text_get/WM_clipboard_text_set were added to the windowmanager code. * Find panel is now a kind of second header, instead of a panel. This needs especially a way to start editing the text field immediately on open still. * Operators are independent of the actual space when possible, was a bit of puzzling but got it solved nice with notifiers, and some lazy init for syntax highlight in the drawing code. * RNA was created for the text editor space and used for buttons. * Operators: * New, Open, Reload, Save, Save As, Make Internal * Run Script, Refresh Pyconstraints * Copy, Cut, Paste * Convert Whitespace, Uncomment, Comment, Indent, Unindent * Line Break, Insert * Next Marker, Previous Marker, Clear All Markers, Mark All * Select Line, Select All * Jump, Move, Move Select, Delete, Toggle Overwrite * Scroll, Scroll Bar, Set Cursor, Line Number * Find and Replace, Find, Replace, Find Set Selected, Replace Set Selected * To 3D Object * Resolve Conflict
2009-02-28 23:33:35 +00:00
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
/**
* Toggles console
* \param action
* - 0: Hides
* - 1: Shows
* - 2: Toggles
* - 3: Hides if it runs not from command line
* - *: Does nothing
* \return current status (1 -visible, 0 - hidden)
*/
extern int GHOST_toggleConsole(int action);
/**
* Confirms quitting he program when there is just one window left open
* in the application
*/
extern int GHOST_confirmQuit(GHOST_WindowHandle windowhandle);
Holiday coding log :) Nice formatted version (pictures soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability Short list of main changes: - Transparent region option (over main region), added code to blend in/out such panels. - Min size window now 640 x 480 - Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake. - Macbook retina support, use command line --no-native-pixels to disable it - Timeline Marker label was drawing wrong - Trackpad and magic mouse: supports zoom (hold ctrl) - Fix for splash position: removed ghost function and made window size update after creation immediate - Fast undo buffer save now adds UI as well. Could be checked for regular file save even... Quit.blend and temp file saving use this now. - Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)" - New Userpref option "Keep Session" - this always saves quit.blend, and loads on start. This allows keeping UI and data without actual saves, until you actually save. When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header) - Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v). Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards. - User preferences (themes, keymaps, user settings) now can be saved as a separate file. Old option is called "Save Startup File" the new one "Save User Settings". To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still. - OSX: fixed bug that stopped giving mouse events outside window. This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
/**
* Use native pixel size (MacBook pro 'retina'), if supported.
*/
extern int GHOST_UseNativePixels(void);
/**
* If window was opened using native pixel size, it returns scaling factor.
*/
extern float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle);
Holiday coding log :) Nice formatted version (pictures soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability Short list of main changes: - Transparent region option (over main region), added code to blend in/out such panels. - Min size window now 640 x 480 - Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake. - Macbook retina support, use command line --no-native-pixels to disable it - Timeline Marker label was drawing wrong - Trackpad and magic mouse: supports zoom (hold ctrl) - Fix for splash position: removed ghost function and made window size update after creation immediate - Fast undo buffer save now adds UI as well. Could be checked for regular file save even... Quit.blend and temp file saving use this now. - Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)" - New Userpref option "Keep Session" - this always saves quit.blend, and loads on start. This allows keeping UI and data without actual saves, until you actually save. When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header) - Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v). Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards. - User preferences (themes, keymaps, user settings) now can be saved as a separate file. Old option is called "Save Startup File" the new one "Save User Settings". To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still. - OSX: fixed bug that stopped giving mouse events outside window. This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
/**
* Enable IME attached to the given window, i.e. allows user-input
* events to be dispatched to the IME.
* \param windowhandle Window handle of the caller
* \param x Requested x-coordinate of the rectangle
* \param y Requested y-coordinate of the rectangle
* \param w Requested width of the rectangle
* \param h Requested height of the rectangle
* \param complete Whether or not to complete the ongoing composition
* true: Start a new composition
* false: Move the IME windows to the given position without finishing it.
*/
extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 w,
GHOST_TInt32 h,
int complete);
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input
* events from being dispatched to the IME.
* \param windowhandle The window handle of the caller
*/
extern void GHOST_EndIME(GHOST_WindowHandle windowhandle);
2002-10-12 11:37:38 +00:00
#ifdef __cplusplus
}
#endif
#endif