Results 1 to 7 of 7

Thread: About dialog

  1. #1

    Default About dialog

    I am trying to develop a color dialog window and couldn't figure out how to
    draw small rectangles. Is it possible to do it?
    I looked at the examples such as in Guitest.cpp and have no clue how to draw the rectangles.

    class AboutDialog : public CL_Window
    {
    public:
    AboutDialog(CL_Component *parent) :
    CL_Window(
    CL_Rect(300, 200, 700, 700),
    "About",
    CL_Window::close_button | CL_Window::maximize_button | CL_Window::minimize_button | CL_Window::help_button,
    parent),
    label(
    CL_Point(20, 10),
    "GUI Example 1.0",
    get_client_area()),
    button(
    CL_Rect(20, 40, 100, 60),
    "Okay",
    get_client_area())
    {
    slot_quit = button.sig_clicked().connect((CL_Component *) this, &CL_Component::quit);
    // CL_Display::clear(CL_Color(240, 242, 244));
    // CL_Display::fill_rect(CL_Rect(300,0,400,100),CL_Co lor(128,0,0));
    }

    private:
    CL_Label label;
    CL_Button button;
    CL_Slot slot_quit;
    };

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    You need to hook into a gui components sig_paint() signal, and do your custom rendering there.

  3. #3

    Default

    Since fill_rect can only be done with CL_Display or CL_GraphicContext, how do I
    get it?
    And what is the meaning "paint Calls sig_begin_paint(), then sig_paint(), and finally sig_end_paint().' of the member of CL_Component?

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    slot_paint = component->sig_paint().connect(this, &MyClass:n_paint);

    void MyClass:n_paint()
    {
    CL_Display::draw_rect(get_screen_rect(), CL_Color(204, 212, 222));
    }

  5. #5

    Default

    I just implement what you'd sugessted and still doesn't work.

    class AboutDialog : public CL_Window
    {
    public:
    AboutDialog(CL_Component *parent) :
    CL_Window(
    CL_Rect(300, 200, 700, 700),
    "About",
    CL_Window::close_button | CL_Window::maximize_button | CL_Window::minimize_button | CL_Window::help_button,
    parent),
    label(
    CL_Point(20, 10),
    "GUI Example 1.0",
    get_client_area()),
    button(
    CL_Rect(20, 40, 100, 60),
    "Okay",
    get_client_area())
    {
    CL_GUIManager *gui;
    CL_StyleManager *style;
    CL_ResourceManager gui_resources("../../Resources/GUIStyleSilver/gui.xml", false);
    style = new CL_StyleManager_Silver(&gui_resources);
    gui = new CL_GUIManager(style);
    slot_quit = button.sig_clicked().connect((CL_Component *) this, &CL_Component::quit);
    CL_Slot slot_paint = gui->sig_paint().connect(this, &AboutDialog:n_paint);
    }
    void AboutDialog:n_paint()
    {
    CL_Display::clear(CL_Color(240, 242, 244));
    CL_Display::fill_rect(CL_Rect(300,0,400,100),CL_Co lor(128,0,0));
    }

    private:
    CL_Label label;
    CL_Button button;
    CL_Slot slot_quit;
    };

  6. #6
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Please read the documentation about signals and slots: http://clanlib.org/docs/clanlib-0.8....w/signals.html

    Basically, you need to keep the CL_Slot object around, otherwise it will disconnect when it goes out of scope.

  7. #7

    Default

    Thank for the link. Otherwise, I never find out that doc page ever exists.
    I've learned Clanlib thru reference page and examples programs.
    For the time being, I will stick to regular dialog input so that I can translate
    my 5 Window applications a little bit faster.
    I have only two more topics, namely Sound and Socket to complete those
    programs.

Similar Threads

  1. Dialog System?
    By rgrwkmn in forum Novashell Game Creation System
    Replies: 5
    Last Post: 12-22-2008, 12:29 AM
  2. bug? hitting enter on property edit dialog...
    By whisperstorm in forum Novashell Game Creation System
    Replies: 1
    Last Post: 12-19-2006, 11:32 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •