wxWidget Layout Algorithm Demo - BoxPlanner

BoxPlanner Many applications specify absolute position and absolute sizes when they lay out controls in the parent window. This strategy has some drawbacks: The created cannot be resized, changes are difficult and creation of good looking is time consuming.

Another way which is very common in frameworks (wxWidgets, QT, …) is to use algorithm. A algorithm determines the size and position of its controls based on its policy. Although every control can provide its preferences about its size, position and alignment, the algorithm can ignore these preferences if they are against its policy.

Continue reading wxWidget Layout Algorithm Demo - BoxPlanner - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

wxWidget 类型转换(wxString, wxdatatime)

samsung_transformer 在C++里常用类型转换感觉很杂,不好用;跟C#没得比:可以强类型转换,还有convert通用的转换,非常方便的说。刚用wxwidget时类型转换也是一头大,了解后发现要比简洁好用多,接口也容易记住。下面上wxWidget常用类型转换:

一、wxstring与其他类型转换

    1.1 int  to wxString:     wxString str = wxString::Format(wxT("%i"),myInt);

    1.2    wxString to int :     int i;  i = wxAtoi(str);

    1.3    string to wxString:     std::string stlString = "sdfas"; wxString mystr(stlString .c_str(),wxConvUTF8);

Continue reading wxWidget 类型转换(wxString, wxdatatime) - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

A rough guide for wxWidgets programming

puzzle1 从最基本的概念开始,一个wxWidgets程序需要从继承一个应用程序类并且该程序还必须有一个top-level的窗口(继承自或者wxDialog)。这样就组成了一个最下化的应用程序实例,剩下的就是基于你设计的界面添加和逻辑部分。在Frame/Dialog之上,有wxPanel,wxSplitterWindow或者其他的窗口控件可供使用,在上一篇的/Frame/Panel关系的文章中大家已经看到如何利用这些元素组织和设计程序界面。

Continue reading A rough guide for wxWidgets programming - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

wxWidgets Programming: Sizer, Frame and Panel

wxwidget-gui-library 个人感觉在 UI编程时,一开始最难于理解和使用的就是Sizer,尤其是在与各种控件、Panel嵌套搭配的时候,包括对控件间隙以及父窗口大小发生改变时各个控件的变化定义等。在网上发现这篇文章非常详细的总结了Sizer, Frame和Panel的关系并通过简单的实例深入浅出地讲解了这一部分,转载在此供大家参考,如果你有相关技术问题或者开发心得也可以发评论参加讨论。

[原文如下] 最近在研究跨平台的C/C++ GUI库,基本说来功能强大,稳定且开源的库就是QT和了,关于他们之间具体的比较详见《WxWidgets Compared To Other Toolkits》。 N年以前研究过一段时间QT的代码,不过主要因为其在Windows开发商用软件还是要一定的license费用,所以不能说是真正的免费跨平台。 则是一套免费开源的跨平台C++ GUI库,它的一个特点就是可以转换为native 的api图形界面。就是说用同样的代码,在windows平台看起来就是window风格的,在X Windows平台看起来就是linux风格的。

Continue reading wxWidgets Programming: Sizer, Frame and Panel - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

Book: Cross-Platform GUI Programming with wxWidgets (Bruce Perens)(含中英文版本下载地址)

Cross-Platform GUI Programming with wxWidgets 以前通过学习认识了,那里面有很多文档和源代码实例可以参考学习,对编程帮助很大。后来在C++项目中也需要用到wxWidgets,发现这本书非常实用,结合wxWidgets的官方手册,编程感觉非常畅快。特别推荐大家阅读,如果你对wxWidgets编程感兴趣的话。有什么读书心得也可以跟贴共享给大家。

wxWidgets now has its own 700-page to help you learn or brush up on your cross-platform programming skills. Written by Julian Smart and Kevin Hock with Stefan Csomor, "Cross-Platform Programming with wxWidgets" was published on July 27th 2005 by Prentice Hall. It’s part of Bruce Perens’ Open Source Series.

Continue reading Book: Cross-Platform GUI Programming with wxWidgets (Bruce Perens)(含中英文版本下载地址) - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

CodeLite Plugin Internal(2)-Load: 插件加载分析

hat_dll_load 上回书说到IPlugin接口和众插件之间的关系,这里讲讲插件加载的过程。加载点在系统初始化时Framezhong 调用,上次也说过。这里主要是从PluginManager::Load() 说起。首先读取插件配置文件 config/plugins.,并将信息保存到std::map<wxString, PluginInfo> m_pluginsInfo中,这个成员m_pluginsInfo是属于PluginManager,这个map保存了插件名称和Pluginfo的映射关系。接着TagManagerST和LanguageST互相赋值。

现在进入重点循环,针对插件目录下的每个.dll/.so文件,会进行1)加载动态库;2)读插件信息;3)加载插件;4)调用插件相关创建toolbar和menu的函数。下面一一详述:

Continue reading CodeLite Plugin Internal(2)-Load: 插件加载分析 - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

CodeLite Plugin Internal(1) – IPlugin interface

icosahedronFeather 所有的CodeLite插件都以动态库的形式(.dll or .so)保存在/plugins下,通过程序初始化时调用Frame::LoadPlugins加载[CodeLite的初始化分析在另外一篇文章中已有详述,请在ide.cbforge.com站内参阅]。插件相关的配置保存在/config/plugins.文件。文件为格式,每一插件项都保存有以下几项:SerializedObject Name, Name,Author,Description and Version。关于插件的实现我们会分几篇文章分析,这个第一篇主要关注IPlugin接口的实现。

IPlugin is the interface that defines a for CodeLite. Each must implement the pure virtual methods of this interface. The gains access to CodeLite data by using the m_mgr member.

Continue reading CodeLite Plugin Internal(1) – IPlugin interface - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

Using XRC in wxWidgets based Application for UI design

WxWidgets 相信很多程序员有过类似的经历,想实现一款图形界面的应用软件。核心算法和后台程序都写好后,等到实现界面时总是发现缺乏艺术细胞,对自己设计的界面和对话框等不满意,或者是消耗在挑选控件、配色和布局等繁琐的工作中不能自拔,最终也许会因为UI的问题而导致放弃整个项目。一款没有优秀界面的应用软件在繁多的类似产品中很难获得用户的喜爱。利用wxWidgets我们可以将很多界面设计工作轻松搞定,而且利用 based resource,规范,可以将界面设计工作和程序分离,独立的文件维护容易,简单直观而且可以使得程序本身只关注于逻辑,何乐而不为呢。

以下包括几个部分介绍,有介绍包括中英文的(摘自网络)和使用步骤,以及几个常用设计工具的链接。

Continue reading Using XRC in wxWidgets based Application for UI design - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis

CodeLite Initializaion analysis - 初始化流程分析(1)

china-03_03 转载请注明出处,该文章来源于cbforge.com by Bryan Wu. CodeLite IDE的主应用程序类实现在文件 /liteeditor/app.cpp中,系统初始化时,从wxApp继承的App类会调用OnInit成员函数,bool App::OnInit()

  1. If it is or MAC system, block signal pipe first;
  2. wxSocketBase::Initialize();
  3. 打开fatal exception handler,假如系统crash,会调用wxApp::OnFatalException,在此处可以采集一些调试信息;
  4. InitXmlResource:通过wxMemoryFSHandler加载资源文件到内存,包括很多PNG文件和文件;
  5. 调用wxCmdLineParser解析命令行参数,命令行描述如下:

    假如是h,会打印帮助并推出,如果有b,重新设置basedir。static const wxCmdLineEntryDesc cmdLineDesc[] = {
        {wxCMD_LINE_SWITCH, “v“, “version”, “Print current version”, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_SWITCH, “h“, “help”, “Print usage”, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_OPTION, “l“, “line”, “Open the file at a given line number”, wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_OPTION, “b“, “basedir”,  “The base directory of CodeLite”, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_PARAM,  NULL, NULL, “Input file”, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE|wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_NONE }
    };

     

  6. 设置各种目录,包括homeDir,installPath,CurDir,StartupDir等;
  7. Load Menu resource, rc/menu.xrc
  8. Initialize the configuration file locater,ConfFileLocator::Instance()->Initialize
  9. 初始化Manager类,该类从Singleton Pattern template而来;
  10. read the last frame size from the configuration file and initialise editor configuration files;
  11. 加入SingleInstance为真,我们需要通过调用wxSingleInstanceChecker来检查CodeLite运行实例是否唯一;
  12. Update PATH environment variable with the install directory and MinGW default installation (if exists)
  13. 显示splash screen,图片存储在 /images/splashscreen.png(可选,配置在GeneralInfo中)
  14. 重头戏来了,Frame::Initialize,初始化Frame中会包括很多内容,下面详述;
  15. update the accelerators table;
  16. 显示由第14步初始化的Frame并置为top window;
  17. 刚才第5步中解析的结果中如果有line,和input file,会依次打开并跳转至line-1行;
  18. 最后一步:通过wxLogMessage打印Install path和Startup Path信息,Over。

Continue reading CodeLite Initializaion analysis - 初始化流程分析(1) - 全文阅读

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Slashdot
  • Technorati
  • TwitThis
 Page 1 of 2  1  2 »

Contact us

Admin: Bryan Wu