From: Mikko Rasa Date: Wed, 4 Jan 2023 12:29:08 +0000 (+0200) Subject: Add decorations for things which should be exported from the library X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=d7686e3867e3c68cec0d3767a21f9d2408383085;p=libs%2Fgui.git Add decorations for things which should be exported from the library --- diff --git a/source/graphics/bmploader.h b/source/graphics/bmploader.h index 926516d..5f8ad0a 100644 --- a/source/graphics/bmploader.h +++ b/source/graphics/bmploader.h @@ -2,11 +2,12 @@ #define MSP_GRAPHICS_BMPLOADER_H_ #include +#include "mspgui_api.h" namespace Msp { namespace Graphics { -class BmpLoader: public ImageLoader +class MSPGUI_API BmpLoader: public ImageLoader { private: IO::Base &io; diff --git a/source/graphics/devil/devilloader.h b/source/graphics/devil/devilloader.h index beab02f..8740813 100644 --- a/source/graphics/devil/devilloader.h +++ b/source/graphics/devil/devilloader.h @@ -2,11 +2,12 @@ #define MSP_GRAPHICS_DEVILLOADER_H_ #include +#include namespace Msp { namespace Graphics { -class DevilLoader: public ImageLoader +class MSPGUI_API DevilLoader: public ImageLoader { private: IO::Base &io; diff --git a/source/graphics/display.h b/source/graphics/display.h index 23ab571..5f84848 100644 --- a/source/graphics/display.h +++ b/source/graphics/display.h @@ -7,6 +7,7 @@ #include #include "errordialog.h" #include "monitor.h" +#include "mspgui_api.h" #include "videomode.h" namespace Msp { @@ -14,7 +15,7 @@ namespace Graphics { class Window; -class Display +class MSPGUI_API Display { public: struct Private; diff --git a/source/graphics/glcontext.h b/source/graphics/glcontext.h index ef374c1..38c36b1 100644 --- a/source/graphics/glcontext.h +++ b/source/graphics/glcontext.h @@ -2,6 +2,7 @@ #define MSP_GRAPHICS_GLCONTEXT_H_ #include +#include "mspgui_api.h" namespace Msp { namespace Graphics { @@ -25,7 +26,7 @@ struct GLOptions }; -class unsupported_gl_mode: public std::runtime_error +class MSPGUI_API unsupported_gl_mode: public std::runtime_error { public: unsupported_gl_mode(const GLOptions &); @@ -35,7 +36,7 @@ private: }; -class GLContext +class MSPGUI_API GLContext { private: struct Private; diff --git a/source/graphics/image.h b/source/graphics/image.h index 3f8f556..15685c6 100644 --- a/source/graphics/image.h +++ b/source/graphics/image.h @@ -4,6 +4,7 @@ #include #include #include +#include "mspgui_api.h" #include "pixelformat.h" namespace Msp { @@ -11,7 +12,7 @@ namespace Graphics { class ImageLoader; -class Image +class MSPGUI_API Image { public: struct Data diff --git a/source/graphics/imageloader.h b/source/graphics/imageloader.h index 64a7410..345068c 100644 --- a/source/graphics/imageloader.h +++ b/source/graphics/imageloader.h @@ -2,24 +2,25 @@ #define MSP_GRAPHICS_IMAGELOADER_H_ #include "image.h" +#include "mspgui_api.h" namespace Msp { namespace Graphics { -class unsupported_image_format: public std::runtime_error +class MSPGUI_API unsupported_image_format: public std::runtime_error { public: unsupported_image_format(const std::string &w): std::runtime_error(w) { } }; -class bad_image_data: public std::runtime_error +class MSPGUI_API bad_image_data: public std::runtime_error { public: bad_image_data(const std::string &w): std::runtime_error(w) { } }; -class ImageLoader +class MSPGUI_API ImageLoader { public: enum State diff --git a/source/graphics/jpeg/jpegloader.h b/source/graphics/jpeg/jpegloader.h index 88dc00c..765183a 100644 --- a/source/graphics/jpeg/jpegloader.h +++ b/source/graphics/jpeg/jpegloader.h @@ -2,11 +2,12 @@ #define MSP_GRAPHICS_JPEGLOADER_H_ #include +#include namespace Msp { namespace Graphics { -class JpegLoader: public ImageLoader +class MSPGUI_API JpegLoader: public ImageLoader { private: struct Private; diff --git a/source/graphics/mspgui_api.h b/source/graphics/mspgui_api.h new file mode 100644 index 0000000..de68f70 --- /dev/null +++ b/source/graphics/mspgui_api.h @@ -0,0 +1,18 @@ +#ifndef MSP_GUI_API_H_ +#define MSP_GUI_API_H_ + +#if defined(_WIN32) +#if defined(MSPGUI_BUILD) +#define MSPGUI_API __declspec(dllexport) +#elif defined(MSPGUI_IMPORT) +#define MSPGUI_API __declspec(dllimport) +#else +#define MSPGUI_API +#endif +#elif defined(__GNUC__) +#define MSPGUI_API __attribute__((visibility("default"))) +#else +#define MSPGUI_API +#endif + +#endif diff --git a/source/graphics/png/pngloader.h b/source/graphics/png/pngloader.h index f334d82..85baaef 100644 --- a/source/graphics/png/pngloader.h +++ b/source/graphics/png/pngloader.h @@ -2,11 +2,12 @@ #define MSP_GRAPHICS_PNGLOADER_H_ #include +#include namespace Msp { namespace Graphics { -class PngLoader: public ImageLoader +class MSPGUI_API PngLoader: public ImageLoader { private: struct Private; diff --git a/source/graphics/quartz/quartzloader.h b/source/graphics/quartz/quartzloader.h index 73c74c0..9564ad2 100644 --- a/source/graphics/quartz/quartzloader.h +++ b/source/graphics/quartz/quartzloader.h @@ -2,11 +2,12 @@ #define MSP_GRAPHICS_QUARTZLOADER_H_ #include +#include namespace Msp { namespace Graphics { -class QuartzLoader: public ImageLoader +class MSPGUI_API QuartzLoader: public ImageLoader { private: struct Private; diff --git a/source/graphics/simplewindow.h b/source/graphics/simplewindow.h index f7bb0ce..26abd6a 100644 --- a/source/graphics/simplewindow.h +++ b/source/graphics/simplewindow.h @@ -3,6 +3,7 @@ #include "display.h" #include "glcontext.h" +#include "mspgui_api.h" #include "window.h" namespace Msp { @@ -11,7 +12,7 @@ namespace Graphics { /** Helper class for SimpleWindow. */ -class SimpleWindowBase +class MSPGUI_API SimpleWindowBase { protected: Display dpy; @@ -23,7 +24,7 @@ protected: /** A simplified Window that encapsulates a Display. */ -class SimpleWindow: public SimpleWindowBase, public Window +class MSPGUI_API SimpleWindow: public SimpleWindowBase, public Window { public: SimpleWindow(unsigned, unsigned, bool =false); @@ -35,7 +36,7 @@ public: /** A SimpleWindow bundled with a GLContext. */ -class SimpleGLWindow: public SimpleWindow +class MSPGUI_API SimpleGLWindow: public SimpleWindow { private: GLContext gl_ctx; diff --git a/source/graphics/videomode.h b/source/graphics/videomode.h index c527ed7..ea69e1b 100644 --- a/source/graphics/videomode.h +++ b/source/graphics/videomode.h @@ -2,6 +2,7 @@ #define MSP_GRAPHICS_VIDEOMODE_H_ #include +#include "mspgui_api.h" namespace Msp { namespace Graphics { @@ -9,7 +10,7 @@ namespace Graphics { struct Monitor; struct VideoMode; -class unsupported_video_mode: public std::runtime_error +class MSPGUI_API unsupported_video_mode: public std::runtime_error { public: unsupported_video_mode(const VideoMode &); @@ -25,7 +26,7 @@ enum VideoRotation ROTATE_INVERTED }; -struct VideoMode +struct MSPGUI_API VideoMode { unsigned index = 0; const Monitor *monitor = nullptr; diff --git a/source/graphics/vulkancontext.h b/source/graphics/vulkancontext.h index 211f86a..6d210e2 100644 --- a/source/graphics/vulkancontext.h +++ b/source/graphics/vulkancontext.h @@ -3,6 +3,7 @@ #include #include +#include "mspgui_api.h" namespace Msp { namespace Graphics { @@ -10,7 +11,7 @@ namespace Graphics { class Display; class Window; -class vulkan_error: public std::runtime_error +class MSPGUI_API vulkan_error: public std::runtime_error { public: vulkan_error(unsigned, const char *); @@ -27,7 +28,7 @@ struct VulkanOptions bool enable_tessellation_shader = false; }; -class VulkanContext +class MSPGUI_API VulkanContext { private: struct Private; diff --git a/source/graphics/window.h b/source/graphics/window.h index de8a3d0..a6fb92b 100644 --- a/source/graphics/window.h +++ b/source/graphics/window.h @@ -3,6 +3,7 @@ #include #include +#include "mspgui_api.h" namespace Msp { namespace Graphics { @@ -23,7 +24,7 @@ struct WindowOptions bool resizable = false; }; -class Window +class MSPGUI_API Window { public: struct Private; diff --git a/source/input/binarycontrol.h b/source/input/binarycontrol.h index 0d71bdc..723e70d 100644 --- a/source/input/binarycontrol.h +++ b/source/input/binarycontrol.h @@ -1,6 +1,7 @@ #ifndef MSP_INPUT_BINARYCONTROL_H_ #define MSP_INPUT_BINARYCONTROL_H_ +#include #include "control.h" namespace Msp { @@ -11,7 +12,7 @@ A control with two possible states. Button state is mapped directly. An axis is considered to be active when its value is above a threshold (0.5 by default). */ -class BinaryControl: public Control +class MSPGUI_API BinaryControl: public Control { public: sigc::signal signal_press; diff --git a/source/input/bindings.h b/source/input/bindings.h index 01db810..bafd3ba 100644 --- a/source/input/bindings.h +++ b/source/input/bindings.h @@ -2,6 +2,7 @@ #define MSP_INPUT_BINDINGS_H_ #include +#include #include #include "control.h" #include "device.h" @@ -12,10 +13,10 @@ namespace Input { class ControlScheme; -class Bindings +class MSPGUI_API Bindings { public: - class Loader: public DataFile::ObjectLoader + class MSPGUI_API Loader: public DataFile::ObjectLoader { private: static ActionMap shared_actions; diff --git a/source/input/control.h b/source/input/control.h index f9c7003..177776d 100644 --- a/source/input/control.h +++ b/source/input/control.h @@ -4,6 +4,7 @@ #include #include #include +#include namespace Msp { namespace Input { @@ -23,7 +24,7 @@ enum ControlSrcType Specifies the source of a control. This provides a way for setting sources for different types of controls in a uniform way. */ -struct ControlSource +struct MSPGUI_API ControlSource { Device *dev = nullptr; ControlSrcType type = NO_SOURCE; @@ -48,7 +49,7 @@ active for any events to be processed. This can be used to implement shifted controls (when used on a BinaryControl) or click-and-drag functionality (when used on a SmoothControl). */ -class Control: public sigc::trackable +class MSPGUI_API Control: public sigc::trackable { public: sigc::signal signal_capture_complete; diff --git a/source/input/controlscheme.h b/source/input/controlscheme.h index d821fc5..3346bc0 100644 --- a/source/input/controlscheme.h +++ b/source/input/controlscheme.h @@ -3,13 +3,14 @@ #include #include +#include namespace Msp { namespace Input { class Control; -class ControlScheme +class MSPGUI_API ControlScheme { private: std::map controls; diff --git a/source/input/device.h b/source/input/device.h index e800290..e7a779a 100644 --- a/source/input/device.h +++ b/source/input/device.h @@ -5,12 +5,13 @@ #include #include #include +#include #include namespace Msp { namespace Input { -class device_not_available: public std::runtime_error +class MSPGUI_API device_not_available: public std::runtime_error { public: device_not_available(const std::string &w): std::runtime_error(w) { } @@ -35,7 +36,7 @@ value nominally in the range [-1, 1]. Event handlers return a boolean indicating whether the event is considered processed. If a handler returns true, no further handlers are invoked. */ -class Device +class MSPGUI_API Device { protected: struct EventAccumulator @@ -81,8 +82,8 @@ protected: }; -void operator>>(const LexicalConverter &, DeviceType &); -void operator<<(LexicalConverter &, DeviceType); +MSPGUI_API void operator>>(const LexicalConverter &, DeviceType &); +MSPGUI_API void operator<<(LexicalConverter &, DeviceType); } // namespace Input } // namespace Msp diff --git a/source/input/gamecontroller.h b/source/input/gamecontroller.h index baf94cb..8fbaea9 100644 --- a/source/input/gamecontroller.h +++ b/source/input/gamecontroller.h @@ -1,6 +1,7 @@ #ifndef MSP_INPUT_GAMECONTROLLER_H_ #define MSP_INPUT_GAMECONTROLLER_H_ +#include #include #include #include "device.h" @@ -8,7 +9,7 @@ namespace Msp { namespace Input { -class GameController: public Device +class MSPGUI_API GameController: public Device { private: struct Private; diff --git a/source/input/gesturedetector.h b/source/input/gesturedetector.h index 0b31fd8..8804dd1 100644 --- a/source/input/gesturedetector.h +++ b/source/input/gesturedetector.h @@ -1,6 +1,7 @@ #ifndef MSP_INPUT_GESTUREDETECTOR_H_ #define MSP_INPUT_GESTUREDETECTOR_H_ +#include #include "device.h" namespace Msp { @@ -27,7 +28,7 @@ provided for each type of gesture. Axes 0 and 1 indicate the starting position of the gesture; axes 2 and 3 track its progress. The progress axis may exhibit absolute values greater than one. */ -class GestureDetector: public Device +class MSPGUI_API GestureDetector: public Device { private: static constexpr size_t MAX_POINTS = 3; @@ -71,7 +72,7 @@ private: }; -unsigned gesture_points(Gesture); +MSPGUI_API unsigned gesture_points(Gesture); } // namespace Input } // namespace Msp diff --git a/source/input/hub.h b/source/input/hub.h index 1abff37..aadfcd7 100644 --- a/source/input/hub.h +++ b/source/input/hub.h @@ -3,6 +3,7 @@ #include #include +#include #include "device.h" namespace Msp { @@ -12,7 +13,7 @@ namespace Input { The Hub device collects events from multiple input devices and presents an aggregate of them. Button and axis numbers are mapped to unique values. */ -class Hub: public Device, public sigc::trackable +class MSPGUI_API Hub: public Device, public sigc::trackable { protected: std::vector devices; diff --git a/source/input/keyboard.h b/source/input/keyboard.h index 30ec39c..9048d52 100644 --- a/source/input/keyboard.h +++ b/source/input/keyboard.h @@ -2,6 +2,7 @@ #define MSP_INPUT_KEYBOARD_H_ #include +#include #include #include #include "device.h" @@ -13,7 +14,7 @@ namespace Input { Adapts key events from a window to the abstracted input framework. Key codes are translated to platform-independent values. See keys.h for a list. */ -class Keyboard: public Device, public sigc::trackable +class MSPGUI_API Keyboard: public Device, public sigc::trackable { public: sigc::signal::accumulated signal_character; diff --git a/source/input/keys.h b/source/input/keys.h index 63d0926..ffa97e5 100644 --- a/source/input/keys.h +++ b/source/input/keys.h @@ -1,6 +1,7 @@ #ifndef MSP_INPUT_KEYS_H_ #define MSP_INPUT_KEYS_H_ +#include #include namespace Msp { @@ -161,12 +162,12 @@ enum MouseButton MOUSE_WHEEL_DOWN }; -void operator>>(const LexicalConverter &, Key &); -void operator<<(LexicalConverter &, Key); -void operator>>(const LexicalConverter &, MouseAxis &); -void operator<<(LexicalConverter &, MouseAxis); -void operator>>(const LexicalConverter &, MouseButton &); -void operator<<(LexicalConverter &, MouseButton); +MSPGUI_API void operator>>(const LexicalConverter &, Key &); +MSPGUI_API void operator<<(LexicalConverter &, Key); +MSPGUI_API void operator>>(const LexicalConverter &, MouseAxis &); +MSPGUI_API void operator<<(LexicalConverter &, MouseAxis); +MSPGUI_API void operator>>(const LexicalConverter &, MouseButton &); +MSPGUI_API void operator<<(LexicalConverter &, MouseButton); } // namespace Input } // namespace Msp diff --git a/source/input/mouse.h b/source/input/mouse.h index 647da7c..0f0013c 100644 --- a/source/input/mouse.h +++ b/source/input/mouse.h @@ -2,6 +2,7 @@ #define MSP_INPUT_MOUSE_H_ #include +#include #include #include "device.h" @@ -14,7 +15,7 @@ uniform way. Note: Y axis grows upwards. */ -class Mouse: public Device, public sigc::trackable +class MSPGUI_API Mouse: public Device, public sigc::trackable { private: Graphics::Window &window; diff --git a/source/input/smoothcontrol.h b/source/input/smoothcontrol.h index b5eb9aa..16dc7e6 100644 --- a/source/input/smoothcontrol.h +++ b/source/input/smoothcontrol.h @@ -1,6 +1,7 @@ #ifndef MSP_INPUT_SMOOTHCONTROL_H_ #define MSP_INPUT_SMOOTHCONTROL_H_ +#include #include "control.h" namespace Msp { @@ -14,7 +15,7 @@ Two smooth controls can also be paired to each other. Motion on one control of the pair will cause negative motion on the other. This works best when the controls are bound to the opposite sides of the same axis. */ -class SmoothControl: public Control +class MSPGUI_API SmoothControl: public Control { public: sigc::signal signal_motion; diff --git a/source/input/touchscreen.h b/source/input/touchscreen.h index d366a28..a02fb2a 100644 --- a/source/input/touchscreen.h +++ b/source/input/touchscreen.h @@ -2,13 +2,14 @@ #define MSP_INPUT_TOUCHSCREEN_H_ #include +#include #include #include "device.h" namespace Msp { namespace Input { -class Touchscreen: public Device, public sigc::trackable +class MSPGUI_API Touchscreen: public Device, public sigc::trackable { private: static constexpr unsigned UNUSED = static_cast(-1);