VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gxcontext.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Graeme Walker
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
17 ///
18 /// \file gxcontext.h
19 ///
20 
21 #ifndef GX_CONTEXT_H
22 #define GX_CONTEXT_H
23 
24 #include "gdef.h"
25 #include "gxdef.h"
26 
27 namespace GX
28 {
29  class Context ;
30  class Display ;
31  class Drawable ;
32 }
33 
34 /// \class GX::Context
35 /// An Xlib GC wrapper.
36 ///
38 {
39 public:
40  Context( Display & , Drawable & ) ;
41  ///< Constructor for a new graphics context. The display reference
42  ///< is kept.
43 
44  Context( Display & , ::GC gc ) ;
45  ///< Constructor for an existing graphics context. The display
46  ///< reference is kept. The context is _not_ freed in the destructor.
47 
48  ~Context() ;
49  ///< Destructor.
50 
51  void setForeground( unsigned long cc ) ;
52  ///< Sets the foreground drawing colour.
53 
54  void setLineWidth( unsigned long ) ;
55  ///< Sets the line width.
56 
57  ::GC x() ;
58  ///< Returns the X object.
59 
60  Context( const Context & ) ;
61  ///< Copy constructor. The new object refers to the same underlying context.
62 
63 private:
64  void operator=( const Context & ) ;
65 
66 private:
67  Display & m_display ;
68  ::GC m_context ;
69  bool m_owned ;
70 } ;
71 
72 #endif
An Xlib Display wrapper.
Definition: gxdisplay.h:38
::GC x()
Returns the X object.
Definition: gxcontext.cpp:63
void setLineWidth(unsigned long)
Sets the line width.
Definition: gxcontext.cpp:73
An Xlib GC wrapper.
Definition: gxcontext.h:37
void setForeground(unsigned long cc)
Sets the foreground drawing colour.
Definition: gxcontext.cpp:68
Context(Display &, Drawable &)
Constructor for a new graphics context.
Definition: gxcontext.cpp:28
An abstract base class for xserver-side drawables (windows, pixmaps, etc) with methods for drawing po...
Definition: gxdrawable.h:38
~Context()
Destructor.
Definition: gxcontext.cpp:51