1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

- first part of CIntObject API clean-up.

- - mostly remove usage of (de)activateSomething functions
- - CIntObject's can be safely deleted in active state or without removing from parent first
- - Added CWindowObject to use as base of all windows (will be required for such features as shadows)

Report any crashes or glitches - it should not cause any issues apart from more console output. 

TODO:
- remove redundant (de)activate and show(All) calls
- decrease usage of blitAtLoc\printAtLoc methods
- switch all windows to new base
This commit is contained in:
Ivan Savenko
2012-06-02 15:16:54 +00:00
parent 3df1ddbf86
commit d60f2d57a0
29 changed files with 582 additions and 745 deletions

View File

@ -298,7 +298,8 @@ public:
~CStatusBar(); //d-tor
void print(const std::string & text); //prints text and refreshes statusbar
void clear();//clears statusbar and refreshes
void show(SDL_Surface * to); //shows statusbar (with current text)
void showAll(SDL_Surface * to); //shows statusbar (with current text)
void show(SDL_Surface * to);
std::string getCurrent(); //getter for current
};
@ -430,8 +431,6 @@ public:
CList(int Size = 5); //c-tor
void clickLeft(tribool down, bool previousState);
void activate();
void deactivate();
virtual void mouseMoved (const SDL_MouseMotionEvent & sEvent)=0; //call-in
virtual void genList()=0;
virtual void select(int which)=0;
@ -465,4 +464,38 @@ public:
virtual void clickLeft(tribool down, bool previousState);
virtual void clickRight(tribool down, bool previousState);
};
};
/// Basic class for windows
// TODO: status bar?
class CWindowObject : public virtual CIntObject
{
CPicture * createBg(std::string imageName, bool playerColored);
int options;
protected:
CPicture * background;
//Simple function with call to GH.popInt
void close();
//Used only if RCLICK_POPUP was set
void clickRight(tribool down, bool previousState);
//To display border
void showAll(SDL_Surface *to);
public:
enum EOptions
{
PLAYER_COLORED=1, //background will be player-colored
RCLICK_POPUP=2, // window will behave as right-click popup
BORDERED=4 // window will have border if current resolution is bigger than size of window
};
/*
* imageName - name for background image, can be empty
* options - EOpions enum
* centerAt - position of window center. Default - center of the screen
*/
CWindowObject(std::string imageName, int options, Point centerAt);
CWindowObject(std::string imageName, int options);
};