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-2018 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 /****************************************************************************/
15 // Helper for cursors loading and usage
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <fx.h>
25 #include <cassert>
26 #include "GUICursors.h"
27 #include "GUICursorSubSys.h"
28 
31 // ===========================================================================
32 // static member variable definitions
33 // ===========================================================================
34 
36 
37 // ===========================================================================
38 // member definitions
39 // ===========================================================================
40 
42  // already created cursor
43  myCursors[SUMOCURSOR_DEFAULT] = a->getDefaultCursor(DEF_ARROW_CURSOR);
44  myCursors[SUMOCURSOR_MOVE] = a->getDefaultCursor(DEF_MOVE_CURSOR);
45 
46  /*
47  myCursors[CURSOR_SUMO] = new FXXPMCursor(a, sumo_icon64_xpm);
48 
49  // ... and create them
50  for (int i = 0; i < CURSOR_MAX; i++) {
51  if (myCursors[i] != nullptr) {
52  myCursors[i]->create();
53  }
54  }
55  */
56 }
57 
58 
60  /*
61  for (int i = 0; i < CURSOR_MAX; i++) {
62  delete myCursors[i];
63  }
64  */
65 }
66 
67 
68 void
70  assert(myInstance == 0);
71  myInstance = new GUICursorSubSys(a);
72 }
73 
74 
75 FXCursor*
77  return myInstance->myCursors[which];
78 }
79 
80 
81 void
83  delete myInstance;
84  myInstance = nullptr;
85 }
86 
87 
88 /****************************************************************************/
89 
default cursor
Definition: GUICursors.h:36
static FXCursor * getCursor(GUICursor which)
returns a cursor previously defined in the enum GUICursor
move cursor
Definition: GUICursors.h:39
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
GUICursor
An enumeration of cursors used by the gui applications.
Definition: GUICursors.h:34
FXCursor * myCursors[CURSOR_MAX]
vector with the icons
GUICursorSubSys(FXApp *a)
constructor is private because is called by the static function init(FXApp* a)
~GUICursorSubSys()
destructor
static GUICursorSubSys * myInstance
instance of GUICursorSubSys
static void close()
close GUICursorSubSys