qtgui: minor include fiddling
[openc2e.git] / Bubble.h
blob32cd3781903b42f167accf821a5e93f023aac0a0
1 /*
2 * Bubble.h
3 * openc2e
5 * Created by Alyssa Milburn on Sat Apr 26 2008.
6 * Copyright (c) 2008 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #include "CompoundAgent.h"
22 #ifndef _C2E_BUBBLE_H
23 #define _C2E_BUBBLE_H
25 class Bubble : public CompoundAgent {
26 friend class BubblePart;
28 protected:
29 class BubblePart *ourPart;
30 unsigned int timeout;
32 void turnIntoSpeech();
34 public:
35 Bubble(unsigned char family, unsigned char genus, unsigned short species, unsigned int plane,
36 std::string spritefile, unsigned int firstimage, unsigned int imagecount,
37 unsigned int tx, unsigned int ty, unsigned int twidth, unsigned int theight,
38 unsigned int bgcolour, unsigned int tcolour);
40 void setText(std::string s);
41 std::string getText();
43 void setEditing(bool e);
45 void setTimeout(unsigned int i);
46 void tick();
49 class BubblePart : public CompoundPart {
50 friend class Bubble;
52 protected:
53 BubblePart(Bubble *p, unsigned int _id, int x, int y);
55 bool editable;
56 std::string text;
57 unsigned int textwidth, textheight;
58 unsigned int textoffset;
59 unsigned int backgroundcolour, textcolour;
61 void setText(std::string s);
63 public:
64 void partRender(class Surface *renderer, int xoffset, int yoffset);
65 unsigned int getWidth() { return textwidth; }
66 unsigned int getHeight() { return textheight; }
68 bool canGainFocus() { return editable; }
69 void gainFocus();
70 void loseFocus();
71 void handleKey(char c);
72 void handleSpecialKey(char c);
75 #endif
76 /* vim: set noet: */