1 /********************************************************************************
2 *                                                                               *
3 *                       D r a g   C o r n e r   W i d g e t                     *
4 *                                                                               *
5 *********************************************************************************
6 * Copyright (C) 1997,2021 by Jeroen van der Zijp.   All Rights Reserved.        *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify          *
9 * it under the terms of the GNU Lesser General Public License as published by   *
10 * the Free Software Foundation; either version 3 of the License, or             *
11 * (at your option) any later version.                                           *
12 *                                                                               *
13 * This library is distributed in the hope that it will be useful,               *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
16 * GNU Lesser General Public License for more details.                           *
17 *                                                                               *
18 * You should have received a copy of the GNU Lesser General Public License      *
19 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
20 ********************************************************************************/
21 #ifndef FXDRAGCORNER_H
22 #define FXDRAGCORNER_H
23 
24 #ifndef FXWINDOW_H
25 #include "FXWindow.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 /**
32 * A drag corner widget may be placed in the bottom right corner
33 * so as to allow the window to be resized more easily.
34 */
35 class FXAPI FXDragCorner : public FXWindow {
36   FXDECLARE(FXDragCorner)
37 protected:
38   FXColor hiliteColor;
39   FXColor shadowColor;
40   FXint   oldw;
41   FXint   oldh;
42   FXint   xoff;
43   FXint   yoff;
44   FXbool  ewmh;
45 protected:
46   FXDragCorner();
47 private:
48   FXDragCorner(const FXDragCorner&);
49   FXDragCorner &operator=(const FXDragCorner&);
50 public:
51   long onPaint(FXObject*,FXSelector,void*);
52   long onLeftBtnPress(FXObject*,FXSelector,void*);
53   long onLeftBtnRelease(FXObject*,FXSelector,void*);
54   long onMotion(FXObject*,FXSelector,void*);
55 public:
56 
57   /// Construct a drag corner
58   FXDragCorner(FXComposite* p);
59 
60   /// Get default width
61   virtual FXint getDefaultWidth();
62 
63   /// Get default height
64   virtual FXint getDefaultHeight();
65 
66   /// Create all of the server-side resources for this window
67   virtual void create();
68 
69   /// Change highlight color
70   void setHiliteColor(FXColor clr);
71 
72   /// Return current highlight color
getHiliteColor()73   FXColor getHiliteColor() const { return hiliteColor; }
74 
75   /// Change shadow color
76   void setShadowColor(FXColor clr);
77 
78   /// Return current shadow color
getShadowColor()79   FXColor getShadowColor() const { return shadowColor; }
80 
81   /// Save drag corner to a stream
82   virtual void save(FXStream& store) const;
83 
84   /// Load drag corner from a stream
85   virtual void load(FXStream& store);
86   };
87 
88 }
89 
90 #endif
91