123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- %include "std_string.i"
- class CL_Component
- {
- public:
- CL_Component(CL_Component* parent, CL_StyleManager* style = NULL);
- ~CL_Component();
- void show(bool show = true);
- bool is_visible(bool check_parents = true);
- void set_focus();
- void set_size(int new_width, int new_height);
- void set_position(int new_x, int new_y);
- const CL_Rect& get_position();
- int get_width() const;
- int get_height() const;
- int get_screen_x() const;
- int get_screen_y() const;
- };
- class CL_Size
- {
- public:
- CL_Size(int w, int h);
- int width;
- int height;
- };
- class CL_Sizef
- {
- public:
- CL_Sizef(float w, float h);
- float width;
- float height;
- };
- class CL_Pointf
- {
- public:
- CL_Pointf(float x, float y)
- : x(x), y(y) { }
- float x;
- float y;
- };
-
- class CL_Point
- {
- public:
- CL_Point(int x, int y)
- : x(x), y(y) { }
- int x;
- int y;
- };
- class CL_Rect
- {
- public:
- int left;
- int top;
- int right;
- int bottom;
- CL_Rect(int, int, int, int);
- CL_Rect(const CL_Point&, const CL_Size&);
- int get_width() const;
- int get_height() const;
- CL_Size get_size();
- };
- class CL_Rectf
- {
- public:
- float left;
- float top;
- float right;
- float bottom;
- CL_Rectf(float, float, float, float);
- CL_Rectf(const CL_Pointf&, const CL_Sizef&);
- float get_width() const;
- float get_height() const;
- CL_Sizef get_size();
- };
-
- class CL_Colorf
- {
- public:
- CL_Colorf(float r, float g, float b, float a);
- float red;
- float green;
- float blue;
- float alpha;
- };
- class CL_Color
- {
- public:
- CL_Color(unsigned int, unsigned int, unsigned int, unsigned int = 255);
- void set_red (unsigned int);
- void set_blue (unsigned int);
- void set_green(unsigned int);
- void set_alpha(unsigned int);
- unsigned int get_red ();
- unsigned int get_blue ();
- unsigned int get_green();
- unsigned int get_alpha();
- };
- class CL_Sprite
- {
- public:
- CL_Sprite(
- const std::string &resource_id, CL_ResourceManager *manager);
- void set_scale(float x, float y);
- CL_Point get_frame_offset(int frame);
- void set_frame_offset(int frame, CL_Point offset);
- };
- class CL_Window : public CL_Component
- {
- private:
- ~CL_Window();
- public:
- CL_Window(
- const CL_Rect &pos,
- const std::string &title,
- CL_Component *parent,
- CL_StyleManager *style = NULL);
- CL_Component* get_client_area();
- };
- class CL_Button : public CL_Component
- {
- private:
- ~CL_Button();
- public:
- CL_Button(
- const CL_Rect &pos,
- const std::string &text,
- CL_Component *parent,
- CL_StyleManager *style = NULL);
- CL_Signal_v0 &sig_clicked();
- const std::string &get_text() const;
- };
- class CL_Menu : public CL_Component
- {
- private:
- ~CL_Menu();
- public:
- CL_Menu(
- const CL_Rect &rect,
- CL_Component *parent,
- CL_StyleManager *style = NULL,
- bool vertical=false);
- CL_Menu(
- CL_Component *parent,
- CL_StyleManager *style = NULL,
- bool vertical=false);
-
- CL_MenuNode *create_item( const std::string &path, const std::string &labels=std::string());
- };
- class CL_MenuNode : public CL_Component
- {
- private:
- ~CL_MenuNode();
- //! Construction:
- public:
- //: CL_MenuNode Constructor
- CL_MenuNode(
- CL_Menu *parent_menu,
- CL_StyleManager *style = NULL);
- CL_Signal_v0 &sig_clicked();
- };
- class CL_InputBox : public CL_Component
- {
- public:
- CL_InputBox(
- const CL_Rect &pos,
- CL_Component *parent,
- CL_StyleManager *style = NULL);
- CL_Signal_v0& sig_return_pressed();
- void set_text(const std::string &text);
- const std::string &get_text() const;
- };
- class CL_Label : public CL_Component
- {
- public:
- //: Label Constructor
- CL_Label(
- const CL_Point &pos,
- const std::string &text,
- CL_Component *parent,
- CL_StyleManager *style = NULL);
- };
- class CL_ListBox : public CL_Component
- {
- public:
- CL_ListBox(
- const CL_Rect& pos, CL_Component* parent, CL_StyleManager* style = NULL);
- CL_Signal_v1<int>& sig_highlighted();
- int insert_item(
- const std::string& text, int index = -1);
- };
- class CL_ResourceManager
- {
- public:
- CL_ResourceManager();
- CL_ResourceManager(
- const std::string &config_file,
- CL_InputSourceProvider *provider = 0,
- bool delete_inputsource_provider = false);
- ~CL_ResourceManager();
- std::vector<std::string> get_all_resources(const std::string §ion_name);
- std::vector<std::string> get_all_sections();
- std::vector<std::string> get_resources_of_type(const std::string &type_id);
- std::vector<std::string> get_resources_of_type(const std::string &type_id, const std::string §ion_name);
- void add_resources(const CL_ResourceManager &additional_resources);
- void remove_resources(const CL_ResourceManager &additional_resources);
- };
- class CL_RadioButton : public CL_Button
- {
- public:
- CL_RadioButton(
- const CL_Point &pos,
- const std::string &text,
- CL_Component *parent,
- CL_StyleManager *style = NULL);
- bool is_checked() const;
- void set_checked(bool check);
- };
- class CL_RadioGroup
- {
- public:
- CL_RadioGroup();
- ~CL_RadioGroup();
- const std::vector<CL_RadioButton *> &get_buttons() const;
- void add(CL_RadioButton *button, bool delete_component = false);
- };
- class CL_CheckBox : public CL_Button
- {
- public:
- CL_CheckBox(
- const CL_Point &pos,
- const std::string &text,
- CL_Component *parent,
- CL_StyleManager *style = NULL);
- bool is_checked() const;
- void set_checked(bool check = true);
- };
- class CL_ProviderFactory
- {
- public:
- static CL_PixelBuffer load(
- const std::string &filename,
- const std::string &type = "",
- CL_InputSourceProvider *input_provider = 0);
- static void save(
- CL_PixelBuffer buffer,
- const std::string &filename,
- const std::string &type = "",
- CL_OutputSourceProvider *output_provider = 0);
- };
- /* EOF */
|