30 |
#ifndef PG_POPUPMENU_H |
#ifndef PG_POPUPMENU_H |
31 |
#define PG_POPUPMENU_H |
#define PG_POPUPMENU_H |
32 |
|
|
|
#ifdef SWIG |
|
|
%include "swigcommon.h" |
|
|
%module pgpopupmenu |
|
|
%{ |
|
|
#include "pgpopupmenu.h" |
|
|
%} |
|
|
#endif |
|
|
|
|
33 |
#include "pgthemewidget.h" |
#include "pgthemewidget.h" |
34 |
#include "pgsignals.h" |
#include "pgsignals.h" |
35 |
|
|
80 |
* @todo better separator code |
* @todo better separator code |
81 |
* @todo icon drawing |
* @todo icon drawing |
82 |
*/ |
*/ |
|
#ifndef SWIG |
|
83 |
class MenuItem : public PG_Rect, public PG_MessageObject { |
class MenuItem : public PG_Rect, public PG_MessageObject { |
84 |
public: // types |
public: // types |
85 |
enum MI_FLAGS { |
enum MI_FLAGS { |
179 |
} |
} |
180 |
}; |
}; |
181 |
#endif // DOXYGEN_SKIP |
#endif // DOXYGEN_SKIP |
|
#endif // SWIG |
|
182 |
|
|
183 |
public: // methods |
public: // methods |
184 |
|
|
201 |
*@{ |
*@{ |
202 |
*/ |
*/ |
203 |
|
|
|
#ifndef SWIG |
|
204 |
/** |
/** |
205 |
* Adds a menu item whose handler (if any) is set to be a stand-alone |
* Adds a menu item whose handler (if any) is set to be a stand-alone |
206 |
* function. |
* function. |
227 |
PG_PopupMenu *sub, |
PG_PopupMenu *sub, |
228 |
MenuItem::MI_FLAGS flags = MenuItem::MIF_SUBMENU); |
MenuItem::MI_FLAGS flags = MenuItem::MIF_SUBMENU); |
229 |
|
|
|
#endif // SWIG |
|
|
|
|
230 |
/** |
/** |
231 |
* @return a reference to this menu |
* @return a reference to this menu |
232 |
*@} |
*@} |
258 |
|
|
259 |
protected: // methods |
protected: // methods |
260 |
|
|
|
#ifndef SWIG |
|
261 |
typedef list<MenuItem*>::iterator MII; |
typedef list<MenuItem*>::iterator MII; |
|
#endif // SWIG |
|
262 |
|
|
263 |
// reimplemented |
// reimplemented |
264 |
void eventBlit(SDL_Surface* srf, const PG_Rect& src, const PG_Rect& dst); |
void eventBlit(SDL_Surface* srf, const PG_Rect& src, const PG_Rect& dst); |
286 |
virtual void liberate(); |
virtual void liberate(); |
287 |
|
|
288 |
private: // methods |
private: // methods |
289 |
#ifndef SWIG |
|
290 |
bool selectItem(MenuItem *item, MII iter); |
bool selectItem(MenuItem *item, MII iter); |
291 |
bool handleMotion(PG_Point const&); |
bool handleMotion(PG_Point const&); |
292 |
void appendItem(MenuItem *item); |
void appendItem(MenuItem *item); |
|
#endif //SWIG |
|
293 |
|
|
294 |
protected: // data |
protected: // data |
295 |
#ifndef SWIG |
|
296 |
list<MenuItem*> items; /** the menu items collection */ |
list<MenuItem*> items; /** the menu items collection */ |
297 |
string myCaption; /** menu caption */ |
string myCaption; /** menu caption */ |
|
#endif //SWIG |
|
298 |
|
|
299 |
PG_Color captionActiveColor; |
PG_Color captionActiveColor; |
300 |
PG_Color captionInactiveColor; |
PG_Color captionInactiveColor; |
334 |
MenuItem *subParent; |
MenuItem *subParent; |
335 |
}; |
}; |
336 |
|
|
|
#ifndef SWIG |
|
337 |
inline int PG_PopupMenu::maxItemWidth() const { |
inline int PG_PopupMenu::maxItemWidth() const { |
338 |
return w - xPadding; |
return w - xPadding; |
339 |
} |
} |
420 |
return myPoint; |
return myPoint; |
421 |
} |
} |
422 |
|
|
|
#endif // SWIG |
|
|
|
|
423 |
#endif // PG_POPUPMENU_H |
#endif // PG_POPUPMENU_H |