Recent Posts

Pages: 1 [2] 3 4 ... 10
11
General Discussion / Re: Missing some classes in Doxygen docs
« Last post by Drifty Pine on 15 June 2021, 19:22:58 »
My preferred way for dealing with this kind of thing is to do something like this in the code:
change: #ifdef TGUI_HAS_BACKEND_SFML
to: #if defined(TGUI_HAS_BACKEND_SFML) || defined(DOXYGEN)

This works because Doxygen automatically defines the macro DOXYGEN when it processes the files, just make sure you do not define the DOXYGEN macro anywhere in your code of course  :)

If you want both the #ifdef and an associated #else to be processed, you should also change any bare #else directives to be explicit #if's
so change:
#ifdef SOMETHING
  ...
#else
  ...
#endif

to:

#if defined(SOMETHING) || defined(DOXYGEN)
  ...
#endif

#if !defined(SOMETHING) || defined(DOXYGEN)
  ...
#endif

Two other ideas for dealing with this kind of thing in Doxygen is by editting the Doxyfile:
- use PREDEFINED = TGUI_HAS_BACKEND_SFML  and PREDEFINED = TGUI_HAS_BACKEND_SDL
  - This will define these both only for Doxygen, so you can leave your compile settings as they are.
  - However, this method won't include the code within both an #ifdef and any associated bare #else, so you would have change any of such #else to explicit #ifdef or #if defined(...).

- use ENABLE_PREPROCESSING = NO
  - This will disable all preprocessing, so you would get things within #ifdef and bare #else, but it might not be ideal because no preprocessing would be done at all.

12
Help requests / Re: Grid and scrollbar
« Last post by texus on 15 June 2021, 18:50:37 »
This is because the inner size of the ScrollablePanel never changes when scrollbars are visible or not.
I agree that this isn't ideal and it should probably be changed, but right now it is the expected behavior.

Implementing this properly is a bit tricky: whether scrollbars are shown could depends on the widgets inside the panel, but the size of those widgets would depend on whether there are scrollbars.
So when writing the ScrollablePanel widget I decided to just keep it simple and ignored this case.

Edit: Maybe I could change the inner size when Policy::Always is specified and leave the more difficult case for later.
13
Help requests / Grid and scrollbar
« Last post by Kvaz1r on 15 June 2021, 12:54:02 »
I have some widgets in grid and not all of them fit inside usual panel. I want to use scrollbar to provide access to widgets so put grid into ScrollablePanel panel. But even with scrollbar policy Always it can't change grid appearance. Does it bug or am I missing something?

MCVE:

Code: [Select]
#include <TGUI/TGUI.hpp>

class MyFrame
{
public:
    MyFrame(sf::RenderWindow& w, tgui::Gui& g);
    void main();

protected:
    tgui::Grid::Ptr m_grid;
    tgui::TextArea::Ptr m_log;

private:
    void updateLayout();

    sf::RenderWindow& window;
    tgui::Gui& gui;
};

MyFrame::MyFrame(sf::RenderWindow& w, tgui::Gui& g) : window(w), gui(g)
{
    auto panel = tgui::ScrollablePanel::create();
    panel->getRenderer()->setBackgroundColor(sf::Color(200, 200, 200, 255));

    m_grid = tgui::Grid::create();

    for (std::size_t i = 0; i < 20; i++)
    {
        m_grid->addWidget(tgui::Label::create(tgui::String(i)), i, 0, tgui::Grid::Alignment::Center, { 0,10,0,0 });

        auto widget = tgui::EditBox::create();
        widget->setText(tgui::String(i));
        m_grid->addWidget(widget, i, 1, tgui::Grid::Alignment::Center, { 0,10,0,0 });
    }

    panel->add(m_grid);

    m_log = tgui::TextArea::create();
    panel->add(m_log);
    gui.add(panel);
   
    updateLayout();
    panel->setVerticalScrollbarPolicy(tgui::Scrollbar::Policy::Always);
}

void MyFrame::updateLayout()
{
    m_grid->setSize({ "50%","100%" });
    m_log->setSize({ "50%","100%" });

    auto size = window.getSize();
    m_grid->setPosition(0, 0);
    m_log->setPosition(size.x - 0.5 * size.x, 0);
}

void MyFrame::main()
{
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            if (event.type == sf::Event::Resized)
            {
                updateLayout();
            }
            gui.handleEvent(event);
        }

        window.clear();
        gui.draw();
        window.display();
    }
}

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "MCVE");
    window.setFramerateLimit(60);
    tgui::Gui gui(window);
    MyFrame(window, gui).main();

    return EXIT_SUCCESS;
}
14
General Discussion / Re: Missing some classes in Doxygen docs
« Last post by texus on 15 June 2021, 08:19:29 »
Thanks for letting me know. I guess I should enable the TGUI_HAS_BACKEND_SFML define next time I build the documentation.

For TGUI 0.9.3 I'm planning to rewrite the backends anyway, so I'll add a note that I have to look at improving the documentation (to make Gui classes from all backends show up).
15
General Discussion / Missing some classes in Doxygen docs
« Last post by Drifty Pine on 15 June 2021, 00:22:28 »
Hi Bruno,
Just a small heads-up: I noticed that some classes (for example, Gui and Canvas) seem to be missing the Doxygen generated docs that you show on the website for version 0.9.
I think this has to do with classes that are within #ifdef's you added when dealing with the SDL port.
16
Help requests / Re: ToolTip Auto Position On Screen
« Last post by texus on 11 June 2021, 19:42:23 »
The TGUI version from github now places the tool tip so that it doesn't fall (partially) outside the window.
17
Help requests / Re: ToolTip Auto Position On Screen
« Last post by texus on 09 June 2021, 22:40:19 »
It's currently not possible.
I might have a look at implementing this in the next few days. It doesn't look that difficult, I think this line just has to check if the position plus size of the tooltip is larger than the size of m_view.
18
Help requests / ToolTip Auto Position On Screen
« Last post by sors on 09 June 2021, 20:42:17 »
Hello, tell me please how i can set automatic position ToolTip on Button.
In this time i have a ToolTip crawling out from window.
19
Installation help / Re: Help getting TGUI running - OpenGL
« Last post by johnnywz00 on 07 May 2021, 07:06:04 »
Working! Looking forward to exploring my C++ programming with your GUI...
20
Installation help / Re: Help getting TGUI running - OpenGL
« Last post by johnnywz00 on 03 May 2021, 06:41:59 »
Okay, I'll look into those options... thanks for your help!
Pages: 1 [2] 3 4 ... 10