23 #ifndef BAGEL_BOFLIB_GUI_WINDOW_H 24 #define BAGEL_BOFLIB_GUI_WINDOW_H 26 #include "common/list.h" 27 #include "common/events.h" 28 #include "bagel/boflib/array.h" 29 #include "bagel/boflib/stdinc.h" 30 #include "bagel/boflib/error.h" 31 #include "bagel/boflib/object.h" 32 #include "bagel/boflib/point.h" 33 #include "bagel/boflib/rect.h" 34 #include "bagel/boflib/size.h" 35 #include "bagel/boflib/timer.h" 36 #include "bagel/boflib/llist.h" 37 #include "bagel/boflib/gfx/bitmap.h" 38 #include "bagel/boflib/gfx/palette.h" 39 #include "bagel/boflib/gfx/text.h" 45 #define USE_DEFAULT (-1) 48 class CBofTimerPacket;
55 uint32 _lastLButtonTime = 0, _lastRButtonTime = 0;
91 static ErrorCode initialize();
92 static ErrorCode shutdown();
106 virtual ErrorCode
create(
const char *pszName,
int x,
int y,
int nWidth,
int nHeight,
CBofWindow *pParent, uint32 nControlID = 0);
122 virtual void destroyWindow() {
149 void move(
int x,
int y,
bool bRepaint =
false);
158 virtual ErrorCode close() {
170 void postMessage(uint32 nMessage, uint32 lParam1, uint32 lParam2);
183 void setTimer(uint32 nID, uint32 nInterval, BofCallback pCallBack =
nullptr);
210 return _pActiveWindow;
214 _pActiveWindow =
this;
231 return _cRect.width();
234 return _cRect.height();
259 ErrorCode
setBackdrop(
const char *pszFileName,
bool bRefresh =
false);
261 void clearBackdrop() {
262 _pBackdrop =
nullptr;
269 bool hasBackdrop()
const {
270 return _pBackdrop !=
nullptr;
286 void setControlID(uint32 nID) {
289 uint32 getControlID()
const {
293 void setBkColor(RGBCOLOR cColor) {
296 RGBCOLOR getBkColor()
const {
300 void setFgColor(RGBCOLOR cColor) {
303 RGBCOLOR getFgColor()
const {
311 return _cPrevMouseDown;
344 void flushAllMessages();
358 virtual void onBofButton(
CBofObject *pButton,
int nExtraInfo);
359 virtual void onBofScrollBar(
CBofObject *pButton,
int nNewPos);
360 virtual void onBofListBox(
CBofObject *pListBox,
int nItemIndex);
361 virtual void onMainLoop();
363 virtual void onSoundNotify(
CBofObject *pObject, uint32 lParam2);
364 virtual void onMovieNotify(uint32 lParam1, uint32 lParam2);
366 virtual void onMCINotify(uint32 wParam, uint32 lParam);
368 virtual void onTimer(uint32 nTimerId);
378 bool isCreated()
const {
379 return _surface !=
nullptr;
382 virtual void enable() {
386 virtual void disable() {
390 bool isVisible()
const {
393 bool isEnabled()
const {
406 virtual void onKeyHit(uint32 lKey, uint32 lRepCount);
407 void fillWindow(byte iColor);
408 void fillRect(
CBofRect *pRect, byte iColor);
410 ErrorCode paintBeveledText(
CBofRect *rect,
const CBofString &
string,
int size,
int weight, RGBCOLOR color,
int justify, uint32 format);
417 virtual void onMouseMove(uint32 nFlags,
CBofPoint *pPoint,
void * =
nullptr);
418 virtual void onLButtonDown(uint32 nFlags,
CBofPoint *pPoint,
void * =
nullptr);
419 virtual void onLButtonUp(uint32 nFlags,
CBofPoint *pPoint,
void * =
nullptr);
420 virtual void onLButtonDblClk(uint32 nFlags,
CBofPoint *pPoint);
422 virtual void onRButtonDown(uint32 nFlags,
CBofPoint *pPoint);
423 virtual void onRButtonUp(uint32 nFlags,
CBofPoint *pPoint);
424 virtual void onRButtonDblClk(uint32 nFlags,
CBofPoint *pPoint);
426 virtual void onReSize(
CBofSize *pSize);
427 virtual void onPaint(
CBofRect *pRect);
428 virtual void onClose();
430 virtual void onUserMessage(uint32 nMessage, uint32 lParam);
432 virtual void onActivate();
433 virtual void onDeActivate();
436 char _szTitle[MAX_TITLE] = { 0 };
442 RGBCOLOR _cBkColor = RGB(255, 255, 255);
443 RGBCOLOR _cFgColor = RGB(0, 0, 0);
445 bool _bCaptured =
false;
467 BofCallback _pCallBack;
Definition: managed_surface.h:51
void invalidateRect(const CBofRect *pRect)
ErrorCode setBackdrop(CBofBitmap *pNewBitmap, bool bRefresh=false)
void setTimer(uint32 nID, uint32 nInterval, BofCallback pCallBack=nullptr)
virtual ErrorCode create(const char *pszName, int x, int y, int nWidth, int nHeight, CBofWindow *pParent, uint32 nControlID=0)
void killTimer(uint32 nID)
void postUserMessage(uint32 lMessage, uint32 lExtraInfo)
void postMessage(uint32 nMessage, uint32 lParam1, uint32 lParam2)
void validateRect(const CBofRect *pRect)
ErrorCode paintBackdrop(CBofRect *pRect=nullptr, int nTransparentColor=-1)
CBofWindow * getParent() const
Definition: window.h:199
virtual void handleEvent(const Common::Event &event)
void move(int x, int y, bool bRepaint=false)
void reSize(CBofRect *pRect, bool bRepaint=false)
void validateAnscestors(CBofRect *pRect=nullptr)
void selectPalette(CBofPalette *pPal)