Skip to content

Commit

Permalink
ifc gui_fenster_t was not needed since some time
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@3492 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
prissi committed Jul 3, 2010
1 parent 101c004 commit 11e4c4b
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 206 deletions.
2 changes: 1 addition & 1 deletion gui/banner.cc
Expand Up @@ -21,7 +21,7 @@
#include "banner.h"


banner_t::banner_t()
banner_t::banner_t() : gui_frame_t("")
{
last_ms = dr_time();
line = 0;
Expand Down
4 changes: 2 additions & 2 deletions gui/banner.h
Expand Up @@ -8,7 +8,7 @@
#ifndef banner_h
#define banner_h

#include "../ifc/gui_fenster.h"
#include "gui_frame.h"


/**
Expand All @@ -17,7 +17,7 @@
*
* @author Hj. Malthaner
*/
class banner_t : public gui_fenster_t
class banner_t : public gui_frame_t
{
private:
sint32 last_ms;
Expand Down
9 changes: 4 additions & 5 deletions gui/components/gui_button.cc
Expand Up @@ -6,6 +6,7 @@
*/

#include "gui_button.h"
#include "../gui_frame.h"

#include "../../simdebug.h"
#include "../../simcolor.h"
Expand All @@ -20,8 +21,6 @@
#include "../../simskin.h"
#include "../../besch/skin_besch.h"

#include "../../ifc/gui_fenster.h"

#define STATE_MASK (127)
#define AUTOMATIC_MASK (255)
static const char *empty="";
Expand Down Expand Up @@ -469,7 +468,7 @@ void button_t::zeichnen(koord offset)

case box: // old, 4-line box
{
gui_fenster_t *win = win_get_top();
gui_frame_t *win = win_get_top();
if( win && win->get_focus()==this ) {
// white box around
display_fillbox_wh_clip(bx-1, by+bh, bw+2, 1, COL_WHITE, false);
Expand All @@ -489,7 +488,7 @@ void button_t::zeichnen(koord offset)

case roundbox: // new box with round corners
{
gui_fenster_t *win = win_get_top();
gui_frame_t *win = win_get_top();
if( win && win->get_focus()==this ) {
// white box around
display_fillbox_wh_clip(bx-1, by-1, bw+2, 1, COL_WHITE, false);
Expand All @@ -507,7 +506,7 @@ void button_t::zeichnen(koord offset)

case square: // little square in front of text
{
gui_fenster_t *win = win_get_top();
gui_frame_t *win = win_get_top();
if( win && win->get_focus()==this ) {
// white box around
display_fillbox_wh_clip(bx+16, by+(12+large_font_height)/2-2, bw-14, 1, COL_WHITE, false);
Expand Down
4 changes: 2 additions & 2 deletions gui/components/gui_combobox.cc
Expand Up @@ -7,9 +7,9 @@

#include <string.h>

#include "../../ifc/gui_fenster.h"
#include "../../macros.h"
#include "../../simdebug.h"
#include "../gui_frame.h"
#include "gui_combobox.h"
#include "../../simevent.h"
#include "../../simgraph.h"
Expand Down Expand Up @@ -171,7 +171,7 @@ void gui_combobox_t::zeichnen(koord offset)
tstrncpy(editstr, item->get_text(), lengthof(editstr));
}

gui_fenster_t *win = win_get_top();
gui_frame_t *win = win_get_top();
textinp.display_with_focus( offset,(win && win->get_focus()==this) );

if (droplist.is_visible()) {
Expand Down
6 changes: 3 additions & 3 deletions gui/components/gui_numberinput.cc
Expand Up @@ -5,8 +5,8 @@
* (see licence.txt)
*/

#include "../gui_frame.h"
#include "gui_numberinput.h"
#include "../../ifc/gui_fenster.h"
#include "../../simwin.h"
#include "../../simgraph.h"
#include "../../macros.h"
Expand Down Expand Up @@ -57,7 +57,7 @@ void gui_numberinput_t::set_groesse(koord groesse)
void gui_numberinput_t::set_value(sint32 new_value)
{ // range check
value = clamp( new_value, min_value, max_value );
gui_fenster_t *win = win_get_top();
gui_frame_t *win = win_get_top();
if( win && win->get_focus()!=this ) {
// final value should be correct, but during editing wrng values are allowed
new_value = value;
Expand Down Expand Up @@ -318,7 +318,7 @@ void gui_numberinput_t::zeichnen(koord offset)
koord new_offset = pos+offset;
bt_left.zeichnen(new_offset);

gui_fenster_t *win = win_get_top();
gui_frame_t *win = win_get_top();
textinp.display_with_focus( new_offset, (win && win->get_focus()==this) );
bt_right.zeichnen(new_offset);

Expand Down
4 changes: 2 additions & 2 deletions gui/components/gui_textinput.cc
Expand Up @@ -8,7 +8,7 @@
#include <string.h>

#include "../../simdebug.h"
#include "../../ifc/gui_fenster.h"
#include "../gui_frame.h"
#include "gui_textinput.h"
#include "../../simevent.h"
#include "../../simgraph.h"
Expand Down Expand Up @@ -201,7 +201,7 @@ DBG_DEBUG("gui_textinput_t::gui_textinput_t()","cursor_pos=%i, cx=%i",cursor_pos
*/
void gui_textinput_t::zeichnen(koord offset)
{
gui_fenster_t *const win = win_get_top();
gui_frame_t *const win = win_get_top();
display_with_focus( offset, (win && win->get_focus()==this) );
}

Expand Down
2 changes: 1 addition & 1 deletion gui/convoi_frame.h
Expand Up @@ -61,7 +61,7 @@ class convoi_frame_t :
/*
* Child window, if open
*/
gui_fenster_t *filter_frame;
gui_frame_t *filter_frame;

/*
* All filter settings are static, so they are not reset each
Expand Down
2 changes: 1 addition & 1 deletion gui/depot_frame.cc
Expand Up @@ -1156,7 +1156,7 @@ void depot_frame_t::fahrplaneingabe()
// this can happen locally, since any update of the schedule is done during closing window
schedule_t *fpl = cnv->create_schedule();
assert(fpl!=NULL);
gui_fenster_t *fplwin = win_get_magic((long)fpl);
gui_frame_t *fplwin = win_get_magic((long)fpl);
if( fplwin==NULL ) {
cnv->open_schedule_window( get_welt()->get_active_player()==cnv->get_besitzer() );
}
Expand Down
2 changes: 1 addition & 1 deletion gui/gui_frame.cc
Expand Up @@ -28,7 +28,7 @@ gui_frame_t::gui_frame_t(char const* const name, spieler_t const* const sp)
groesse = koord(200, 100);
owner = sp;
container.set_pos(koord(0,16));
set_resizemode (no_resize); //25-may-02 markus weber added
set_resizemode(no_resize); //25-may-02 markus weber added
dirty = true;
}

Expand Down
77 changes: 66 additions & 11 deletions gui/gui_frame.h
Expand Up @@ -12,11 +12,14 @@
#ifndef gui_gui_frame_h
#define gui_gui_frame_h

#include "../ifc/gui_fenster.h"
#include "../dataobj/koord.h"
#include "../simgraph.h"
#include "gui_container.h"
#include "../player/simplay.h"
#include "../simcolor.h"

// height of titlebar
#define TITLEBAR_HEIGHT (16)

/**
* Eine Klasse für Fenster mit Komponenten.
Expand All @@ -26,8 +29,18 @@
*
* @author Hj. Malthaner
*/
class gui_frame_t : virtual public gui_fenster_t
class gui_frame_t
{
public:
/**
* Resize modes
* @author Markus Weber
* @date 11-May-2002
*/
enum resize_modes {
no_resize = 0, vertical_resize = 1, horizonal_resize = 2, diagonal_resize = 3
};

private:
gui_container_t container;

Expand Down Expand Up @@ -67,6 +80,8 @@ class gui_frame_t : virtual public gui_fenster_t
*/
gui_frame_t(const char *name, const spieler_t *sp=NULL);

virtual ~gui_frame_t() {}

/**
* Fügt eine Komponente zum Fenster hinzu.
* @author Hj. Malthaner
Expand Down Expand Up @@ -132,22 +147,35 @@ class gui_frame_t : virtual public gui_fenster_t
*/
koord get_client_windowsize() const {return groesse-koord(0,16); }

virtual bool has_sticky() const { return true; }

/**
* Events werden hiermit an die GUI-Komponenten
* gemeldet
* Manche Fenster haben einen Hilfetext assoziiert.
* @return den Dateinamen für die Hilfe, oder NULL
* @author Hj. Malthaner
*/
virtual bool infowin_event(const event_t *ev);
virtual const char * get_hilfe_datei() const {return NULL;}

/**
* komponente neu zeichnen. Die übergebenen Werte beziehen sich auf
* das Fenster, d.h. es sind die Bildschirkoordinaten des Fensters
* in dem die Komponente dargestellt wird.
* Does this window need a min size button in the title bar?
* @return true if such a button is needed
* @author Hj. Malthaner
*/
virtual void zeichnen(koord pos, koord gr);
virtual bool has_min_sizer() const {return false;}

/**
* Does this window need a next button in the title bar?
* @return true if such a button is needed
* @author Volker Meyer
*/
virtual bool has_next() const {return false;}

/**
* Does this window need a prev button in the title bar?
* @return true if such a button is needed
* @author Volker Meyer
*/
virtual bool has_prev() const {return has_next();}

virtual bool has_sticky() const { return true; }

/**
* Set resize mode
Expand All @@ -163,6 +191,33 @@ class gui_frame_t : virtual public gui_fenster_t
*/
resize_modes get_resizemode(void) { return resize_mode; }

/**
* Prüft, ob eine Position innerhalb der Komponente liegt.
* @author Hj. Malthaner
*/
virtual bool getroffen(int x, int y)
{
koord groesse = get_fenstergroesse();
return ( x>=0 && y>=0 && x<groesse.x && y<groesse.y );
}

/**
* Events werden hiermit an die GUI-Komponenten
* gemeldet
* @author Hj. Malthaner
*/
virtual bool infowin_event(const event_t *ev);

/**
* komponente neu zeichnen. Die übergebenen Werte beziehen sich auf
* das Fenster, d.h. es sind die Bildschirkoordinaten des Fensters
* in dem die Komponente dargestellt wird.
* @author Hj. Malthaner
*/
virtual void zeichnen(koord pos, koord gr);

// called, when the map is rotated
virtual void map_rotate90( sint16 /*new_ysize*/ ) { }

void set_focus( gui_komponente_t *k ) { container.set_focus(k); }
virtual gui_komponente_t *get_focus() { return container.get_focus(); }
Expand Down
2 changes: 1 addition & 1 deletion gui/halt_list_frame.h
Expand Up @@ -70,7 +70,7 @@ class halt_list_frame_t : public gui_frame_t , private action_listener_t
/*
* Child window, if open
*/
gui_fenster_t *filter_frame;
gui_frame_t *filter_frame;

/*
* All filter settings are static, so they are not reset each
Expand Down
4 changes: 2 additions & 2 deletions gui/welt.cc
Expand Up @@ -426,7 +426,7 @@ welt_gui_t::action_triggered( gui_action_creator_t *komp,value_t v)
allow_player_change.pressed = sets->get_allow_player_change();
}
else if(komp==&open_setting_gui) {
gui_fenster_t *sg = win_get_magic( magic_settings_frame_t );
gui_frame_t *sg = win_get_magic( magic_settings_frame_t );
if( sg ) {
destroy_win( sg );
open_setting_gui.pressed = false;
Expand All @@ -437,7 +437,7 @@ welt_gui_t::action_triggered( gui_action_creator_t *komp,value_t v)
}
}
else if(komp==&open_climate_gui) {
gui_fenster_t *climate_gui = win_get_magic( magic_climate );
gui_frame_t *climate_gui = win_get_magic( magic_climate );
if( climate_gui ) {
destroy_win( climate_gui );
open_climate_gui.pressed = false;
Expand Down
12 changes: 6 additions & 6 deletions gui/werkzeug_waehler.cc
Expand Up @@ -19,13 +19,13 @@


werkzeug_waehler_t::werkzeug_waehler_t(karte_t* welt, const char* titel, const char *helpfile, koord icon, bool allow_break) :
tools(0), groesse(icon)
tools(0), gui_frame_t(titel)
{
this->allow_break = allow_break;
this->welt = welt;
this->titel = titel;
this->hilfe_datei = helpfile;
this->icon = icon;
set_fenstergroesse( icon );
dirty = true;
}

Expand Down Expand Up @@ -55,7 +55,7 @@ DBG_DEBUG("werkzeug_waehler_t::add_tool()","ww=%i, rows=%i",ww,rows);
tool_icon_width = (tool_icon_width+rows-1)/rows;
}
dirty = true;
groesse = koord( tool_icon_width*icon.x, ((tools.get_count()-1)/tool_icon_width) * icon.y + 16 + icon.y );
gui_frame_t::set_fenstergroesse( koord( tool_icon_width*icon.x, ((tools.get_count()-1)/tool_icon_width) * icon.y + TITLEBAR_HEIGHT + icon.y ) );

DBG_DEBUG("werkzeug_waehler_t::add_tool()", "at position %i (width %i)", tools.get_count(), tool_icon_width);
}
Expand All @@ -69,7 +69,7 @@ void werkzeug_waehler_t::reset_tools()
i--;
tools.remove_at(i);
}
groesse = koord( icon.x, 16 );
gui_frame_t::set_fenstergroesse( koord( icon.x, TITLEBAR_HEIGHT ) );
tool_icon_width = 0;
}

Expand All @@ -78,8 +78,8 @@ bool werkzeug_waehler_t::getroffen(int x, int y)
{
int dx = x/icon.x;
int dy = (y-16)/icon.y;
if(x>=0 && dx<tool_icon_width && y>=0 && (y<16 || dy<tool_icon_width)) {
return y < 16 || dx + tool_icon_width * dy < (int)tools.get_count();
if(x>=0 && dx<tool_icon_width && y>=0 && (y<TITLEBAR_HEIGHT || dy<tool_icon_width)) {
return y < TITLEBAR_HEIGHT || dx + tool_icon_width * dy < (int)tools.get_count();
}
return false;
}
Expand Down
10 changes: 2 additions & 8 deletions gui/werkzeug_waehler.h
Expand Up @@ -9,15 +9,15 @@
#ifndef gui_werkzeug_waehler_h
#define gui_werkzeug_waehler_h

#include "../ifc/gui_fenster.h"
#include "gui_frame.h"
#include "../tpl/vector_tpl.h"
//#include "../simmenu.h"

class karte_t;
class werkzeug_t;


class werkzeug_waehler_t : public gui_fenster_t
class werkzeug_waehler_t : public gui_frame_t
{
private:
koord icon; // size of symbols here
Expand Down Expand Up @@ -67,21 +67,15 @@ class werkzeug_waehler_t : public gui_fenster_t
// purges toolbar
void reset_tools();

const char *get_name() const {return titel;}

/**
* Manche Fenster haben einen Hilfetext assoziiert.
* @return den Dateinamen für die Hilfe, oder NULL
* @author Hj. Malthaner
*/
const char *get_hilfe_datei() const {return hilfe_datei;}

koord get_fenstergroesse() const { return groesse; }

PLAYER_COLOR_VAL get_titelcolor() const { return WIN_TITEL; }

bool has_sticky() const { return true; }

/* returns true, if inside window area ...
* @author Hj. Malthaner
*/
Expand Down

0 comments on commit 11e4c4b

Please sign in to comment.