Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUICursorSubSys.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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
23
24#include "GUICursors.h"
25#include "GUICursorSubSys.h"
26
27#include "Delete_cursor.cpp"
28#include "Select_cursor.cpp"
29#include "SelectLane_cursor.cpp"
30#include "Inspect_cursor.cpp"
33
34// ===========================================================================
35// static member variable definitions
36// ===========================================================================
37
39
40// ===========================================================================
41// member definitions
42// ===========================================================================
43
45 // default cursors (already created)
46 myCursors[GUICursor::DEFAULT] = a->getDefaultCursor(DEF_ARROW_CURSOR);
47 myCursors[GUICursor::MOVEVIEW] = a->getDefaultCursor(DEF_MOVE_CURSOR);
48
49 // custom cursors (must be created)
50 myCursors[GUICursor::DELETE_CURSOR] = new FXGIFCursor(a, Delete_cursor, 1, 2);
51 myCursors[GUICursor::SELECT] = new FXGIFCursor(a, Select_cursor, 1, 1);
52 myCursors[GUICursor::SELECT_LANE] = new FXGIFCursor(a, SelectLane_cursor, 1, 1);
53 myCursors[GUICursor::INSPECT] = new FXGIFCursor(a, Inspect_cursor, 1, 2);
54 myCursors[GUICursor::INSPECT_LANE] = new FXGIFCursor(a, InspectLane_cursor, 1, 2);
55 myCursors[GUICursor::MOVEELEMENT] = new FXGIFCursor(a, MoveElement_cursor, 1, 2);
56
57 // ... and create them
58 for (const auto& cursor : myCursors) {
59 if (cursor.second != nullptr) {
60 cursor.second->create();
61 }
62 }
63
64}
65
66
68 // delete all cursors
69 for (const auto& cursor : myCursors) {
70 if (cursor.first != GUICursor::DEFAULT && cursor.first != GUICursor::MOVEVIEW) {
71 delete cursor.second;
72 }
73 }
74}
75
76
77void
79 if (myInstance == nullptr) {
81 } else {
82 throw ProcessError("GUICursorSubSys already init");
83 }
84}
85
86
87FXCursor*
91
92
93void
95 // delete and reset instance
96 delete myInstance;
97 myInstance = nullptr;
98}
99
100
101/****************************************************************************/
const unsigned char Delete_cursor[]
GUICursor
An enumeration of cursors used by the gui applications.
Definition GUICursors.h:31
@ MOVEELEMENT
move element cursor
@ MOVEVIEW
move view cursor
@ SELECT_LANE
select lanecursor
@ DEFAULT
default cursor
@ SELECT
select cursor
@ DELETE_CURSOR
delete cursor
@ INSPECT_LANE
inspect lane cursor
@ INSPECT
inspect cursor
const unsigned char Inspect_cursor[]
const unsigned char InspectLane_cursor[]
const unsigned char MoveElement_cursor[]
const unsigned char Select_cursor[]
const unsigned char SelectLane_cursor[]
static FXCursor * getCursor(GUICursor which)
returns a cursor previously defined in the enum GUICursor
std::map< GUICursor, FXCursor * > myCursors
vector with the icons
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