Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/console/orxonox_console_entry.cc @ 3153

Last change on this file since 3153 was 2019, checked in by bensch, 20 years ago

orxonox/trunk: now everything should compile in Windows and Linux

File size: 2.1 KB
Line 
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   co-programmer:
24*/
25
26
27#include "orxonox_console_entry.h"
28
29
30
31OrxonoxConsoleEntry::OrxonoxConsoleEntry(void)
32{}
33
34OrxonoxConsoleEntry::OrxonoxConsoleEntry(OrxonoxConsoleLog* log)
35{
36  consoleLog = log; 
37}
38
39
40GtkWidget* OrxonoxConsoleEntry::createEntry()
41{
42  frame = gtk_frame_new ("Console Entry:");
43
44
45  gtk_container_set_border_width (GTK_CONTAINER(frame), 5);
46  {
47    entrybox = gtk_hbox_new (FALSE, 5);
48    {
49      entry = gtk_entry_new();
50      g_signal_connect(GTK_ENTRY(entry), "activate", G_CALLBACK(submit), this);
51      gtk_box_pack_start(GTK_BOX(entrybox), entry, TRUE, TRUE, 5);
52     
53     
54      button = gtk_button_new_with_label("Submit");
55      g_signal_connect(GTK_BUTTON(button), "clicked", G_CALLBACK(submit), this);
56      gtk_box_pack_start(GTK_BOX(entrybox), button, FALSE, FALSE, 5);
57    }
58    gtk_container_add(GTK_CONTAINER(frame), entrybox);
59  }
60  return (frame);
61}
62
63void OrxonoxConsoleEntry::setLog(OrxonoxConsoleLog* log)
64{
65  consoleLog = log;
66}
67
68
69void OrxonoxConsoleEntry::submit(GtkWidget *widget,  OrxonoxConsoleEntry* entry)
70{
71  char* entryText = (char*)gtk_entry_get_text(GTK_ENTRY(entry->entry));
72  entry->sendtoLog(entryText);
73  gtk_entry_set_text(GTK_ENTRY(entry->entry),"");
74  return;
75}
76
77
78void OrxonoxConsoleEntry::sendtoLog(char* submitText)
79{
80  consoleLog->appendText(submitText);
81  return;
82}
Note: See TracBrowser for help on using the repository browser.