Eclipse SUMO - Simulation of Urban MObility
GUICursorSubSys.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // Helper for cursors loading and usage
15 /****************************************************************************/
16 
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
23 #include <fx.h>
24 #include <cassert>
25 #include "GUICursors.h"
26 #include "GUICursorSubSys.h"
27 
30 // ===========================================================================
31 // static member variable definitions
32 // ===========================================================================
33 
35 
36 // ===========================================================================
37 // member definitions
38 // ===========================================================================
39 
41  // already created cursor
42  myCursors[SUMOCURSOR_DEFAULT] = a->getDefaultCursor(DEF_ARROW_CURSOR);
43  myCursors[SUMOCURSOR_MOVE] = a->getDefaultCursor(DEF_MOVE_CURSOR);
44 
45  /*
46  myCursors[CURSOR_SUMO] = new FXXPMCursor(a, sumo_icon64_xpm);
47 
48  // ... and create them
49  for (int i = 0; i < CURSOR_MAX; i++) {
50  if (myCursors[i] != nullptr) {
51  myCursors[i]->create();
52  }
53  }
54  */
55 }
56 
57 
59  /*
60  for (int i = 0; i < CURSOR_MAX; i++) {
61  delete myCursors[i];
62  }
63  */
64 }
65 
66 
67 void
69  assert(myInstance == 0);
70  myInstance = new GUICursorSubSys(a);
71 }
72 
73 
74 FXCursor*
76  return myInstance->myCursors[which];
77 }
78 
79 
80 void
82  delete myInstance;
83  myInstance = nullptr;
84 }
85 
86 
87 /****************************************************************************/
88 
GUICursorSubSys.h
GUICursorSubSys::myInstance
static GUICursorSubSys * myInstance
instance of GUICursorSubSys
Definition: GUICursorSubSys.h:55
GUICursorSubSys::initCursors
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
Definition: GUICursorSubSys.cpp:68
GUICursorSubSys::getCursor
static FXCursor * getCursor(GUICursor which)
returns a cursor previously defined in the enum GUICursor
Definition: GUICursorSubSys.cpp:75
GUICursorSubSys::~GUICursorSubSys
~GUICursorSubSys()
destructor
Definition: GUICursorSubSys.cpp:58
GUICursors.h
GUICursor
GUICursor
An enumeration of cursors used by the gui applications.
Definition: GUICursors.h:33
SUMOCURSOR_DEFAULT
default cursor
Definition: GUICursors.h:35
SUMOCURSOR_MOVE
move cursor
Definition: GUICursors.h:38
GUICursorSubSys::close
static void close()
close GUICursorSubSys
Definition: GUICursorSubSys.cpp:81
GUICursorSubSys::myCursors
FXCursor * myCursors[CURSOR_MAX]
vector with the icons
Definition: GUICursorSubSys.h:58
GUICursorSubSys::GUICursorSubSys
GUICursorSubSys(FXApp *a)
constructor is private because is called by the static function init(FXApp* a)
Definition: GUICursorSubSys.cpp:40
config.h
GUICursorSubSys
Definition: GUICursorSubSys.h:32