summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buddywindow.cpp12
-rw-r--r--src/gui/chat.cpp6
-rw-r--r--src/gui/chat.h3
3 files changed, 19 insertions, 2 deletions
diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp
index 748ecb97..d2a20ffe 100644
--- a/src/gui/buddywindow.cpp
+++ b/src/gui/buddywindow.cpp
@@ -24,6 +24,9 @@
#include "buddywindow.h"
#include "scrollarea.h"
#include "button.h"
+#include "chat.h"
+
+extern ChatWindow *chatWindow;
BuddyWindow::BuddyWindow():
Window("Buddy")
@@ -35,7 +38,7 @@ BuddyWindow::BuddyWindow():
scrollArea = new ScrollArea(listbox);
scrollArea->setDimension(gcn::Rectangle(
- 2, 0, 116, 180));
+ 2, 0, 114, 176));
add(scrollArea);
talk = new Button("Talk");
@@ -68,7 +71,12 @@ BuddyWindow::~BuddyWindow()
void BuddyWindow::action(const std::string& eventId)
{
if (eventId == "Talk") {
- // TODO
+ int selected = listbox->getSelected();
+ if ( selected > -1 )
+ {
+ std::string who = getElementAt(selected);
+ chatWindow->setInputText(who +": ");
+ }
}
else if (eventId == "Remove") {
int selected = listbox->getSelected();
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 8a11969a..c02f5160 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -327,3 +327,9 @@ void ChatWindow::keyPress(const gcn::Key &key)
chatInput->setCaretPosition(chatInput->getText().length());
}
}
+
+void ChatWindow::setInputText(std::string input_str)
+{
+ chatInput->setText(input_str + " ");
+ requestChatFocus();
+}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index dfb0ba85..f459b804 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -184,6 +184,9 @@ class ChatWindow : public Window, public gcn::ActionListener,
/** Called when key is pressed */
void keyPress(const gcn::Key& key);
+ /** Called to set current text */
+ void setInputText(std::string input_str);
+
private:
std::ofstream chatlog_file;