fixed bug in text that ignored position in a container.
OBJS = \
obj/button.o \
+ obj/diskwindow.o \
obj/draggablewindow.o \
obj/draggablewindow2.o \
obj/element.o \
void Button::HandleMouseMove(uint32 x, uint32 y)
{
+ if (!visible)
+ return;
+
SaveStateVariables();
inside = Inside(x, y);
CheckStateAndRedrawIfNeeded();
void Button::HandleMouseButton(uint32 x, uint32 y, bool mouseDown)
{
+ if (!visible)
+ return;
+
SaveStateVariables();
if (inside)
#ifdef DEBUG_GUI_BUTTON
WriteLog("Button::Draw()...\n");
#endif
+ if (!visible)
+ return;
+
if (buttonUp == NULL)
return; // Bail out if no surface was created...
bool Element::needToRefreshScreen = false;
Element::Element(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*= 0*/, uint32 h/*= 0*/,
- Element * parentElement/*= NULL*/): parent(parentElement), backstore(NULL)
+ Element * parentElement/*= NULL*/): parent(parentElement), backstore(NULL), visible(true)
{
extents.x = x,
extents.y = y,
Element::Element(uint32 x, uint32 y, uint32 w, uint32 h,
uint8 fgR/*= 0xFF*/, uint8 fgG/*= 0xFF*/, uint8 fgB/*= 0xFF*/, uint8 fgA/*= 0xFF*/,
uint8 bgR/*= 0x00*/, uint8 bgG/*= 0x00*/, uint8 bgB/*= 0x00*/, uint8 bgA/*= 0xFF*/,
- Element * parentElement/*= NULL*/): parent(parentElement), backstore(NULL)
+ Element * parentElement/*= NULL*/): parent(parentElement), backstore(NULL), visible(true)
{
extents.x = x,
extents.y = y,
}
}
+void Element::SetVisible(bool visibility)
+{
+ visible = visibility;
+}
+
//
// Class methods
//
void ResetCoverageList(void);
//Need something to prevent this on Elements that don't have mouseover effects...
void AdjustCoverageList(SDL_Rect r);
+ void SetVisible(bool);
// Class methods...
static void SetScreen(SDL_Surface *);
static bool ScreenNeedsRefreshing(void);
uint32 bgColor;
SDL_Surface * backstore;
std::list<SDL_Rect> coverList;
+ bool visible;
// Class variables...
static SDL_Surface * screen;
#include "window.h"
#include "button.h"
#include "text.h"
+#include "diskwindow.h"
#include "video.h"
#include "apple2.h"
If hit 'new blank image':
If disk in drive, ask if want to save if modified
else, load it
-
+If hit 'swap disks', swap disks.
*/
windowList.push_back(new Button(30, 250, "Click!"));
windowList.push_back(new Text(30, 20, floppyDrive.GetImageName(0)));
windowList.push_back(new Text(30, 130, floppyDrive.GetImageName(1)));
+ windowList.push_back(new DiskWindow(&floppyDrive, 240, 20));
}
GUI::~GUI()
void Text::Draw(void)
{
if (text.length() > 0)
+ {
// DrawString(screenBuffer, extents.x + offsetX, extents.y + offsetY, false, "%s", text.c_str());
- DrawStringOpaque(screen, extents.x, extents.y, fgColor, bgColor, "%s", text.c_str());
+ SDL_Rect r = GetScreenCoords();
+ DrawStringOpaque(screen, r.x, r.y, fgColor, bgColor, "%s", text.c_str());
+ }
}