1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
|
/*
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com>
*
* This file is part of lsp-ws-lib
* Created on: 12 дек. 2016 г.
*
* lsp-ws-lib is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* lsp-ws-lib 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with lsp-ws-lib. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef LSP_PLUG_IN_WS_IWINDOW_H_
#define LSP_PLUG_IN_WS_IWINDOW_H_
#include <lsp-plug.in/ws/version.h>
#include <lsp-plug.in/ws/IDisplay.h>
#include <lsp-plug.in/ws/IEventHandler.h>
#include <lsp-plug.in/runtime/LSPString.h>
namespace lsp
{
namespace ws
{
class IDisplay;
/** Native window class
*
*/
class LSP_WS_LIB_PUBLIC IWindow
{
protected:
IEventHandler *pHandler;
IDisplay *pDisplay;
private:
IWindow & operator = (const IWindow);
IWindow(const IWindow &);
public:
explicit IWindow(IDisplay *dpy, IEventHandler *handler = NULL);
virtual ~IWindow();
/** Window initialization routine
*
* @return status of operation
*/
virtual status_t init();
/** Window finalization routine
*
*/
virtual void destroy();
public:
/**
* Get display
* @return display
*/
inline IDisplay *display() { return pDisplay; }
/** Get event handler
*
* @return event handler
*/
inline IEventHandler *get_handler() { return pHandler; }
/** Get surface for drawing
*
* @return surface for drawing
*/
virtual ISurface *get_surface();
/**
* Invalidate contents of the window and issue it's redraw.
* @return status of operation
*/
virtual status_t invalidate();
/** Get left coordinate of window
*
* @return value
*/
virtual ssize_t left();
/** Get top coordinate of window
*
* @return value
*/
virtual ssize_t top();
/** Get width of the window
*
* @return value
*/
virtual ssize_t width();
/** Get height of the window
*
* @return value
*/
virtual ssize_t height();
/** Get window visibility
*
* @return true if window is visible
*/
virtual bool is_visible();
/** Return current screen of the window
*
* @return screen of the window
*/
virtual size_t screen();
/** Set caption of the window
*
* @param caption UTF-8-encoded NULL-terminated caption string
* @return status of operation
*/
virtual status_t set_caption(const char *caption);
virtual status_t set_caption(const LSPString *caption);
public:
/** Get native handle of the window
*
*/
virtual void *handle();
/** Set event handler
*
* @param handler event handler
*/
inline void set_handler(IEventHandler *handler) { pHandler = handler; }
/** Move window
*
* @param left left coordinate
* @param top top coordinate
* @return status of operation
*/
virtual status_t move(ssize_t left, ssize_t top);
/** Resize window
*
* @param width window width
* @param height window height
* @return status of operation
*/
virtual status_t resize(ssize_t width, ssize_t height);
/** Set window geometry
*
* @param left left coordinate
* @param top top coordinate
* @param width window width
* @param height window height
* @return status of operation
*/
virtual status_t set_geometry(ssize_t left, ssize_t top, ssize_t width, ssize_t height);
/** Set window geometry
*
* @param size actual window parameters
* @return status of operation
*/
virtual status_t set_geometry(const rectangle_t *size);
/** Set window's border style
*
* @param style window's border style
* @return status of operation
*/
virtual status_t set_border_style(border_style_t style);
/** Get window's border style
*
* @param style window's border style
* @return status of operation
*/
virtual status_t get_border_style(border_style_t *style);
/** Get window geometry. Obtains the size of the client area
* of the window and it's location relative to the parent window.
*
* @return window geometry
*/
virtual status_t get_geometry(rectangle_t *size);
/** Get absolute window's geometry. Obtains the size of the whole window
* and it's location relative to the screen.
*
* @param size pointer to structure to store data
* @return status of operation
*/
virtual status_t get_absolute_geometry(rectangle_t *size);
/** Get caption
*
* @param text pointer to store data (buffer for UTF-8 string)
* @param len number of characters
* @return status of operation
*/
virtual status_t get_caption(char *text, size_t len);
/** Get caption
*
* @param text pointer to store data (buffer for UTF-8 string)
* @return status of operation
*/
virtual status_t get_caption(LSPString *text);
/** Hide window
*
* @return status of operation
*/
virtual status_t hide();
/** Show window
*
* @return status of operation
*/
virtual status_t show();
/** Show window over another
*
* @param over the underlying window
* @return status of operation
*/
virtual status_t show(IWindow *over);
/** Set left coordinate of the window
*
* @param left left coordinate of the window
* @return status of operation
*/
virtual status_t set_left(ssize_t left);
/** Set top coordinate of the window
*
* @param top top coordinate of the window
* @return status of operation
*/
virtual status_t set_top(ssize_t top);
/** Set width of the window
*
* @param width width of the window
* @return status of operation
*/
virtual ssize_t set_width(ssize_t width);
/** Set height of the window
*
* @param height height of the window
* @return status of operation
*/
virtual ssize_t set_height(ssize_t height);
/** Set window visibility
*
* @param visible visibility
* @return status of operation
*/
virtual status_t set_visibility(bool visible);
/** Set size constraints of the window
*
* @param c size constraints
* @return status of operations
*/
virtual status_t set_size_constraints(const size_limit_t *c);
/** Get size constraints
*
* @param c size constraints
* @return status of operation
*/
virtual status_t get_size_constraints(size_limit_t *c);
/** Set size constraints
*
* @param min_width minimum width
* @param min_height minimum height
* @param max_width maximum width
* @param max_height maximum height
* @return status of operation
*/
virtual status_t set_size_constraints(ssize_t min_width, ssize_t min_height, ssize_t max_width, ssize_t max_height);
/** Set minimum width
*
* @param value minimum width
* @return status of operation
*/
virtual status_t set_min_width(ssize_t value);
/** Set minimum height
*
* @param value minimum height
* @return status of operation
*/
virtual status_t set_min_height(ssize_t value);
/** Set maximum width
*
* @param value maximum width
* @return status of operation
*/
virtual status_t set_max_width(ssize_t value);
/** Set maximum height
*
* @param value maximum height
* @return status of operation
*/
virtual status_t set_max_height(ssize_t value);
/** Set minimum size
*
* @param width minimum width
* @param height minimum height
* @return status of operation
*/
virtual status_t set_min_size(ssize_t width, ssize_t height);
/** Set maximum size
*
* @param width maximum width
* @param height maximum height
* @return status of operation
*/
virtual status_t set_max_size(ssize_t width, ssize_t height);
/** Take the focus by window
* @return status of operation
*/
virtual status_t take_focus();
/** Set window icon
*
* @param bgra the packed array of Blue, Green, Red and Alpha components
* @param width width of the image
* @param height height of the image
* @return status of operation
*/
virtual status_t set_icon(const void *bgra, size_t width, size_t height);
/** Get bitmask of allowed window actions
*
* @param actions pointer to store action mask
* @return status of operation
*/
virtual status_t get_window_actions(size_t *actions);
/** Set bitmask of allowed window actions
*
* @param actions action mask
* @return status of operation
*/
virtual status_t set_window_actions(size_t actions);
/** Set mouse pointer
*
* @param ponter mouse pointer
* @return status of operation
*/
virtual status_t set_mouse_pointer(mouse_pointer_t pointer);
/** Get mouse pointer
*
* @return mouse pointer
*/
virtual mouse_pointer_t get_mouse_pointer();
/**
* Grab mouse and keyboard events for the specified group.
* Group declares the set of controls that will receive events only
* when there are no windows with grabbing events in more prioretized group.
*
* @param group the group of events to grab
* @return status of operation
*/
virtual status_t grab_events(grab_t group);
/**
* Release grab of events
* @return status of operation
*/
virtual status_t ungrab_events();
/**
* Check whether window is currently grabbing events
* @return true if window is currently grabbing events
*/
virtual bool is_grabbing_events() const;
/**
* Set window class
* @param instance window instance, ASCII-string
* @param wclass window class, ASCII-string
* @return status of operation
*/
virtual status_t set_class(const char *instance, const char *wclass);
/**
* Set window role
* @param wrole window role, ASCII-string
* @return status of operation
*/
virtual status_t set_role(const char *wrole);
/**
* Check that window is embedded into some another window (has parents).
* @return true if window is embedded into some another window.
*/
virtual bool has_parent() const;
};
} /* namespace ws */
} /* namespace lsp */
#endif /* LSP_PLUG_IN_WS_IWINDOW_H_ */
|