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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Helper for cursors loading and usage
19 /****************************************************************************/
20 #include <config.h>
21 
22 #include <fx.h>
23 #include <cassert>
24 #include "GUICursors.h"
25 #include "GUICursorSubSys.h"
26 
29 // ===========================================================================
30 // static member variable definitions
31 // ===========================================================================
32 
34 
35 // ===========================================================================
36 // member definitions
37 // ===========================================================================
38 
40  // already created cursor
41  myCursors[SUMOCURSOR_DEFAULT] = a->getDefaultCursor(DEF_ARROW_CURSOR);
42  myCursors[SUMOCURSOR_MOVE] = a->getDefaultCursor(DEF_MOVE_CURSOR);
43 
44  /*
45  myCursors[CURSOR_SUMO] = new FXXPMCursor(a, sumo_icon64_xpm);
46 
47  // ... and create them
48  for (int i = 0; i < CURSOR_MAX; i++) {
49  if (myCursors[i] != nullptr) {
50  myCursors[i]->create();
51  }
52  }
53  */
54 }
55 
56 
58  /*
59  for (int i = 0; i < CURSOR_MAX; i++) {
60  delete myCursors[i];
61  }
62  */
63 }
64 
65 
66 void
68  assert(myInstance == 0);
69  myInstance = new GUICursorSubSys(a);
70 }
71 
72 
73 FXCursor*
75  return myInstance->myCursors[which];
76 }
77 
78 
79 void
81  delete myInstance;
82  myInstance = nullptr;
83 }
84 
85 
86 /****************************************************************************/
GUICursor
An enumeration of cursors used by the gui applications.
Definition: GUICursors.h:31
@ SUMOCURSOR_MOVE
move cursor
Definition: GUICursors.h:36
@ SUMOCURSOR_DEFAULT
default cursor
Definition: GUICursors.h:33
static FXCursor * getCursor(GUICursor which)
returns a cursor previously defined in the enum GUICursor
static void close()
close GUICursorSubSys
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
GUICursorSubSys(FXApp *a)
constructor is private because is called by the static function init(FXApp* a)
static GUICursorSubSys * myInstance
instance of GUICursorSubSys
~GUICursorSubSys()
destructor
FXCursor * myCursors[CURSOR_MAX]
vector with the icons