FOX-TOOLKIT的网站及简介:
www.fox-toolkit.org
FOX is a C++ based Toolkit for developing Graphical User Interfaces easily and effectively. It offers a wide, and growing, collection of Controls, and provides state of the art facilities such as drag and drop, selection, as well as OpenGL widgets for 3D graphical manipulation. FOX also implements icons, images, and user-convenience features such as status line help, and tooltips. Tooltips may even be used for 3D objects!
刚开始学习FOX TOOLKIT,做了一个简单的文本显示例子,在Windows平台上我使用了MultiByteToWideChar来实现代码页转换,如果谁能有基于FOX的解决方案,欢迎进行指点和帮助。
对比WTL,FOX在界面设计和消息传递上要更加简洁和灵活,缺点是不支持本地UI。在本程序中FXText控件的执行效率较低,可以考虑使用fxscintilla来代替。
1
//
FoxTest.cpp : 定义控制台应用程序的入口点。
2
//
3
#include
"
stdafx.h
"
4
#include
<
fx.h
>
5
#include
<
windows.h
>
6
7
class
TextWindow :
public
FXMainWindow
8
{
9
FXDECLARE(TextWindow)
10
public
:
11
TextWindow(){}
12
~
TextWindow(){}
13
public
:
14
enum
{
15
ID_QUIT
=
FXMainWindow::ID_LAST,
16
ID_TEXT,
17
ID_DIRECTORYLIST,
18
ID_UPDATE_FILE,
19
};
20
public
:
21
FXDirList
*
dirlist;
22
FXText
*
editor;
23
FXString filename;
24
public
:
25
TextWindow(FXApp
*
app);
26
virtual
void
create();
27
FXbool loadFile(
const
FXString
&
file);
28
void
DumpWidgets();
29
public
:
30
long
onCmdQuit(FXObject
*
,FXSelector,
void
*
);
31
long
onCmdOpenFile(FXObject
*
,FXSelector,
void
*
);
32
long
onUpdateFile(FXObject
*
,FXSelector,
void
*
);
33
};
34
35
FXDEFMAP(TextWindow) TextWindowMap[]
=
{
36
FXMAPFUNC(SEL_COMMAND, TextWindow::ID_DIRECTORYLIST, TextWindow::onCmdOpenFile),
37
FXMAPFUNC(SEL_COMMAND, TextWindow::ID_QUIT, TextWindow::onCmdQuit),
38
FXMAPFUNC(SEL_UPDATE, TextWindow::ID_UPDATE_FILE, TextWindow::onUpdateFile),
39
};
40
41
FXIMPLEMENT(TextWindow,FXMainWindow,TextWindowMap,ARRAYNUMBER(TextWindowMap))
42
43
TextWindow::TextWindow(FX::FXApp
*
app): FXMainWindow(app,L
"
FOX TOOLKIT学习 - 显示文本 make: VisualFC 2009.6.24
"
,NULL,NULL,DECOR_ALL,
0
,
0
,
800
,
600
)
44
{
45
new
FXToolTip(app);
46
47
new
FXStatusBar(
this
,LAYOUT_SIDE_BOTTOM
|
LAYOUT_FILL_X);
48
49