1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | This program is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | GNU General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU General Public License |
---|
17 | along with this program; if not, write to the Free Software Foundation, |
---|
18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
19 | |
---|
20 | |
---|
21 | ### File Specific: |
---|
22 | main-programmer: Benjamin Grauer |
---|
23 | |
---|
24 | */ |
---|
25 | |
---|
26 | #include "orxonox_gui_banner.h" |
---|
27 | #include <iostream.h> |
---|
28 | |
---|
29 | /** |
---|
30 | \brief Creates a new BannerEventBox and its content. |
---|
31 | */ |
---|
32 | OrxonoxGuiBanner::OrxonoxGuiBanner () |
---|
33 | { |
---|
34 | bannerEventBox = new EventBox ("BannerEventBox"); |
---|
35 | bannerImage = new Image ("banner.xpm"); |
---|
36 | bannerEventBox->fill(bannerImage); |
---|
37 | bannerEventBox->connectSignal ("button_press_event", this, LogoWindowOpen); |
---|
38 | logoWindowIsOpen = -1; |
---|
39 | } |
---|
40 | |
---|
41 | /** |
---|
42 | \brief Destructs it. |
---|
43 | */ |
---|
44 | OrxonoxGuiBanner::~OrxonoxGuiBanner () |
---|
45 | { |
---|
46 | } |
---|
47 | |
---|
48 | /** |
---|
49 | \brief Opens up our LOGO-Window.\n |
---|
50 | it creates a new one if it has not yet been opened.\n |
---|
51 | it shows it if it has been created |
---|
52 | */ |
---|
53 | void OrxonoxGuiBanner::logoWindowNew() |
---|
54 | { |
---|
55 | if (logoWindowIsOpen <= 0) |
---|
56 | { |
---|
57 | if (logoWindowIsOpen < 0) |
---|
58 | { |
---|
59 | // creating new Logo Window // |
---|
60 | logoWindow = new Window("Logo"); |
---|
61 | logoWindow->connectSignal("destroy", this, LogoWindowClose); |
---|
62 | logoWindow->connectSignal("delete_event", this, LogoWindowClose); |
---|
63 | logoEventBox = new EventBox(); |
---|
64 | logoBox = new Box('v'); |
---|
65 | logoLabel = new Label("OrxOnoX, " PACKAGE_VERSION); |
---|
66 | logoImage = new Image("banner.xpm"); |
---|
67 | logoEventBox->fill(logoImage); |
---|
68 | |
---|
69 | logoBox->fill(logoLabel); |
---|
70 | logoBox->fill(logoEventBox); |
---|
71 | logoEventBox->connectSignal("button_press_event",this,LogoWindowClose); |
---|
72 | |
---|
73 | logoWindow->fill (logoBox); |
---|
74 | |
---|
75 | } |
---|
76 | // showing Window // |
---|
77 | logoWindowIsOpen = 1; |
---|
78 | |
---|
79 | |
---|
80 | logoWindow->showall(); |
---|
81 | } |
---|
82 | } |
---|
83 | |
---|
84 | /** |
---|
85 | \brief Hides Window through ~Window(); |
---|
86 | */ |
---|
87 | void OrxonoxGuiBanner::logoWindowClose() |
---|
88 | { |
---|
89 | logoWindowIsOpen = 0; |
---|
90 | logoWindow->hide(); |
---|
91 | } |
---|
92 | |
---|
93 | /** |
---|
94 | \brief Returns an EventBox |
---|
95 | \return The EventBox, that holds the Banner. |
---|
96 | */ |
---|
97 | Widget* OrxonoxGuiBanner::getWidget () |
---|
98 | { |
---|
99 | return bannerEventBox; |
---|
100 | } |
---|
101 | |
---|
102 | /** |
---|
103 | \brief opens up the banner-window.\n |
---|
104 | this is the Signal that does it. !!SIGNALS ARE STATIC!! |
---|
105 | \param widget the widget that did it! |
---|
106 | \param event the event that did it! |
---|
107 | \param banner the Object that holds the banner-logo-window |
---|
108 | */ |
---|
109 | gint LogoWindowOpen (GtkWidget* widget, GdkEvent* event, void* banner) |
---|
110 | { |
---|
111 | static_cast<OrxonoxGuiBanner*>(banner)->logoWindowNew(); |
---|
112 | } |
---|
113 | |
---|
114 | /** |
---|
115 | \brief closes the banner-window.\n |
---|
116 | this is the Signal that does it. !!SIGNALS ARE STATIC!! |
---|
117 | \param widget the widget that did it! |
---|
118 | \param event the event that did it! |
---|
119 | \param banner the Object that holds the banner-logo-window |
---|
120 | */ |
---|
121 | gint LogoWindowClose (GtkWidget *widget, GdkEvent* event, void* banner) |
---|
122 | { |
---|
123 | static_cast<OrxonoxGuiBanner*>(banner)->logoWindowClose(); |
---|
124 | |
---|
125 | } |
---|