From: Mikko Rasa Date: Fri, 18 Aug 2023 21:22:14 +0000 (+0300) Subject: Add API declarations X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=56c41b294aa47a38ac3e1be70d4868f260cb4274;p=libs%2Fgltk.git Add API declarations --- diff --git a/source/arrangement.h b/source/arrangement.h index 7028aed..31001c4 100644 --- a/source/arrangement.h +++ b/source/arrangement.h @@ -4,20 +4,21 @@ #include #include #include "layout.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { class Widget; -class arrangement_error: public std::logic_error +class MSPGLTK_API arrangement_error: public std::logic_error { public: arrangement_error(const std::string &w): std::logic_error(w) { } virtual ~arrangement_error() throw() { } }; -class Arrangement +class MSPGLTK_API Arrangement { protected: enum Side diff --git a/source/button.h b/source/button.h index 844fe88..2af9cf9 100644 --- a/source/button.h +++ b/source/button.h @@ -3,6 +3,7 @@ #include #include +#include "mspgltk_api.h" #include "text.h" #include "widget.h" @@ -13,10 +14,10 @@ namespace GLtk { A clickable button widget. Buttons can have a text label, which is displayed in a spacial part "text". */ -class Button: public Widget +class MSPGLTK_API Button: public Widget { public: - class Loader: public DataFile::DerivedObjectLoader + class MSPGLTK_API Loader: public DataFile::DerivedObjectLoader { public: Loader(Button &); diff --git a/source/column.h b/source/column.h index 75ee1d3..6d6acd6 100644 --- a/source/column.h +++ b/source/column.h @@ -2,11 +2,12 @@ #define MSP_GLTK_COLUMN_H_ #include "lineararrangement.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { -class Column: public LinearArrangement +class MSPGLTK_API Column: public LinearArrangement { public: Column(Layout &); diff --git a/source/container.h b/source/container.h index a80cc4e..4c38675 100644 --- a/source/container.h +++ b/source/container.h @@ -4,12 +4,13 @@ #include #include #include +#include "mspgltk_api.h" #include "widget.h" namespace Msp { namespace GLtk { -class hierarchy_error: public std::logic_error +class MSPGLTK_API hierarchy_error: public std::logic_error { public: hierarchy_error(const std::string &); @@ -17,7 +18,7 @@ public: }; -class Container: virtual public Widget +class MSPGLTK_API Container: virtual public Widget { protected: struct Child: public sigc::trackable diff --git a/source/dialog.h b/source/dialog.h index e910085..3eb3f98 100644 --- a/source/dialog.h +++ b/source/dialog.h @@ -1,6 +1,7 @@ #ifndef MSP_GLTK_DIALOG_H_ #define MSP_GLTK_DIALOG_H_ +#include "mspgltk_api.h" #include "panel.h" namespace Msp { @@ -12,10 +13,10 @@ class Button; A Dialog is used for temporary interaction with the user. When any of the Dialog's action buttons are clicked, it will emit a signal and delete itself. */ -class Dialog: public Panel +class MSPGLTK_API Dialog: public Panel { public: - class Loader: public DataFile::DerivedObjectLoader + class MSPGLTK_API Loader: public DataFile::DerivedObjectLoader { public: Loader(Dialog &, WidgetMap &); diff --git a/source/draghandle.h b/source/draghandle.h index 5643df4..0aae732 100644 --- a/source/draghandle.h +++ b/source/draghandle.h @@ -1,6 +1,7 @@ #ifndef MSP_GLTK_DRAGHANDLE_H_ #define MSP_GLTK_DRAGHANDLE_H_ +#include "mspgltk_api.h" #include "widget.h" namespace Msp { @@ -10,7 +11,7 @@ namespace GLtk { Moves its parent widget when dragged. This allows turning a Panel or Dialog into a movable window. */ -class DragHandle: public Widget +class MSPGLTK_API DragHandle: public Widget { private: bool dragging; diff --git a/source/dropdown.h b/source/dropdown.h index 2d3feb3..2de7a87 100644 --- a/source/dropdown.h +++ b/source/dropdown.h @@ -3,6 +3,7 @@ #include #include "list.h" +#include "mspgltk_api.h" #include "text.h" #include "widget.h" @@ -11,10 +12,10 @@ namespace GLtk { class List; -class Dropdown: virtual public Widget, private Container +class MSPGLTK_API Dropdown: virtual public Widget, private Container { public: - class Loader: public DataFile::DerivedObjectLoader + class MSPGLTK_API Loader: public DataFile::DerivedObjectLoader { public: Loader(Dropdown &); diff --git a/source/entry.h b/source/entry.h index f7dd4ae..60beef7 100644 --- a/source/entry.h +++ b/source/entry.h @@ -2,6 +2,7 @@ #define MSP_GLTK_ENTRY_H_ #include "container.h" +#include "mspgltk_api.h" #include "text.h" #include "widget.h" @@ -19,10 +20,10 @@ Special parts: cursor Indicates the current input position. Fill_x is ignored. slider A vertical slider for multiline entries. */ -class Entry: virtual public Widget, private Container +class MSPGLTK_API Entry: virtual public Widget, private Container { public: - class Loader: public DataFile::DerivedObjectLoader + class MSPGLTK_API Loader: public DataFile::DerivedObjectLoader { public: Loader(Entry &); diff --git a/source/floatingarrangement.h b/source/floatingarrangement.h index a4ebdd7..8539b59 100644 --- a/source/floatingarrangement.h +++ b/source/floatingarrangement.h @@ -2,11 +2,12 @@ #define FLOATINGARRANGEMENT_H_ #include "arrangement.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { -class FloatingArrangement: public Arrangement +class MSPGLTK_API FloatingArrangement: public Arrangement { public: FloatingArrangement(Layout &); diff --git a/source/geometry.h b/source/geometry.h index 1451a06..8c8c989 100644 --- a/source/geometry.h +++ b/source/geometry.h @@ -2,6 +2,7 @@ #define MSP_GLTK_GEOMETRY_H_ #include +#include "mspgltk_api.h" namespace Msp { namespace GLtk { @@ -9,7 +10,7 @@ namespace GLtk { /** Specifies the position and size of a widget or graphic. */ -struct Geometry +struct MSPGLTK_API Geometry { int x, y; unsigned w, h; @@ -24,7 +25,7 @@ struct Geometry /** Specifies margins on the sides of an element. */ -struct Sides +struct MSPGLTK_API Sides { class Loader: public DataFile::ObjectLoader { @@ -51,7 +52,7 @@ struct Sides /** Performs alignment of nested geometries, such as widgets and their parts. */ -struct Alignment +struct MSPGLTK_API Alignment { float x, y; float w, h; diff --git a/source/graphic.h b/source/graphic.h index 1ae0d5e..4fed368 100644 --- a/source/graphic.h +++ b/source/graphic.h @@ -5,6 +5,7 @@ #include #include #include "geometry.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { @@ -14,7 +15,7 @@ class Resources; /** Stores a single graphical element. Graphics are used as parts of widgets. */ -class Graphic +class MSPGLTK_API Graphic { public: class Loader: public DataFile::CollectionObjectLoader diff --git a/source/grid.h b/source/grid.h index 621a294..29d7b6d 100644 --- a/source/grid.h +++ b/source/grid.h @@ -3,11 +3,12 @@ #include #include "arrangement.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { -class Grid: public Arrangement +class MSPGLTK_API Grid: public Arrangement { public: class Loader: public DataFile::ObjectLoader diff --git a/source/image.h b/source/image.h index 8b857f4..7735756 100644 --- a/source/image.h +++ b/source/image.h @@ -2,6 +2,7 @@ #define MSP_GLTK_IMAGE_H_ #include +#include "mspgltk_api.h" #include "widget.h" namespace Msp { @@ -10,7 +11,7 @@ namespace GLtk { /** A widget for displaying images. */ -class Image: public Widget +class MSPGLTK_API Image: public Widget { public: class Loader: public Msp::DataFile::DerivedObjectLoader diff --git a/source/indicator.h b/source/indicator.h index 90c920c..2b5b2a3 100644 --- a/source/indicator.h +++ b/source/indicator.h @@ -1,6 +1,7 @@ #ifndef MSP_GLTK_INDICATOR_H_ #define MSP_GLTK_INDICATOR_H_ +#include "mspgltk_api.h" #include "widget.h" namespace Msp { @@ -9,7 +10,7 @@ namespace GLtk { /** An Indicator visualizes a boolean state. It can be either active or inactive. */ -class Indicator: public Widget +class MSPGLTK_API Indicator: public Widget { public: virtual const char *get_class() const { return "indicator"; } diff --git a/source/inputmethod.h b/source/inputmethod.h index 5d41f0a..1e0f613 100644 --- a/source/inputmethod.h +++ b/source/inputmethod.h @@ -1,6 +1,8 @@ #ifndef INPUTMETHOD_H_ #define INPUTMETHOD_H_ +#include "mspgltk_api.h" + namespace Msp { namespace GLtk { @@ -34,7 +36,7 @@ enum Navigation NAV_CANCEL }; -class InputMethod +class MSPGLTK_API InputMethod { protected: Root &root; diff --git a/source/label.h b/source/label.h index e3cff69..3275bca 100644 --- a/source/label.h +++ b/source/label.h @@ -1,6 +1,7 @@ #ifndef MSP_GLTK_LABEL_H_ #define MSP_GLTK_LABEL_H_ +#include "mspgltk_api.h" #include "text.h" #include "widget.h" @@ -10,7 +11,7 @@ namespace GLtk { /** Labels display static text. There is one special part: "text". */ -class Label: public Widget +class MSPGLTK_API Label: public Widget { public: class Loader: public DataFile::DerivedObjectLoader diff --git a/source/layout.h b/source/layout.h index a13a093..7986686 100644 --- a/source/layout.h +++ b/source/layout.h @@ -6,6 +6,7 @@ #include #include #include "geometry.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { @@ -50,7 +51,7 @@ Since specifiyng constraints manually can be quite tedious, an Arrangement interface is provided to automatically arrange widgets. See classes Row, Column and Grid for some commonly used arrangements. */ -class Layout +class MSPGLTK_API Layout { private: enum @@ -242,7 +243,7 @@ private: void solve_constraints(int, SolveMode); }; -void operator>>(const LexicalConverter &, Layout::ConstraintType &); +MSPGLTK_API void operator>>(const LexicalConverter &, Layout::ConstraintType &); } // namespace GLtk } // namespace Msp diff --git a/source/lineararrangement.h b/source/lineararrangement.h index ce49b34..71ffcfe 100644 --- a/source/lineararrangement.h +++ b/source/lineararrangement.h @@ -3,14 +3,15 @@ #include #include "arrangement.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { -class LinearArrangement: public Arrangement +class MSPGLTK_API LinearArrangement: public Arrangement { public: - class Loader: public DataFile::ObjectLoader + class MSPGLTK_API Loader: public DataFile::ObjectLoader { public: Loader(LinearArrangement &); diff --git a/source/list.h b/source/list.h index 19fdaa5..68a96bf 100644 --- a/source/list.h +++ b/source/list.h @@ -7,6 +7,7 @@ #include "container.h" #include "label.h" #include "listdata.h" +#include "mspgltk_api.h" #include "slider.h" namespace Msp { @@ -15,7 +16,7 @@ namespace GLtk { /** Thrown if a list's item type is incompatible with its data. */ -class incompatible_data: public std::logic_error +class MSPGLTK_API incompatible_data: public std::logic_error { public: incompatible_data(const std::type_info &); @@ -27,7 +28,7 @@ public: Shows a list of items, allowing the user to select one. A slider is included to allow scrolling through a long list. */ -class List: virtual public Widget, private Container +class MSPGLTK_API List: virtual public Widget, private Container { public: enum ViewMode @@ -246,7 +247,7 @@ private: static void adjust_index(int &, int, int); }; -void operator>>(const LexicalConverter &, List::ViewMode &); +MSPGLTK_API void operator>>(const LexicalConverter &, List::ViewMode &); } // namespace GLtk } // namespace Msp diff --git a/source/listdata.h b/source/listdata.h index 9d1a457..9f7d8ba 100644 --- a/source/listdata.h +++ b/source/listdata.h @@ -6,11 +6,12 @@ #include #include #include +#include "mspgltk_api.h" namespace Msp { namespace GLtk { -class ListData +class MSPGLTK_API ListData { public: sigc::signal signal_item_added; diff --git a/source/mspgltk_api.h b/source/mspgltk_api.h new file mode 100644 index 0000000..745d5f3 --- /dev/null +++ b/source/mspgltk_api.h @@ -0,0 +1,18 @@ +#ifndef MSP_GLTK_API_H_ +#define MSP_GLTK_API_H_ + +#if defined(_WIN32) +#if defined(MSPGLTK_BUILD) +#define MSPGLTK_API __declspec(dllexport) +#elif defined(MSPGLTK_IMPORT) +#define MSPGLTK_API __declspec(dllimport) +#else +#define MSPGLTK_API +#endif +#elif defined(__GNUC__) +#define MSPGLTK_API __attribute__((visibility("default"))) +#else +#define MSPGLTK_API +#endif + +#endif diff --git a/source/panel.h b/source/panel.h index 09096f7..22f03a2 100644 --- a/source/panel.h +++ b/source/panel.h @@ -4,6 +4,7 @@ #include #include "container.h" #include "layout.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { @@ -13,7 +14,7 @@ Panels are containers for other widgets. Panel styles should have a special part "children" to render the child widgets. All properties of this part are ignored. */ -class Panel: public Container +class MSPGLTK_API Panel: public Container { public: class Loader: public DataFile::DerivedObjectLoader diff --git a/source/part.h b/source/part.h index 252d5a3..a8776c2 100644 --- a/source/part.h +++ b/source/part.h @@ -4,6 +4,7 @@ #include #include #include "geometry.h" +#include "mspgltk_api.h" #include "state.h" namespace Msp { @@ -16,7 +17,7 @@ class Resources; /** Defines a single graphical element of a widget style. */ -class Part +class MSPGLTK_API Part { public: class Loader: public DataFile::CollectionObjectLoader diff --git a/source/partcache.h b/source/partcache.h index 4eef116..9dc71bf 100644 --- a/source/partcache.h +++ b/source/partcache.h @@ -3,6 +3,7 @@ #include #include +#include "mspgltk_api.h" namespace Msp { namespace GLtk { @@ -19,7 +20,7 @@ struct CachedPart ~CachedPart(); }; -class PartCache +class MSPGLTK_API PartCache { public: class Rebuild diff --git a/source/progressbar.h b/source/progressbar.h index c1e17b5..d167410 100644 --- a/source/progressbar.h +++ b/source/progressbar.h @@ -1,12 +1,13 @@ #ifndef MSP_GLTK_PROGRESSBAR_H_ #define MSP_GLTK_PROGRESSBAR_H_ +#include "mspgltk_api.h" #include "widget.h" namespace Msp { namespace GLtk { -class ProgressBar: public Widget +class MSPGLTK_API ProgressBar: public Widget { private: float range; diff --git a/source/resources.h b/source/resources.h index 772b729..ce85b97 100644 --- a/source/resources.h +++ b/source/resources.h @@ -10,6 +10,7 @@ #include #include #include "graphic.h" +#include "mspgltk_api.h" #include "style.h" namespace Msp { @@ -19,7 +20,7 @@ namespace GLtk { Stores resources such as styles and graphics. All widgets require a Resources instance in constructor. */ -class Resources: public DataFile::Collection +class MSPGLTK_API Resources: public DataFile::Collection { public: class Loader: public Collection::Loader diff --git a/source/root.h b/source/root.h index b2e2409..52e23ca 100644 --- a/source/root.h +++ b/source/root.h @@ -11,6 +11,7 @@ #include #include #include +#include "mspgltk_api.h" #include "panel.h" namespace Msp { @@ -24,7 +25,7 @@ input from keyboard and mouse. It can be used by itself or in a GL::Pipeline. Due to its specialized nature it's recommended to not use it with Scenes or other containers. */ -class Root: public Panel, public GL::Renderable, public sigc::trackable +class MSPGLTK_API Root: public Panel, public GL::Renderable, public sigc::trackable { public: sigc::signal signal_tooltip; diff --git a/source/row.h b/source/row.h index 4bf2d38..849ba62 100644 --- a/source/row.h +++ b/source/row.h @@ -2,11 +2,12 @@ #define MSP_GLTK_ROW_H_ #include "lineararrangement.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { -class Row: public LinearArrangement +class MSPGLTK_API Row: public LinearArrangement { public: Row(Layout &); diff --git a/source/slider.h b/source/slider.h index 4260564..7b878d2 100644 --- a/source/slider.h +++ b/source/slider.h @@ -2,6 +2,7 @@ #define MSP_GLTK_SLIDER_H_ #include +#include "mspgltk_api.h" #include "widget.h" namespace Msp { @@ -12,10 +13,10 @@ Sliders are used to adjust numeric values visually. This class provides the common interface and logic for sliders but can't be instantiated. Use HSlider or VSlider depending on which direction you want the slider to be in. */ -class Slider: public Widget +class MSPGLTK_API Slider: public Widget { public: - class Loader: public DataFile::DerivedObjectLoader + class MSPGLTK_API Loader: public DataFile::DerivedObjectLoader { public: Loader(Slider &); @@ -71,7 +72,7 @@ protected: }; -class VSlider: public Slider +class MSPGLTK_API VSlider: public Slider { public: VSlider(): Slider(VERTICAL) { } @@ -79,7 +80,7 @@ public: virtual const char *get_class() const { return "vslider"; } }; -class HSlider: public Slider +class MSPGLTK_API HSlider: public Slider { public: HSlider(): Slider(HORIZONTAL) { } diff --git a/source/stack.h b/source/stack.h index fa4a442..53943fd 100644 --- a/source/stack.h +++ b/source/stack.h @@ -3,6 +3,7 @@ #include #include "arrangement.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { @@ -11,7 +12,7 @@ namespace GLtk { Arranges widgets on top of one another. This can be useful in implementing a tabbed view where only one tab is visible at a time. */ -class Stack: public Arrangement +class MSPGLTK_API Stack: public Arrangement { public: class Loader: public DataFile::ObjectLoader diff --git a/source/state.h b/source/state.h index eb12469..51d17b2 100644 --- a/source/state.h +++ b/source/state.h @@ -3,6 +3,7 @@ #include #include +#include "mspgltk_api.h" namespace Msp { namespace GLtk { @@ -32,7 +33,7 @@ inline State operator&=(State &a, State b) inline State operator~(State a) { return static_cast(~static_cast(a)); } -extern std::istream &operator>>(std::istream &, State &); +MSPGLTK_API std::istream &operator>>(std::istream &, State &); } // namespace GLtk } // namespace Msp diff --git a/source/style.h b/source/style.h index 1eb05c3..8a3e3a9 100644 --- a/source/style.h +++ b/source/style.h @@ -5,6 +5,7 @@ #include #include #include +#include "mspgltk_api.h" #include "part.h" namespace Msp { @@ -16,7 +17,7 @@ class Resources; Styles define what wigets look like. They are made up of Parts and some generic properties. */ -class Style +class MSPGLTK_API Style { public: class Loader: public DataFile::CollectionObjectLoader diff --git a/source/systemkeyboardinput.h b/source/systemkeyboardinput.h index 1b37e54..999c7ce 100644 --- a/source/systemkeyboardinput.h +++ b/source/systemkeyboardinput.h @@ -3,11 +3,12 @@ #include #include "inputmethod.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { -class SystemKeyboardInput: public InputMethod, public sigc::trackable +class MSPGLTK_API SystemKeyboardInput: public InputMethod, public sigc::trackable { private: Input::Keyboard &keyboard; diff --git a/source/text.h b/source/text.h index 6ddbb23..708380a 100644 --- a/source/text.h +++ b/source/text.h @@ -3,6 +3,7 @@ #include #include +#include "mspgltk_api.h" #include "state.h" namespace Msp { @@ -16,7 +17,7 @@ class Style; /** Stores and renders text. Supports multiline text. */ -class Text +class MSPGLTK_API Text { private: struct Line diff --git a/source/toggle.h b/source/toggle.h index 4845796..0f6c610 100644 --- a/source/toggle.h +++ b/source/toggle.h @@ -2,6 +2,7 @@ #define MSP_GLTK_TOGGLE_H_ #include +#include "mspgltk_api.h" #include "text.h" #include "widget.h" @@ -11,10 +12,10 @@ namespace GLtk { /** Allows toggling a value between two states. */ -class Toggle: public Widget +class MSPGLTK_API Toggle: public Widget { public: - class Loader: public DataFile::DerivedObjectLoader + class MSPGLTK_API Loader: public DataFile::DerivedObjectLoader { public: Loader(Toggle &); diff --git a/source/widget.h b/source/widget.h index a941984..19db879 100644 --- a/source/widget.h +++ b/source/widget.h @@ -6,6 +6,7 @@ #include #include "geometry.h" #include "inputmethod.h" +#include "mspgltk_api.h" #include "partcache.h" #include "state.h" @@ -20,7 +21,7 @@ class Style; /** Base class for all widgets. */ -class Widget +class MSPGLTK_API Widget { friend class Container;