linux 下有 wxwidgets 的 gui 设计器和 Eclipse 吗?

发布于 2024-11-08 03:29:15 字数 1539 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

久伴你 2024-11-15 03:29:16

Philasmicos 有一个适用于 Windows 和 Linux 的免费 wxWidgets GUI 设计器。

你可以在这里找到它

我不知道,为什么它只在德国网站上。

Philasmicos has a free wxWidgets GUI Designer for Windows and Linux.

You can find it here

I don't know, why it is only on the german website.

情域 2024-11-15 03:29:15

wxFormBuilder 相当不错。它很稳定并且支持大多数标准小部件。

wxFormBuilder is pretty good. It is stable and has support for most of the standard widgets.

农村范ル 2024-11-15 03:29:15

虽然我不确定是否与 Eclipse 集成,但您可以运行 wxGlade 来设计界面,然后导出代码。

While I'm not sure of integrating with Eclipse, you can run wxGlade for designing interfaces, then export the code.

落日海湾 2024-11-15 03:29:15

wxsmith 插件用于 Code::Blocks 值得一看。这意味着要切换 IDE,但 C::B 是跨平台的,就像 Eclipse 一样。

The wxsmith plugin for Code::Blocks is worth checking out. It would mean switching IDEs, but C::B is cross-platform just like Eclipse.

抽个烟儿 2024-11-15 03:29:15

正如 ravenspoint 所指出的 - 对表单进行编码很可能会更好。
这与 eclipse 配合得很好(对于那些感兴趣的人)。
运行 wx-config --cppflags 并将 directories/headers 粘贴到 Eclipse 项目的设置中
然后运行
wx-configure --libs 并将 -L-l 粘贴到 Eclipse 项目设置中
现在您就可以出发了。

确保您还设置了 wx-config 显示的标志。

As ravenspoint indicated - it is most likely much better to code your forms.
This works quite well with eclipse (for those interested).
run wx-config --cppflags and paste the directories/headers into your eclipse project's settings
then run
wx-configure --libs and paste the -L and -l into your eclipse project settings
and you are ready to go.

Make sure you also set the flags showed by the wx-config.

梦罢 2024-11-15 03:29:15

IMO,应避免使用此类“表单设计器”工具。对于那些不知道自己在做什么的人来说,它们就像拐杖一样。问题在于它们会生成大量用户无法理解的代码。它们非常适合快速开发玩具应用程序的快速原型。然而,有一天您的应用程序可能会成长为需要维护的成功产品。你猜怎么着?这些工具是有限的并且有缺陷,并且不能用于维护任何真正复杂或完善的 GUI。因此,该工具生成的所有不可维护的代码都必须由一直使用该工具但尚未学会如何编写 GUI 代码的人重写!

在 GUI 第一次流行的时候,这个过程在我身上发生过几次。然后我了解到,学习如何编写 GUI 代码是无可替代的,唯一的方法就是卷起袖子编写代码。

我明白为什么表单生成器工具如此受欢迎。许多 GUI 框架对于编码来说是一个很大的痛苦:需要大量代码来指定每个最后一个控件的左上角和右下角像素位置 - 每当移动任何东西时,所有这些都必须更改。 (这里我想到了 MFC 和 .NET)

这就是 wxWidgets 得分高的地方。如果您学会使用大小调整器,那么您就不必再次指定像素位置。所以,这就是我对最初问题的回答:避免所有这些质量可疑以及与 Eclipse 集成有问题的表单构建器工具,而是学习使用 sizers,以便您可以直接在 Eclipse 编辑器窗口中编写 GUI。

作为一个简单的示例,下面是表单的代码。

wxPanel * panel = new wxPanel(this,-1,wxPoint(-1,-1),wxSize(1000,1000));

wxSizerFlags szrflags(0);
szrflags.Border(wxALL,5);

wxBoxSizer * szrCRUDForm = new wxBoxSizer(wxVERTICAL );

wxFlexGridSizer * szr = new wxFlexGridSizer(2,1,1);

wxStaticText * field1text =  new wxStaticText(panel,-1,"Entry Field #1");
wxTextCtrl   * field1ctrl =  new wxTextCtrl(panel,-1,"              ");
wxStaticText * field2text =  new wxStaticText(panel,-1,"Second Entry Field");
wxTextCtrl   * field2ctrl =  new wxTextCtrl(panel,-1,"              ");
wxStaticText * field3text =  new wxStaticText(panel,-1,
    "A very big entry field\n"
    "with a lot of description\n"
    "Spread over several long lines of text");
wxTextCtrl   * field3ctrl =  new wxTextCtrl(panel,-1,"",wxPoint(-1,-1),
                                            wxSize(600,-1));
wxStaticText * field4text =  new wxStaticText(panel,-1,"Yet another Field");
wxTextCtrl   * field4ctrl =  new wxTextCtrl(panel,-1,"              ");

szr->Add( field1text,szrflags );
szr->Add( field1ctrl,szrflags );
szr->Add( field2text,szrflags );
szr->Add( field2ctrl,szrflags );
szr->Add( field3text,szrflags );
szr->Add( field3ctrl,szrflags );
szr->Add( field4text,szrflags );
szr->Add( field4ctrl,szrflags );

wxBoxSizer * szrButtons = new wxBoxSizer( wxHORIZONTAL );
szrButtons->Add( new wxButton(panel,-1,L"CREATE"),szrflags);
szrButtons->Add( new wxButton(panel,-1,L"READ"),szrflags);
szrButtons->Add( new wxButton(panel,-1,L"UPDATE"),szrflags);
szrButtons->Add( new wxButton(panel,-1,L"DELETE"),szrflags);

szrCRUDForm->Add( szr );
szrCRUDForm->Add( szrButtons );

SetSizer(szrCRUDForm);
Produces the following GUI, without requiring any pushing or pulling

生成以下 GUI

在此处输入图像描述

这是一个 sizer 教程 https://zetcode.com/gui/wxwidgets/layoutmanagement/

IMO, using such 'form designer' tools should be avoided. They are like crutches for people who do not know what they are doing. The snag is that they generate vast amounts of code which the user does not understand. They are great for rapidly developing a quick prototype of a toy application. However, one day one of your applications may grow up into a successful product which needs to be maintained. Guess what? The tools are limited and buggy, and cannot be used to maintain a GUI of any real complexity or sophistication. So, all that un-maintainable code generated by the tool has to be rewrittenn by someone who has been using the tool and so has not learnt how to write GUI code!

This process happened to me a couple of times, back in the days when GUIs first became popular. Then I learnt that there is no substitute for learning how to code a GUI, and the only way to do that is to roll up your sleeves and write the code.

I understand why form builder tools are so popular. Many GUI frameworks are a major pain to code for: requiring reams of code specifying the top left and bottom right pixel position of every last control - all of which have to be changed whenever anything is moved around. ( MFC and .NET spring to mind here )

This is where wxWidgets scores big. If you learn to use sizers, then you never have to specify a pixel position again. So, this is my answer to the original question: avoid all these form builders tools of dubious quality and questionable integration with Eclipse, but instead learn to use sizers so you can code your GUIs directly in the Eclipse editor window.

As a simple example, here is the code for a form.

wxPanel * panel = new wxPanel(this,-1,wxPoint(-1,-1),wxSize(1000,1000));

wxSizerFlags szrflags(0);
szrflags.Border(wxALL,5);

wxBoxSizer * szrCRUDForm = new wxBoxSizer(wxVERTICAL );

wxFlexGridSizer * szr = new wxFlexGridSizer(2,1,1);

wxStaticText * field1text =  new wxStaticText(panel,-1,"Entry Field #1");
wxTextCtrl   * field1ctrl =  new wxTextCtrl(panel,-1,"              ");
wxStaticText * field2text =  new wxStaticText(panel,-1,"Second Entry Field");
wxTextCtrl   * field2ctrl =  new wxTextCtrl(panel,-1,"              ");
wxStaticText * field3text =  new wxStaticText(panel,-1,
    "A very big entry field\n"
    "with a lot of description\n"
    "Spread over several long lines of text");
wxTextCtrl   * field3ctrl =  new wxTextCtrl(panel,-1,"",wxPoint(-1,-1),
                                            wxSize(600,-1));
wxStaticText * field4text =  new wxStaticText(panel,-1,"Yet another Field");
wxTextCtrl   * field4ctrl =  new wxTextCtrl(panel,-1,"              ");

szr->Add( field1text,szrflags );
szr->Add( field1ctrl,szrflags );
szr->Add( field2text,szrflags );
szr->Add( field2ctrl,szrflags );
szr->Add( field3text,szrflags );
szr->Add( field3ctrl,szrflags );
szr->Add( field4text,szrflags );
szr->Add( field4ctrl,szrflags );

wxBoxSizer * szrButtons = new wxBoxSizer( wxHORIZONTAL );
szrButtons->Add( new wxButton(panel,-1,L"CREATE"),szrflags);
szrButtons->Add( new wxButton(panel,-1,L"READ"),szrflags);
szrButtons->Add( new wxButton(panel,-1,L"UPDATE"),szrflags);
szrButtons->Add( new wxButton(panel,-1,L"DELETE"),szrflags);

szrCRUDForm->Add( szr );
szrCRUDForm->Add( szrButtons );

SetSizer(szrCRUDForm);
Produces the following GUI, without requiring any pushing or pulling

Produces the following GUI

enter image description here

Here is a sizer tutorial https://zetcode.com/gui/wxwidgets/layoutmanagement/

揪着可爱 2024-11-15 03:29:15

如果您正在寻找带有可视化表单编辑器的 IDE,正确的方法是 Code::Blocks。它集成了wxSmith插件。这样工作起来是天衣无缝的。
我不知道 Eclipse 是否有一些插件,但是 Eclipse + wxFormBuilder 对我来说是最好的选择之一。

If you are looking for an IDE with visual form editor right way is Code::Blocks. It has integrated wxSmith plugin. Work it this way is seamless.
I don't know if there is some plugin for Eclipse, but Eclipse + wxFormBuilder is one of the best choices as for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文