window->UseRIP(how, when);
}
+char * NetHackQtBind::qt_getmsghistory(BOOLEAN_P init)
+{
+ NetHackQtMessageWindow* window = main->GetMessageWindow();
+ if (window)
+ return (char *)window->GetStr(init);
+ return NULL;
+}
+
+void NetHackQtBind::qt_putmsghistory(const char *msg, BOOLEAN_P is_restoring)
+{
+ NetHackQtMessageWindow* window = main->GetMessageWindow();
+ //raw_printf("msg='%s'", msg);
+ if (window && msg)
+ window->PutStr(ATR_NONE, QString::fromLatin1(msg));
+}
+
+void NetHackQtBind::qt_putmsghistory(const std::string& msg, BOOLEAN_P is_restoring)
+{
+ NetHackQtMessageWindow* window = main->GetMessageWindow();
+ if (window)
+ window->PutStr(ATR_NONE, QString::fromLatin1(msg.c_str(), msg.size()));
+}
+
+
bool NetHackQtBind::notify(QObject *receiver, QEvent *event)
{
// Ignore Alt-key navigation to menubar, it's annoying when you
#endif
genl_preference_update,
- genl_getmsghistory, genl_putmsghistory,
+ nethack_qt4::NetHackQtBind::qt_getmsghistory,
+ nethack_qt4::NetHackQtBind::qt_putmsghistory,
genl_status_init,
genl_status_finish, genl_status_enablefield,
#ifdef STATUS_HILITES
static void qt_start_screen();
static void qt_end_screen();
+ static char *qt_getmsghistory(BOOLEAN_P init);
+ static void qt_putmsghistory(const char *msg, BOOLEAN_P is_restoring);
+ static void qt_putmsghistory(const std::string& msg, BOOLEAN_P is_restoring);
+
static void qt_outrip(winid wid, int how, time_t when);
static int qt_kbhit();
ShowIfReady();
}
+NetHackQtMessageWindow * NetHackQtMainWindow::GetMessageWindow()
+{
+ return message;
+}
+
void NetHackQtMainWindow::AddMapWindow(NetHackQtMapWindow2* window)
{
NetHackQtMainWindow(NetHackQtKeyBuffer&);
void AddMessageWindow(NetHackQtMessageWindow* window);
+ NetHackQtMessageWindow * GetMessageWindow();
void AddMapWindow(NetHackQtMapWindow2* window);
void AddStatusWindow(NetHackQtStatusWindow* window);
void RemoveWindow(NetHackQtWindow* window);
list->setFocusPolicy(Qt::NoFocus);
::iflags.window_inited = 1;
map = 0;
+ currgetmsg = 0;
connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(updateFont()));
updateFont();
}
}
}
+const char * NetHackQtMessageWindow::GetStr(bool init)
+{
+ if (init)
+ currgetmsg = 0;
+
+ QListWidgetItem *item = list->item(++currgetmsg);
+ if (item) {
+ QString str = item->text();
+ //raw_printf("getstr[%i]='%s'", currgetmsg, str.toLatin1().constData());
+ return str.toLatin1().constData();
+ }
+ return NULL;
+}
+
void NetHackQtMessageWindow::PutStr(int attr, const QString& text)
{
#ifdef USER_SOUNDS
virtual QWidget* Widget();
virtual void Clear();
virtual void Display(bool block);
+ virtual const char *GetStr(bool init);
virtual void PutStr(int attr, const QString& text);
void Scroll(int dx, int dy);
private:
QListWidget* list;
bool changed;
+ int currgetmsg;
NetHackQtMapWindow2* map;
private slots: