зеркало из https://github.com/mozilla/pjs.git
Make XfeWidgets and company behave like other modules in the tree. They
now export their headers as all good modules should. Also, dont build widgets and demos that are not needed. r=slamm,a=ramiro.
This commit is contained in:
Родитель
eee0a73bdc
Коммит
ec996ce8ad
|
@ -71,6 +71,8 @@ DIRS = \
|
|||
$(NULL)
|
||||
|
||||
REQUIRES = \
|
||||
XfeWidgets \
|
||||
Microline \
|
||||
addr \
|
||||
applet \
|
||||
img \
|
||||
|
@ -417,7 +419,7 @@ ifdef USE_ABCOM
|
|||
DEFINES += -DUSE_ABCOM
|
||||
endif
|
||||
|
||||
INCLUDES += -IMicroline3.0 -IXfeWidgets -Isrc -I.
|
||||
INCLUDES += -Isrc -I.
|
||||
|
||||
|
||||
#######################################################################
|
||||
|
|
|
@ -24,18 +24,53 @@
|
|||
# http://www.neurondata.com.
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
##########################################################################
|
||||
#
|
||||
# Name: Makefile
|
||||
# Description: Makefile for Microline Widget library
|
||||
# Author: Ramiro Estrugo <ramiro@netscape.com>
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
DEPTH = ../../../..
|
||||
|
||||
# XmL headers are exported to dist/public/Microline/XmL
|
||||
MODULE = Microline/XmL
|
||||
|
||||
MODULE = XmL
|
||||
LIBRARY_NAME = XmL
|
||||
|
||||
CSRCS =\
|
||||
Folder.c \
|
||||
Grid.c \
|
||||
Tree.c \
|
||||
XmL.c \
|
||||
$(NULL)
|
||||
# There are unused widgets. They are currently not needed to build Mozilla,
|
||||
# but that might change in the future.
|
||||
ifdef XFE_WIDGETS_BUILD_UNUSED
|
||||
UNUSED_CSRCS = \
|
||||
Progress.c \
|
||||
Tree.c \
|
||||
$(NULL)
|
||||
|
||||
UNUSED_EXPORTS = \
|
||||
Progress.h \
|
||||
ProgressP.h \
|
||||
Tree.h \
|
||||
TreeP.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
CSRCS = \
|
||||
$(UNUSED_CSRCS) \
|
||||
Folder.c \
|
||||
Grid.c \
|
||||
XmL.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = Microline
|
||||
|
||||
EXPORTS = \
|
||||
$(UNUSED_EXPORTS) \
|
||||
Folder.h \
|
||||
FolderP.h \
|
||||
Grid.h \
|
||||
GridP.h \
|
||||
XmL.h \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
INCLUDES += -I..
|
||||
|
|
|
@ -16,16 +16,27 @@
|
|||
# Reserved.
|
||||
|
||||
|
||||
#
|
||||
##########################################################################
|
||||
#
|
||||
# Name: Makefile
|
||||
# Description: Makefile for Xfe Widgets and related libraries
|
||||
# Author: Ramiro Estrugo <ramiro@netscape.com>
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
DIRS = Xfe
|
||||
DEPTH = ../../..
|
||||
|
||||
ifdef XFE_WIDGETS_BUILD_TESTS
|
||||
DIRS += XfeTest tests
|
||||
TEST_DIRS = \
|
||||
XfeTest \
|
||||
tests \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
DIRS = \
|
||||
Xfe \
|
||||
$(TEST_DIRS)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
tests::
|
||||
|
|
|
@ -15,69 +15,186 @@
|
|||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
##########################################################################
|
||||
#
|
||||
# Name: Makefile
|
||||
# Description: Makefile for XfeWidgets library
|
||||
# Author: Ramiro Estrugo <ramiro@netscape.com>
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
DEPTH = ../../../..
|
||||
|
||||
# XfeWidgets headers are exported to dist/public/XfeWidgets/Xfe
|
||||
MODULE = XfeWidgets/Xfe
|
||||
|
||||
MODULE = Xfe
|
||||
LIBRARY_NAME = XfeWidgets
|
||||
|
||||
#
|
||||
# This guy is just a demo widget that has all the bells and whistles.
|
||||
# It can be conveniently used as a template.
|
||||
#
|
||||
# TempTwo.c
|
||||
#
|
||||
# The XfeTempTwo widget is a demo. It has all the possible bells and
|
||||
# whistles for a subclass of XfeManager. It can be used as a template
|
||||
# when creating new XfeManager widgets. Its not built by default
|
||||
ifdef XFE_WIDGETS_BUILD_DEMO
|
||||
|
||||
CSRCS = \
|
||||
Arrow.c \
|
||||
BmButton.c \
|
||||
BmCascade.c \
|
||||
Button.c \
|
||||
BypassShell.c \
|
||||
CallProcs.c \
|
||||
Cascade.c \
|
||||
ChildrenUtil.c \
|
||||
Chrome.c \
|
||||
ComboBox.c \
|
||||
Converters.c \
|
||||
Cursor.c \
|
||||
DashBoard.c \
|
||||
Debug.c \
|
||||
DialogUtil.c \
|
||||
Draw.c \
|
||||
FancyBox.c \
|
||||
Find.c \
|
||||
FontChooser.c \
|
||||
FrameShell.c \
|
||||
GcUtil.c \
|
||||
Geometry.c \
|
||||
Label.c \
|
||||
ListUtil.c \
|
||||
Logo.c \
|
||||
Manager.c \
|
||||
MenuUtil.c \
|
||||
Oriented.c \
|
||||
Pane.c \
|
||||
PixmapUtil.c \
|
||||
Primitive.c \
|
||||
Private.c \
|
||||
ProgressBar.c \
|
||||
RepType.c \
|
||||
Resources.c \
|
||||
ShellUtil.c \
|
||||
StringUtil.c \
|
||||
Tab.c \
|
||||
TaskBar.c \
|
||||
ToolBar.c \
|
||||
ToolBox.c \
|
||||
ToolItem.c \
|
||||
ToolScroll.c \
|
||||
Translations.c \
|
||||
Util.c \
|
||||
WmUtil.c \
|
||||
$(NULL)
|
||||
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_DEMO
|
||||
|
||||
DEMO_CSRCS = \
|
||||
TempTwo.c \
|
||||
$(NULL)
|
||||
|
||||
DEMO_EXPORTS = \
|
||||
TempTwo.h \
|
||||
TempTwoP.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
# There are unused widgets. They are currently not needed to build Mozilla.
|
||||
# Some of them are works in progress for new features. Some of them are
|
||||
# ideas partially implemented, but never used. Most of them are likely to
|
||||
# be used in the future in some form. They also might contain usefull code,
|
||||
# so leave them alone.
|
||||
ifdef XFE_WIDGETS_BUILD_UNUSED
|
||||
|
||||
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_UNUSED
|
||||
|
||||
UNUSED_CSRCS = \
|
||||
Chrome.c \
|
||||
ComboBox.c \
|
||||
FancyBox.c \
|
||||
FontChooser.c \
|
||||
$(NULL)
|
||||
|
||||
UNUSED_EXPORTS = \
|
||||
Chrome.h \
|
||||
ChromeP.h \
|
||||
ComboBox.h \
|
||||
ComboBoxP.h \
|
||||
FancyBox.h \
|
||||
FancyBoxP.h \
|
||||
FontChooser.h \
|
||||
FontChooserP.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
||||
CSRCS = \
|
||||
$(DEMO_CSRCS) \
|
||||
$(UNUSED_CSRCS) \
|
||||
Arrow.c \
|
||||
BmButton.c \
|
||||
BmCascade.c \
|
||||
Button.c \
|
||||
BypassShell.c \
|
||||
CallProcs.c \
|
||||
Cascade.c \
|
||||
ChildrenUtil.c \
|
||||
Converters.c \
|
||||
Cursor.c \
|
||||
DashBoard.c \
|
||||
Debug.c \
|
||||
DialogUtil.c \
|
||||
Draw.c \
|
||||
Find.c \
|
||||
FrameShell.c \
|
||||
GcUtil.c \
|
||||
Geometry.c \
|
||||
Label.c \
|
||||
ListUtil.c \
|
||||
Logo.c \
|
||||
Manager.c \
|
||||
MenuUtil.c \
|
||||
Oriented.c \
|
||||
Pane.c \
|
||||
PixmapUtil.c \
|
||||
Primitive.c \
|
||||
Private.c \
|
||||
ProgressBar.c \
|
||||
RepType.c \
|
||||
Resources.c \
|
||||
ShellUtil.c \
|
||||
StringUtil.c \
|
||||
Tab.c \
|
||||
TaskBar.c \
|
||||
ToolBar.c \
|
||||
ToolBox.c \
|
||||
ToolItem.c \
|
||||
ToolScroll.c \
|
||||
Translations.c \
|
||||
Util.c \
|
||||
WmUtil.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = XfeWidgets
|
||||
|
||||
EXPORTS = \
|
||||
$(DEMO_EXPORTS) \
|
||||
$(UNUSED_EXPORTS) \
|
||||
Arrow.h \
|
||||
ArrowP.h \
|
||||
BmButton.h \
|
||||
BmButtonP.h \
|
||||
BmCascade.h \
|
||||
BmCascadeP.h \
|
||||
Button.h \
|
||||
ButtonP.h \
|
||||
BypassShell.h \
|
||||
BypassShellP.h \
|
||||
Cascade.h \
|
||||
CascadeP.h \
|
||||
ChildrenUtil.h \
|
||||
Converters.h \
|
||||
DashBoard.h \
|
||||
DashBoardP.h \
|
||||
Debug.h \
|
||||
Defaults.h \
|
||||
DialogUtil.h \
|
||||
Draw.h \
|
||||
Find.h \
|
||||
FrameShell.h \
|
||||
FrameShellP.h \
|
||||
Geometry.h \
|
||||
GeometryP.h \
|
||||
Label.h \
|
||||
LabelP.h \
|
||||
ListUtil.h \
|
||||
ListUtilP.h \
|
||||
Logo.h \
|
||||
LogoP.h \
|
||||
Manager.h \
|
||||
ManagerP.h \
|
||||
MenuUtil.h \
|
||||
Oriented.h \
|
||||
OrientedP.h \
|
||||
PrepareP.h \
|
||||
Pane.h \
|
||||
PaneP.h \
|
||||
Primitive.h \
|
||||
PrimitiveP.h \
|
||||
ProgressBar.h \
|
||||
ProgressBarP.h \
|
||||
RepType.h \
|
||||
Resources.h \
|
||||
ShellUtil.h \
|
||||
StringDefs.h \
|
||||
StringUtil.h \
|
||||
Tab.h \
|
||||
TabP.h \
|
||||
TaskBar.h \
|
||||
TaskBarP.h \
|
||||
ToolBar.h \
|
||||
ToolBarP.h \
|
||||
ToolBox.h \
|
||||
ToolBoxP.h \
|
||||
ToolItem.h \
|
||||
ToolItemP.h \
|
||||
ToolScroll.h \
|
||||
ToolScrollP.h \
|
||||
WmUtil.h \
|
||||
Xfe.h \
|
||||
XfeAll.h \
|
||||
XfeP.h \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
INCLUDES += -I..
|
||||
DEFINES += $(XFE_EXTRA_DEFINES)
|
||||
|
|
|
@ -31,14 +31,8 @@
|
|||
#include <Xfe/BmButton.h>
|
||||
#include <Xfe/BmCascade.h>
|
||||
#include <Xfe/Button.h>
|
||||
#include <Xfe/BypassShell.h>
|
||||
#include <Xfe/Cascade.h>
|
||||
#include <Xfe/Chrome.h>
|
||||
#include <Xfe/ComboBox.h>
|
||||
#include <Xfe/DashBoard.h>
|
||||
#include <Xfe/FancyBox.h>
|
||||
#include <Xfe/FontChooser.h>
|
||||
#include <Xfe/FrameShell.h>
|
||||
#include <Xfe/Label.h>
|
||||
#include <Xfe/Logo.h>
|
||||
#include <Xfe/Pane.h>
|
||||
|
@ -50,4 +44,19 @@
|
|||
#include <Xfe/ToolItem.h>
|
||||
#include <Xfe/ToolScroll.h>
|
||||
|
||||
#if defined(XFE_WIDGETS_BUILD_DEMO)
|
||||
#include <Xfe/TempTwo.h>
|
||||
#endif /* XFE_WIDGETS_BUILD_DEMO */
|
||||
|
||||
#if defined(XFE_WIDGETS_BUILD_UNUSED)
|
||||
#include <Xfe/BypassShell.h>
|
||||
#include <Xfe/Chrome.h>
|
||||
#include <Xfe/ComboBox.h>
|
||||
#include <Xfe/FancyBox.h>
|
||||
#include <Xfe/FontChooser.h>
|
||||
#include <Xfe/FrameShell.h>
|
||||
#include <Xfe/Oriented.h>
|
||||
#endif /* XFE_WIDGETS_BUILD_UNUSED */
|
||||
|
||||
#endif /* end XfeAll.h */
|
||||
|
||||
|
|
|
@ -15,25 +15,52 @@
|
|||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
##########################################################################
|
||||
#
|
||||
# Name: Makefile
|
||||
# Description: Makefile for XfeTest library
|
||||
# Author: Ramiro Estrugo <ramiro@netscape.com>
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
DEPTH = ../../../..
|
||||
|
||||
# XfeTest headers (only one) are exported to dist/public/XfeTest/Xfe
|
||||
MODULE = XfeTest/Xfe
|
||||
|
||||
MODULE = XfeTest
|
||||
LIBRARY_NAME = XfeTest
|
||||
|
||||
CSRCS = \
|
||||
TestAnim.c \
|
||||
TestApp.c \
|
||||
TestCallbacks.c \
|
||||
TestCreate.c \
|
||||
TestIcons.c \
|
||||
TestMenu.c \
|
||||
TestPixmap.c \
|
||||
TestToolBar.c \
|
||||
TestUtil.c \
|
||||
$(NULL)
|
||||
|
||||
ifdef XFE_WIDGETS_BUILD_DEMO
|
||||
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_DEMO
|
||||
endif
|
||||
|
||||
ifdef XFE_WIDGETS_BUILD_UNUSED
|
||||
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_UNUSED
|
||||
endif
|
||||
|
||||
CSRCS = \
|
||||
TestAnim.c \
|
||||
TestApp.c \
|
||||
TestCallbacks.c \
|
||||
TestCreate.c \
|
||||
TestIcons.c \
|
||||
TestMenu.c \
|
||||
TestPixmap.c \
|
||||
TestToolBar.c \
|
||||
TestUtil.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = \
|
||||
XfeTest \
|
||||
XfeWidgets
|
||||
|
||||
EXPORTS = \
|
||||
XfeTest.h \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
INCLUDES += -I.. -I../.. -I../icons
|
||||
INCLUDES += -I../icons
|
||||
DEFINES += $(XFE_EXTRA_DEFINES)
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
#include <X11/Xmu/Editres.h>
|
||||
#include <X11/Xmu/Converters.h>
|
||||
|
@ -109,7 +109,7 @@ XfeFrameCreate(char * frame_name,ArgList args,Cardinal num_args)
|
|||
|
||||
main_form = XfeCreateManagedForm(frame,"MainForm",NULL,0);
|
||||
|
||||
/* XfeAddEditresSupport(frame); */
|
||||
XfeAddEditresSupport(frame);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ XfeFrameCreateWithChrome(char * frame_name,ArgList args,Cardinal num_args)
|
|||
frame,
|
||||
NULL);
|
||||
|
||||
/* XfeAddEditresSupport(frame); */
|
||||
XfeAddEditresSupport(frame);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*extern */ void
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
static String tool_names[] =
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
static WidgetClass type_to_class (XfeMenuItemType item_type);
|
||||
static String type_to_action_cb_name (XfeMenuItemType item_type);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
#if defined(LINUX) || defined(IRIX)
|
||||
#include <X11/xpm.h>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
static WidgetClass type_to_class (XfeMenuItemType item_type);
|
||||
static String type_to_action_cb_name (XfeMenuItemType item_type);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static XmString fe_StringChopCreate(char *,char *,XmFontList,int);
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: ArrowTest.c */
|
||||
/* Description: Test for XfeArrow widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
Widget arrow;
|
||||
|
||||
XfeAppCreateSimple("ArrowTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
arrow = XtVaCreateManagedWidget("Arrow",
|
||||
xfeArrowWidgetClass,
|
||||
form,
|
||||
NULL);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,649 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: ButtonTest.c */
|
||||
/* Description: Test for XfeButton widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static Widget create_button (Widget,String);
|
||||
static void install_large_pixmaps (Widget);
|
||||
static void install_small_pixmaps (Widget);
|
||||
static void change_pixmap (Widget);
|
||||
static void change_label (Widget);
|
||||
static void button_callback (Widget,XtPointer,XtPointer);
|
||||
static void menu_item_cb (Widget,XtPointer,XtPointer);
|
||||
|
||||
static Widget _button_target = NULL;
|
||||
|
||||
static String labels[] =
|
||||
{
|
||||
"Label One",
|
||||
"A",
|
||||
"This is a long label",
|
||||
"",
|
||||
"The previous one was blank",
|
||||
"Label Four",
|
||||
"First Line\nSecond Line\nThird Line",
|
||||
"-=-=-=-= What ? #$!&*",
|
||||
};
|
||||
|
||||
#define CMP(s1,s2) (strcmp((s1),(s2)) == 0)
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec file_items[] =
|
||||
{
|
||||
{ "Open", XfeMENU_PUSH },
|
||||
{ "Save", XfeMENU_PUSH },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Exit", XfeMENU_PUSH, XfeExitCallback },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec button_type_items[] =
|
||||
{
|
||||
{ "TypePush", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "TypeToggle", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "TypeNone", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec button_layout_items[] =
|
||||
{
|
||||
{ "LayoutLabelOnly", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "LayoutLabelOnBottom", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "LayoutLabelOnLeft", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "LayoutLabelOnRight", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "LayoutLabelOnTop", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "LayoutPixmapOnly", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec button_trigger_items[] =
|
||||
{
|
||||
{ "TriggerAnywhere", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "TriggerEither", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "TriggerNeither", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "TriggerLabel", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "TriggerPixmap", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec modifiers_items[] =
|
||||
{
|
||||
{ "None", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "Any", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Shift", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "Control", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "Alt", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Mod1", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "Mod2", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "Mod3", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "Mod4", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec button_boolean_items[] =
|
||||
{
|
||||
{ "TraversalOn", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "RaiseOnEnter", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "FillOnEnter", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "FillOnArm" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "EmulateMotif", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Armed", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "Raised", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Sensitive", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "PretendSensitive", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Selected", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "UsePreferredWidth", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "UsePreferredHeight", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec misc_items[] =
|
||||
{
|
||||
{ "ChangePixmap", XfeMENU_PUSH, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec label_items[] =
|
||||
{
|
||||
{ "ChangeLabel", XfeMENU_PUSH, menu_item_cb },
|
||||
{ "Modifiers", XfeMENU_PANE, NULL, modifiers_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec dimension_items[] =
|
||||
{
|
||||
{ "0", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "1", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "2", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "3", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "4", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "5", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "6", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "7", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "8", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "9", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "10", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "20", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "30", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "40", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "50", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "100", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "200", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "300", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "400", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "500", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "1000", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec margin_items[] =
|
||||
{
|
||||
{ "MarginLeft", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "MarginRight", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "MarginTop", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "MarginBottom", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "MarginAll" , XfeMENU_PANE, NULL, dimension_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec shadow_type_items[] =
|
||||
{
|
||||
{ "ShadowIn", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "ShadowOut", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "ShadowEtchedIn", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "ShadowEtchedOut", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec alignment_items[] =
|
||||
{
|
||||
{ "AlignmentBeginning", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "AlignmentCenter", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "AlignmentEnd", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec enumeration_items[] =
|
||||
{
|
||||
{ "ButtonType", XfeMENU_PANE, NULL, button_type_items },
|
||||
{ "ButtonLayout", XfeMENU_PANE, NULL, button_layout_items },
|
||||
{ "ButtonTrigger", XfeMENU_PANE, NULL, button_trigger_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "ShadowType", XfeMENU_PANE, NULL, shadow_type_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "LabelAlignment", XfeMENU_PANE, NULL, alignment_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec dimensions_items[] =
|
||||
{
|
||||
{ "Width", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "Height", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "HighlightThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "ShadowThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Margins", XfeMENU_PANE, NULL, margin_items },
|
||||
{ "RaiseBorderThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "Spacing", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "ArmOffset", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec xm_primitive_items[] =
|
||||
{
|
||||
{ "Open", XfeMENU_PUSH },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec xfe_primitive_items[] =
|
||||
{
|
||||
{ "Open", XfeMENU_PUSH },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuPaneRec pane_items[] =
|
||||
{
|
||||
{ "File", file_items },
|
||||
{ "XfePrimitive", xfe_primitive_items },
|
||||
{ "Enumeration", enumeration_items },
|
||||
{ "Dimensions", dimensions_items },
|
||||
{ "Boolean", button_boolean_items },
|
||||
{ "Misc", misc_items },
|
||||
{ "Label", label_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static Widget _main_form;
|
||||
static Widget _menu_bar;
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget frame;
|
||||
|
||||
XfeAppCreateSimple("ButtonTest",&argc,argv,"MainFrame",&frame,&_main_form);
|
||||
|
||||
_button_target = create_button(_main_form,"ButtonTarget");
|
||||
|
||||
_menu_bar = XfeMenuBarCreate(_main_form,"MenuBar",
|
||||
pane_items,
|
||||
(XtPointer) _button_target,NULL,0);
|
||||
|
||||
install_large_pixmaps(_button_target);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_button(Widget parent,String name)
|
||||
{
|
||||
Widget w;
|
||||
|
||||
w = XtVaCreateManagedWidget(name,
|
||||
xfeButtonWidgetClass,
|
||||
parent,
|
||||
NULL);
|
||||
|
||||
XtAddCallback(w,XmNactivateCallback,button_callback,NULL);
|
||||
XtAddCallback(w,XmNarmCallback,button_callback,NULL);
|
||||
XtAddCallback(w,XmNdisarmCallback,button_callback,NULL);
|
||||
XtAddCallback(w,XmNselectionChangedCallback,button_callback,NULL);
|
||||
/* XtAddCallback(w,XmNenterCallback,button_callback,NULL); */
|
||||
/* XtAddCallback(w,XmNleaveCallback,button_callback,NULL); */
|
||||
|
||||
return w;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
install_large_pixmaps(Widget w)
|
||||
{
|
||||
if (!XfeIsAlive(w))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
XtVaSetValues(
|
||||
w,
|
||||
XmNpixmap, XfeGetPixmap(w,"task_browser"),
|
||||
XmNpixmapMask, XfeGetMask(w,"task_browser"),
|
||||
XmNarmedPixmap, XfeGetPixmap(w,"task_browser_armed"),
|
||||
XmNarmedPixmapMask, XfeGetMask(w,"task_browser_armed"),
|
||||
XmNraisedPixmap, XfeGetPixmap(w,"task_browser_raised"),
|
||||
XmNraisedPixmapMask, XfeGetMask(w,"task_browser_raised"),
|
||||
NULL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
install_small_pixmaps(Widget w)
|
||||
{
|
||||
if (!XfeIsAlive(w))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
XtVaSetValues(
|
||||
w,
|
||||
XmNpixmap, XfeGetPixmap(w,"task_small_browser"),
|
||||
XmNpixmapMask, XfeGetMask(w,"task_small_browser"),
|
||||
XmNarmedPixmap, XfeGetPixmap(w,"task_small_browser_armed"),
|
||||
XmNarmedPixmapMask, XfeGetMask(w,"task_small_browser_armed"),
|
||||
XmNraisedPixmap, XfeGetPixmap(w,"task_small_browser_raised"),
|
||||
XmNraisedPixmapMask, XfeGetMask(w,"task_small_browser_raised"),
|
||||
NULL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
change_pixmap(Widget w)
|
||||
{
|
||||
static Boolean toggle = True;
|
||||
|
||||
if (!XfeIsAlive(w))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (toggle)
|
||||
{
|
||||
install_small_pixmaps(w);
|
||||
}
|
||||
else
|
||||
{
|
||||
install_large_pixmaps(w);
|
||||
}
|
||||
|
||||
toggle = !toggle;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
change_label(Widget w)
|
||||
{
|
||||
static Cardinal i = 0;
|
||||
|
||||
if (!XfeIsAlive(w))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
XfeSetXmStringPSZ(w,
|
||||
XmNlabelString,
|
||||
XmFONTLIST_DEFAULT_TAG,
|
||||
labels[i % XtNumber(labels)]);
|
||||
|
||||
i++;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
menu_item_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
String name = XtName(w);
|
||||
String parent_name = XtName(XtParent(w));
|
||||
Arg av[20];
|
||||
Cardinal ac = 0;
|
||||
|
||||
printf("menu_item_cb(%s,%s)\n",name,parent_name);
|
||||
|
||||
if (!XfeIsAlive(_button_target))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Modifiers */
|
||||
if (CMP(parent_name,"Modifiers"))
|
||||
{
|
||||
if (CMP(name,"None"))
|
||||
{
|
||||
XtSetArg(av[ac],XmNselectionModifiers,None); ac++;
|
||||
}
|
||||
else if (CMP(name,"Any"))
|
||||
{
|
||||
XtSetArg(av[ac],XmNselectionModifiers,AnyModifier); ac++;
|
||||
}
|
||||
else if (CMP(name,"Shift"))
|
||||
{
|
||||
XtSetArg(av[ac],XmNselectionModifiers,ShiftMask); ac++;
|
||||
}
|
||||
else if (CMP(name,"Control"))
|
||||
{
|
||||
XtSetArg(av[ac],XmNselectionModifiers,ControlMask); ac++;
|
||||
}
|
||||
else if (CMP(name,"Alt"))
|
||||
{
|
||||
XtSetArg(av[ac],XmNselectionModifiers,Mod1Mask); ac++;
|
||||
}
|
||||
else if (CMP(name,"Mod1"))
|
||||
{
|
||||
XtSetArg(av[ac],XmNselectionModifiers,Mod1Mask); ac++;
|
||||
}
|
||||
else if (CMP(name,"Mod2"))
|
||||
{
|
||||
XtSetArg(av[ac],XmNselectionModifiers,Mod2Mask); ac++;
|
||||
}
|
||||
else if (CMP(name,"Mod3"))
|
||||
{
|
||||
XtSetArg(av[ac],XmNselectionModifiers,Mod3Mask); ac++;
|
||||
}
|
||||
else if (CMP(name,"Mod4"))
|
||||
{
|
||||
XtSetArg(av[ac],XmNselectionModifiers,Mod4Mask); ac++;
|
||||
}
|
||||
}
|
||||
else if (strcmp(name,"TypePush") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonType,XmBUTTON_PUSH); ac++;
|
||||
}
|
||||
else if (strcmp(name,"TypeToggle") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonType,XmBUTTON_TOGGLE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"TypeNone") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonType,XmBUTTON_NONE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"RaiseOnEnter") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNraiseOnEnter);
|
||||
}
|
||||
else if (strcmp(name,"TraversalOn") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNtraversalOn);
|
||||
}
|
||||
else if (strcmp(name,"EmulateMotif") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNemulateMotif);
|
||||
}
|
||||
else if (strcmp(name,"Armed") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNarmed);
|
||||
}
|
||||
else if (strcmp(name,"Raised") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNraised);
|
||||
}
|
||||
else if (strcmp(name,"Selected") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNselected);
|
||||
}
|
||||
else if (strcmp(name,"PretendSensitive") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNpretendSensitive);
|
||||
}
|
||||
else if (strcmp(name,"Sensitive") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNsensitive);
|
||||
}
|
||||
else if (strcmp(name,"UsePreferredWidth") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNusePreferredWidth);
|
||||
}
|
||||
else if (strcmp(name,"UsePreferredHeight") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNusePreferredHeight);
|
||||
}
|
||||
else if (strcmp(name,"FillOnEnter") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNfillOnEnter);
|
||||
}
|
||||
else if (strcmp(name,"FillOnArm") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_button_target,XmNfillOnArm);
|
||||
}
|
||||
else if (strcmp(name,"LayoutLabelOnly") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonLayout,XmBUTTON_LABEL_ONLY); ac++;
|
||||
}
|
||||
else if (strcmp(name,"LayoutLabelOnBottom") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonLayout,XmBUTTON_LABEL_ON_BOTTOM); ac++;
|
||||
}
|
||||
else if (strcmp(name,"LayoutLabelOnLeft") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonLayout,XmBUTTON_LABEL_ON_LEFT); ac++;
|
||||
}
|
||||
else if (strcmp(name,"LayoutLabelOnRight") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonLayout,XmBUTTON_LABEL_ON_RIGHT); ac++;
|
||||
}
|
||||
else if (strcmp(name,"LayoutLabelOnTop") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonLayout,XmBUTTON_LABEL_ON_TOP); ac++;
|
||||
}
|
||||
else if (strcmp(name,"LayoutPixmapOnly") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonLayout,XmBUTTON_PIXMAP_ONLY); ac++;
|
||||
}
|
||||
else if (strcmp(name,"TriggerAnywhere") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonTrigger,XmBUTTON_TRIGGER_ANYWHERE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"TriggerEither") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonTrigger,XmBUTTON_TRIGGER_EITHER); ac++;
|
||||
}
|
||||
else if (strcmp(name,"TriggerNeither") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonTrigger,XmBUTTON_TRIGGER_NEITHER); ac++;
|
||||
}
|
||||
else if (strcmp(name,"TriggerLabel") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonTrigger,XmBUTTON_TRIGGER_LABEL); ac++;
|
||||
}
|
||||
else if (strcmp(name,"TriggerPixmap") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNbuttonTrigger,XmBUTTON_TRIGGER_PIXMAP); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowIn") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_IN); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowOut") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_OUT); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowEtchedIn") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_ETCHED_IN); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowEtchedOut") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_ETCHED_OUT); ac++;
|
||||
}
|
||||
else if (strcmp(name,"AlignmentBeginning") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNlabelAlignment,XmALIGNMENT_BEGINNING); ac++;
|
||||
}
|
||||
else if (strcmp(name,"AlignmentCenter") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNlabelAlignment,XmALIGNMENT_CENTER); ac++;
|
||||
}
|
||||
else if (strcmp(name,"AlignmentEnd") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNlabelAlignment,XmALIGNMENT_END); ac++;
|
||||
}
|
||||
|
||||
if (strcmp(parent_name,"MarginLeft") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginLeft,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginRight") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginRight,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginTop") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginTop,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginBottom") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginBottom,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginAll") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginLeft,atoi(name)); ac++;
|
||||
XtSetArg(av[ac],XmNmarginRight,atoi(name)); ac++;
|
||||
XtSetArg(av[ac],XmNmarginTop,atoi(name)); ac++;
|
||||
XtSetArg(av[ac],XmNmarginBottom,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"Width") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNwidth,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"Height") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNheight,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"ShadowThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"HighlightThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNhighlightThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"RaiseBorderThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNraiseBorderThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"Spacing") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNspacing,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"ArmOffset") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNarmOffset,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ChangePixmap") == 0)
|
||||
{
|
||||
change_pixmap(_button_target);
|
||||
}
|
||||
else if (strcmp(name,"ChangeLabel") == 0)
|
||||
{
|
||||
change_label(_button_target);
|
||||
}
|
||||
|
||||
if (ac)
|
||||
{
|
||||
XtSetValues(_button_target,av,ac);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
button_callback(Widget button,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeButtonCallbackStruct * data = (XfeButtonCallbackStruct *) call_data;
|
||||
String rname;
|
||||
|
||||
switch(data->reason)
|
||||
{
|
||||
case XmCR_ARM: rname = "Arm"; break;
|
||||
case XmCR_DISARM: rname = "Disarm"; break;
|
||||
case XmCR_ACTIVATE: rname = "Activate"; break;
|
||||
case XmCR_ENTER: rname = "Enter"; break;
|
||||
case XmCR_LEAVE: rname = "Leave"; break;
|
||||
case XmCR_RAISE: rname = "Raise"; break;
|
||||
case XmCR_LOWER: rname = "Lower"; break;
|
||||
case XmCR_SELECTION_CHANGED: rname = "SelectionChanged"; break;
|
||||
}
|
||||
|
||||
printf("%s(%s)\n",rname,XtName(button));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,276 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: CascadeTest.c */
|
||||
/* Description: Test for XfeCascade widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static String names[] =
|
||||
{
|
||||
"One",
|
||||
"Two",
|
||||
"Three",
|
||||
"Four",
|
||||
"Five",
|
||||
"Six",
|
||||
"Seven",
|
||||
"Eight",
|
||||
"Nine",
|
||||
"Ten",
|
||||
};
|
||||
|
||||
static Cardinal delays[] =
|
||||
{
|
||||
0,
|
||||
200,
|
||||
0,
|
||||
0,
|
||||
300,
|
||||
1000,
|
||||
500,
|
||||
5000,
|
||||
400,
|
||||
0,
|
||||
};
|
||||
|
||||
static Cardinal counts[] =
|
||||
{
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
4,
|
||||
8,
|
||||
16,
|
||||
32,
|
||||
64,
|
||||
128,
|
||||
1,
|
||||
};
|
||||
|
||||
static void activate_callback (Widget,XtPointer,XtPointer);
|
||||
static void arm_callback (Widget,XtPointer,XtPointer);
|
||||
static void disarm_callback (Widget,XtPointer,XtPointer);
|
||||
static void popup_callback (Widget,XtPointer,XtPointer);
|
||||
static void popdown_callback (Widget,XtPointer,XtPointer);
|
||||
static void cascading_callback (Widget,XtPointer,XtPointer);
|
||||
static void populate_callback (Widget,XtPointer,XtPointer);
|
||||
|
||||
static Widget create_button (Widget,String,Cardinal,Cardinal);
|
||||
static void add_items (Widget,Cardinal);
|
||||
static Widget add_item (Widget,String);
|
||||
static Widget get_sub_menu_id (Widget);
|
||||
|
||||
#define MAX_J 10
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
Widget tool_bar;
|
||||
Cardinal i;
|
||||
|
||||
XfeAppCreateSimple("CascadeTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
tool_bar = XtVaCreateManagedWidget("ToolBar",
|
||||
xfeToolBarWidgetClass,
|
||||
form,
|
||||
NULL);
|
||||
|
||||
for (i = 0; i < XtNumber(names); i++)
|
||||
{
|
||||
create_button(tool_bar,names[i],counts[i],delays[i]);
|
||||
}
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
activate_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeButtonCallbackStruct * cbs = (XfeButtonCallbackStruct *) call_data;
|
||||
|
||||
printf("Activate(%s)\n\n",XtName(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
arm_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeButtonCallbackStruct * cbs = (XfeButtonCallbackStruct *) call_data;
|
||||
|
||||
printf("Arm(%s)\n\n",XtName(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
disarm_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
printf("Disarm(%s)\n\n",XtName(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
popup_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
printf("Popup(%s)\n\n",XtName(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
popdown_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
printf("Popdown(%s)\n\n",XtName(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
populate_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
Widget submenu;
|
||||
Cardinal num_children;
|
||||
|
||||
XtVaGetValues(w,XmNsubMenuId,&submenu,NULL);
|
||||
|
||||
assert( XfeIsAlive(submenu) );
|
||||
|
||||
XfeChildrenGet(submenu,NULL,&num_children);
|
||||
|
||||
|
||||
printf("Populate(%s) Have %d menu items\n\n",XtName(w),num_children);
|
||||
|
||||
if (strcmp(XtName(w),"One") == 0)
|
||||
{
|
||||
XfeCascadeDestroyChildren(w);
|
||||
/*XfeChildrenDestroy(submenu);*/
|
||||
|
||||
XSync(XtDisplay(w),True);
|
||||
|
||||
XmUpdateDisplay(w);
|
||||
|
||||
add_items(w,30);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
cascading_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
Widget submenu;
|
||||
Cardinal num_children;
|
||||
|
||||
XtVaGetValues(w,XmNsubMenuId,&submenu,NULL);
|
||||
|
||||
assert( XfeIsAlive(submenu) );
|
||||
|
||||
XfeChildrenGet(submenu,NULL,&num_children);
|
||||
|
||||
printf("Cascading(%s) Have %d menu items\n\n",XtName(w),num_children);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_button(Widget parent,String name,Cardinal item_count,Cardinal delay)
|
||||
{
|
||||
Widget button;
|
||||
Cardinal i;
|
||||
char buf[100];
|
||||
|
||||
static String items[] =
|
||||
{
|
||||
"Item One",
|
||||
"Item Two",
|
||||
"Item Three",
|
||||
"Item Four",
|
||||
"Item Five",
|
||||
"Item Six",
|
||||
"Item Seven",
|
||||
"Item Eight",
|
||||
"Item Nine",
|
||||
"Item Ten",
|
||||
};
|
||||
|
||||
button = XtVaCreateManagedWidget(name,
|
||||
xfeCascadeWidgetClass,
|
||||
parent,
|
||||
XmNmappingDelay, delay,
|
||||
NULL);
|
||||
|
||||
XtAddCallback(button,XmNactivateCallback,activate_callback,NULL);
|
||||
XtAddCallback(button,XmNarmCallback,arm_callback,NULL);
|
||||
XtAddCallback(button,XmNcascadingCallback,cascading_callback,NULL);
|
||||
XtAddCallback(button,XmNdisarmCallback,disarm_callback,NULL);
|
||||
XtAddCallback(button,XmNpopdownCallback,popdown_callback,NULL);
|
||||
XtAddCallback(button,XmNcascadingCallback,populate_callback,NULL);
|
||||
XtAddCallback(button,XmNpopupCallback,popup_callback,NULL);
|
||||
|
||||
add_items(button,item_count);
|
||||
|
||||
return button;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
add_items(Widget parent,Cardinal item_count)
|
||||
{
|
||||
|
||||
if (item_count > 0)
|
||||
{
|
||||
Cardinal i;
|
||||
char buf[100];
|
||||
Widget sub_menu_id = get_sub_menu_id(parent);
|
||||
|
||||
assert( XfeIsAlive(sub_menu_id) );
|
||||
|
||||
for (i = 0; i < item_count; i++)
|
||||
{
|
||||
sprintf(buf,"Item %-2d",i);
|
||||
|
||||
add_item(sub_menu_id,buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
add_item(Widget parent,String name)
|
||||
{
|
||||
Widget item;
|
||||
|
||||
item = XtVaCreateManagedWidget(name,
|
||||
/*xmPushButtonGadgetClass,*/
|
||||
xmPushButtonWidgetClass,
|
||||
parent,
|
||||
NULL);
|
||||
|
||||
return item;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
get_sub_menu_id(Widget w)
|
||||
{
|
||||
Widget sub_menu_id;
|
||||
|
||||
XtVaGetValues(w,XmNsubMenuId,&sub_menu_id,NULL);
|
||||
|
||||
return sub_menu_id;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
static Widget create_chrome (Widget,String);
|
||||
static Widget create_url_bar (Widget,String);
|
||||
|
|
|
@ -1,243 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: ComboBoxTest.c */
|
||||
/* Description: Test for XfeComboBox widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
#include <Xfe/ListUtilP.h>
|
||||
|
||||
static void activate_callback (Widget,XtPointer,XtPointer);
|
||||
static void arm_callback (Widget,XtPointer,XtPointer);
|
||||
static void disarm_callback (Widget,XtPointer,XtPointer);
|
||||
|
||||
static void combo_add_items (Widget,String *,Cardinal);
|
||||
static void list_add_items (Widget,String *,Cardinal);
|
||||
|
||||
static String items1[] =
|
||||
{
|
||||
"Item One",
|
||||
"Item Two",
|
||||
"Item Three",
|
||||
"Item Four",
|
||||
"Item Five",
|
||||
"Item Six",
|
||||
"Item Seven",
|
||||
"Item Eight",
|
||||
"Item Nine",
|
||||
"Item Ten",
|
||||
"Item Eleven",
|
||||
"Item Twelve",
|
||||
};
|
||||
|
||||
static String items2[] =
|
||||
{
|
||||
"Red",
|
||||
"Green",
|
||||
"Blue",
|
||||
"Brown",
|
||||
"Orange",
|
||||
"Cyan",
|
||||
"Magenta",
|
||||
"Black",
|
||||
"White",
|
||||
"Yellow"
|
||||
};
|
||||
|
||||
static String items3[] =
|
||||
{
|
||||
"North",
|
||||
"South",
|
||||
"East",
|
||||
"West",
|
||||
"South East",
|
||||
"South West",
|
||||
"North East",
|
||||
"North West"
|
||||
};
|
||||
|
||||
static String items4[] =
|
||||
{
|
||||
"January",
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December"
|
||||
};
|
||||
|
||||
#define num_items1 XtNumber(items1)
|
||||
#define num_items2 XtNumber(items2)
|
||||
#define num_items3 XtNumber(items3)
|
||||
#define num_items4 XtNumber(items4)
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
Widget cb[4];
|
||||
Widget icon;
|
||||
Widget list;
|
||||
|
||||
XfeAppCreateSimple("ComboBoxTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
cb[0] = XtVaCreateManagedWidget("ComboBox1",
|
||||
xfeComboBoxWidgetClass,
|
||||
form,
|
||||
XmNcomboBoxType,XmCOMBO_BOX_EDITABLE,
|
||||
NULL);
|
||||
|
||||
cb[1] = XtVaCreateManagedWidget("ComboBox2",
|
||||
xfeComboBoxWidgetClass,
|
||||
form,
|
||||
XmNcomboBoxType,XmCOMBO_BOX_READ_ONLY,
|
||||
NULL);
|
||||
|
||||
cb[2] = XtVaCreateManagedWidget("ComboBox3",
|
||||
xfeFancyBoxWidgetClass,
|
||||
form,
|
||||
XmNcomboBoxType,XmCOMBO_BOX_EDITABLE,
|
||||
NULL);
|
||||
|
||||
cb[3] = XtVaCreateManagedWidget("ComboBox4",
|
||||
xfeFancyBoxWidgetClass,
|
||||
form,
|
||||
XmNcomboBoxType,XmCOMBO_BOX_READ_ONLY,
|
||||
NULL);
|
||||
|
||||
icon = XtVaCreateManagedWidget("IC",
|
||||
xfeButtonWidgetClass,
|
||||
cb[2],
|
||||
XmNbackground, XfeBackground(cb[2]),
|
||||
XmNforeground, XfeForeground(cb[2]),
|
||||
NULL);
|
||||
|
||||
assert( XfeIsAlive(icon) );
|
||||
|
||||
XtVaSetValues(
|
||||
icon,
|
||||
XmNpixmap, XfeGetPixmap(icon,"proxy"),
|
||||
XmNpixmapMask, XfeGetMask(icon,"proxy"),
|
||||
XmNraisedPixmap, XfeGetPixmap(icon,"proxy_raised"),
|
||||
XmNraisedPixmapMask, XfeGetMask(icon,"proxy_raised"),
|
||||
XmNbuttonLayout, XmBUTTON_PIXMAP_ONLY,
|
||||
XmNfillOnEnter, False,
|
||||
XmNfillOnArm, False,
|
||||
XmNraiseOnEnter, True,
|
||||
XmNshadowThickness, 0,
|
||||
XmNraiseBorderThickness, 0,
|
||||
NULL);
|
||||
|
||||
|
||||
list = XmCreateScrolledList(form,"List",NULL,0);
|
||||
|
||||
/* _XfeXmListAccess(list,BaseX) += 10; */
|
||||
|
||||
/* lw->list.BaseX = (Position )lw->list.margin_width + */
|
||||
|
||||
XtManageChild(list);
|
||||
|
||||
combo_add_items(cb[0],items1,num_items1);
|
||||
combo_add_items(cb[1],items2,num_items2);
|
||||
combo_add_items(cb[2],items3,num_items3);
|
||||
combo_add_items(cb[3],items4,num_items4);
|
||||
|
||||
list_add_items(list,items1,num_items1);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
combo_add_items(Widget w,String * items,Cardinal n)
|
||||
{
|
||||
XmString * table = NULL;
|
||||
Cardinal i;
|
||||
|
||||
assert( XfeIsAlive(w) );
|
||||
assert( XfeIsComboBox(w) );
|
||||
assert( items != NULL );
|
||||
assert( n > 0 );
|
||||
|
||||
table = XfeGetXmStringTable(items,n);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
XfeComboBoxAddItem(w,table[i],0);
|
||||
}
|
||||
|
||||
XfeFreeXmStringTable(table,n);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
list_add_items(Widget w,String * items,Cardinal n)
|
||||
{
|
||||
XmString * table = NULL;
|
||||
Cardinal i;
|
||||
|
||||
assert( XfeIsAlive(w) );
|
||||
assert( XmIsList(w) );
|
||||
assert( items != NULL );
|
||||
assert( n > 0 );
|
||||
|
||||
table = XfeGetXmStringTable(items,n);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
XmListAddItem(w,table[i],0);
|
||||
}
|
||||
|
||||
XfeFreeXmStringTable(table,n);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
activate_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
printf("Activate(%s)\n",XtName(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
arm_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
printf("Arm(%s)\n",XtName(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
disarm_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
printf("Disarm(%s)\n",XtName(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,178 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: DashBoardTest.c */
|
||||
/* Description: Test for XfeDashBoard widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static Widget create_frame_shell (Widget,String);
|
||||
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget frame1;
|
||||
Widget frame2;
|
||||
Widget frame3;
|
||||
Widget frame4;
|
||||
|
||||
XfeAppCreate("DashBoardTest",&argc,argv);
|
||||
|
||||
frame1 = create_frame_shell(XfeAppShell(),"Frame1");
|
||||
|
||||
frame2 = create_frame_shell(XfeAppShell(),"Frame2");
|
||||
|
||||
frame3 = create_frame_shell(XfeAppShell(),"Frame3");
|
||||
|
||||
frame4 = create_frame_shell(XfeAppShell(),"Frame4");
|
||||
|
||||
XtPopup(frame1,XtGrabNone);
|
||||
|
||||
XtPopup(frame2,XtGrabNone);
|
||||
|
||||
XtPopup(frame3,XtGrabNone);
|
||||
|
||||
XtPopup(frame4,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_frame_shell(Widget parent,String name)
|
||||
{
|
||||
Widget frame;
|
||||
Widget form;
|
||||
Widget docked_task_bar;
|
||||
Widget dash_board;
|
||||
|
||||
static Widget floating_shell = NULL;
|
||||
static Boolean first_instance = True;
|
||||
|
||||
frame = XtVaCreatePopupShell(name,
|
||||
xfeFrameShellWidgetClass,
|
||||
parent,
|
||||
NULL);
|
||||
|
||||
XfeAddEditresSupport(frame);
|
||||
|
||||
form = XtVaCreateManagedWidget("Form",
|
||||
xmFormWidgetClass,
|
||||
frame,
|
||||
NULL);
|
||||
|
||||
if (first_instance)
|
||||
{
|
||||
int mask;
|
||||
int func;
|
||||
|
||||
|
||||
Widget floating_task_bar;
|
||||
|
||||
first_instance = False;
|
||||
|
||||
mask = MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MENU;
|
||||
func = MWM_FUNC_CLOSE | MWM_FUNC_MOVE;
|
||||
|
||||
floating_shell =
|
||||
XtVaCreatePopupShell("FloatingShell",
|
||||
xmDialogShellWidgetClass,
|
||||
XfeAncestorFindApplicationShell(parent),
|
||||
XmNvisual, XfeVisual(parent),
|
||||
XmNcolormap, XfeColormap(parent),
|
||||
XmNdepth, XfeDepth(parent),
|
||||
XmNmwmDecorations, mask,
|
||||
XmNmwmFunctions, func,
|
||||
XmNallowShellResize, True,
|
||||
XmNdeleteResponse, XmDO_NOTHING,
|
||||
NULL);
|
||||
|
||||
|
||||
floating_task_bar = XfeCreateLoadedTaskBar(floating_shell,
|
||||
"FloatingTaskBar",
|
||||
True,
|
||||
"Task_",
|
||||
NULL,
|
||||
4,
|
||||
NULL);
|
||||
}
|
||||
|
||||
dash_board = XtVaCreateManagedWidget("DashBoard",
|
||||
xfeDashBoardWidgetClass,
|
||||
form,
|
||||
NULL);
|
||||
|
||||
XtAddCallback(dash_board,XmNdockCallback,XfeDockCallback,NULL);
|
||||
XtAddCallback(dash_board,XmNundockCallback,XfeUndockCallback,NULL);
|
||||
|
||||
XtVaSetValues(dash_board,
|
||||
XmNfloatingShell, floating_shell,
|
||||
NULL);
|
||||
|
||||
/* Create the progress bar */
|
||||
XtVaCreateManagedWidget("ProgressBar",
|
||||
xfeProgressBarWidgetClass,
|
||||
dash_board,
|
||||
XmNusePreferredHeight, True,
|
||||
XmNusePreferredWidth, True,
|
||||
XmNshadowThickness, 1,
|
||||
XmNshadowType, XmSHADOW_IN,
|
||||
XmNhighlightThickness, 0,
|
||||
XmNtraversalOn, False,
|
||||
NULL);
|
||||
|
||||
/* Create the status bar */
|
||||
XtVaCreateWidget("StatusBar",
|
||||
xfeLabelWidgetClass,
|
||||
dash_board,
|
||||
XmNusePreferredHeight, False,
|
||||
XmNusePreferredWidth, True,
|
||||
XmNshadowThickness, 2,
|
||||
XmNshadowType, XmSHADOW_IN,
|
||||
XmNhighlightThickness, 0,
|
||||
XmNtraversalOn, False,
|
||||
NULL);
|
||||
|
||||
/* Create the task bar */
|
||||
docked_task_bar = XfeCreateLoadedTaskBar(dash_board,
|
||||
"DockedTaskBar",
|
||||
False,
|
||||
"T",
|
||||
NULL,
|
||||
4,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(docked_task_bar,
|
||||
XmNorientation, XmHORIZONTAL,
|
||||
XmNusePreferredWidth, True,
|
||||
XmNusePreferredHeight, True,
|
||||
XmNhighlightThickness, 0,
|
||||
XmNshadowThickness, 0,
|
||||
XmNtraversalOn, False,
|
||||
NULL);
|
||||
|
||||
return frame;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,91 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: FontChooserTest.c */
|
||||
/* Description: Test for XfeFontChooser widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static String font_names[] =
|
||||
{
|
||||
"-adobe-courier-medium-r-normal--20-140-100-100-m-110-iso8859-1",
|
||||
"-adobe-helvetica-medium-r-normal--20-140-100-100-p-100-iso8859-1",
|
||||
"-adobe-new century schoolbook-medium-r-normal--20-140-100-100-p-103-iso8859-1",
|
||||
"-adobe-symbol-medium-r-normal--20-140-100-100-p-107-adobe-fontspecific",
|
||||
"-adobe-times-medium-r-normal--20-140-100-100-p-96-iso8859-1",
|
||||
"-b&h-lucida-medium-r-normal-sans-20-140-100-100-p-114-iso8859-1",
|
||||
"-b&h-lucidabright-medium-r-normal--20-140-100-100-p-114-iso8859-1",
|
||||
"-b&h-lucidatypewriter-medium-r-normal-sans-20-140-100-100-m-120-iso8859-1",
|
||||
"-misc-fixed-medium-r-normal--20-140-100-100-c-100-iso8859-1",
|
||||
};
|
||||
|
||||
static String label_names[] =
|
||||
{
|
||||
"Courier",
|
||||
"Helvetica",
|
||||
"New Century Schoolbook",
|
||||
"Symbol",
|
||||
"Times",
|
||||
"Lucida",
|
||||
"Lucidabright",
|
||||
"Lucidatypewriter",
|
||||
"Fixed",
|
||||
};
|
||||
|
||||
#define num_font_names XtNumber(font_names)
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
Widget font_chooser;
|
||||
XmString * xm_string_table;
|
||||
XmFontList * font_list_table;
|
||||
|
||||
XfeAppCreateSimple("FontChooserTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
xm_string_table = XfeGetXmStringTable(label_names,num_font_names);
|
||||
|
||||
font_list_table = XfeGetFontListTable(font_names,num_font_names);
|
||||
|
||||
font_chooser = XtVaCreateManagedWidget("FontChooser",
|
||||
xfeFontChooserWidgetClass,
|
||||
form,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(font_chooser,
|
||||
XmNnumFontItems, num_font_names,
|
||||
XmNfontItemLabels, xm_string_table,
|
||||
XmNfontItemFonts, font_list_table,
|
||||
NULL);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,277 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: FrameShellTest.c */
|
||||
/* Description: Test for XfeFrameShell widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static Widget create_control (String);
|
||||
static Widget create_dummy (String);
|
||||
|
||||
static void first_map_cb (Widget,XtPointer,XtPointer);
|
||||
static void map_cb (Widget,XtPointer,XtPointer);
|
||||
static void unmap_cb (Widget,XtPointer,XtPointer);
|
||||
|
||||
static void track_cb (Widget,XtPointer,XtPointer);
|
||||
static void operation_cb (Widget,XtPointer,XtPointer);
|
||||
|
||||
static void message_output (String);
|
||||
static String message_create (Widget,String);
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec file_items[] =
|
||||
{
|
||||
{ "Open", XfeMENU_PUSH },
|
||||
{ "Save", XfeMENU_PUSH },
|
||||
{ "Sep", XfeMENU_SEP },
|
||||
{ "Exit", XfeMENU_PUSH, XfeExitCallback },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec track_items[] =
|
||||
{
|
||||
{ "Editres", XfeMENU_TOGGLE, track_cb },
|
||||
{ "DeleteWindow", XfeMENU_TOGGLE, track_cb },
|
||||
{ "SaveYourself", XfeMENU_TOGGLE, track_cb },
|
||||
{ "Mapping", XfeMENU_TOGGLE, track_cb },
|
||||
{ "Position", XfeMENU_TOGGLE, track_cb },
|
||||
{ "Size", XfeMENU_TOGGLE, track_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec operations_items[] =
|
||||
{
|
||||
{ "Popup", XfeMENU_PUSH, operation_cb },
|
||||
{ "Popdown", XfeMENU_PUSH, operation_cb },
|
||||
{ "Sep", XfeMENU_SEP },
|
||||
{ "Map", XfeMENU_PUSH, operation_cb },
|
||||
{ "Unmap", XfeMENU_PUSH, operation_cb },
|
||||
{ "Realize", XfeMENU_PUSH, operation_cb },
|
||||
{ "Sep", XfeMENU_SEP },
|
||||
{ "Raise", XfeMENU_PUSH, operation_cb },
|
||||
{ "Lower", XfeMENU_PUSH, operation_cb },
|
||||
{ "Sep", XfeMENU_SEP },
|
||||
{ "Destroy", XfeMENU_PUSH, operation_cb },
|
||||
{ "Create", XfeMENU_PUSH, operation_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuPaneRec pane_items[] =
|
||||
{
|
||||
{ "File", file_items },
|
||||
{ "Track", track_items },
|
||||
{ "Operations", operations_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static Widget _control = NULL;
|
||||
static Widget _dummy = NULL;
|
||||
static Widget _tool_bar = NULL;
|
||||
static Widget _log_list = NULL;
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
XfeAppCreate("FrameShellTest",&argc,argv);
|
||||
|
||||
_control = create_control("Control");
|
||||
|
||||
_dummy = create_dummy("Dummy");
|
||||
|
||||
_tool_bar = XfeDescendantFindByName(_control,"ToolBar",XfeFIND_ANY,False);
|
||||
|
||||
_log_list = XfeDescendantFindByName(_control,"List",XfeFIND_ANY,False);
|
||||
|
||||
/* XtPopup(_dummy,XtGrabNone); */
|
||||
|
||||
XtPopup(_control,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_control(String name)
|
||||
{
|
||||
Widget frame = NULL;
|
||||
Widget form = NULL;
|
||||
Widget tool_bar;
|
||||
Widget list;
|
||||
Arg av[20];
|
||||
Cardinal ac = 0;
|
||||
|
||||
|
||||
XtSetArg(av[ac],XmNtrackEditres,False); ac++;
|
||||
|
||||
frame = XfeFrameCreate(name,av,ac);
|
||||
|
||||
form = XfeDescendantFindByName(frame,"MainForm",XfeFIND_ANY,False);
|
||||
|
||||
tool_bar = XfeToolBarCreate(form,"ToolBar",pane_items,NULL);
|
||||
|
||||
list = XmCreateScrolledList(form,"List",NULL,0);
|
||||
|
||||
XtManageChild(list);
|
||||
|
||||
return frame;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_dummy(String name)
|
||||
{
|
||||
Widget frame = NULL;
|
||||
Widget form = NULL;
|
||||
|
||||
frame = XfeFrameCreate(name,NULL,0);
|
||||
|
||||
form = XfeDescendantFindByName(frame,"MainForm",XfeFIND_ANY,False);
|
||||
|
||||
XtAddCallback(frame,XmNfirstMapCallback,first_map_cb,NULL);
|
||||
XtAddCallback(frame,XmNmapCallback,map_cb,NULL);
|
||||
XtAddCallback(frame,XmNunmapCallback,unmap_cb,NULL);
|
||||
|
||||
return frame;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
first_map_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
message_output(message_create(w,"FirstMap"));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
map_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
message_output(message_create(w,"Map"));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
unmap_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
message_output(message_create(w,"Unmap"));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
track_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
String name = XtName(w);
|
||||
|
||||
if (!XfeIsAlive(_dummy))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(name,"Editres") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_dummy,XmNtrackEditres);
|
||||
}
|
||||
else if (strcmp(name,"DeleteWindow") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_dummy,XmNtrackDeleteWindow);
|
||||
}
|
||||
else if (strcmp(name,"Mapping") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(_dummy,XmNtrackMapping);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
operation_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
String name = XtName(w);
|
||||
|
||||
if (!XfeIsAlive(_dummy))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(name,"Popup") == 0)
|
||||
{
|
||||
XtPopup(_dummy,XtGrabNone);
|
||||
}
|
||||
else if (strcmp(name,"Popdown") == 0)
|
||||
{
|
||||
XtPopdown(_dummy);
|
||||
}
|
||||
else if (strcmp(name,"Map") == 0)
|
||||
{
|
||||
XtMapWidget(_dummy);
|
||||
}
|
||||
else if (strcmp(name,"Unmap") == 0)
|
||||
{
|
||||
XtUnmapWidget(_dummy);
|
||||
}
|
||||
else if (strcmp(name,"Realize") == 0)
|
||||
{
|
||||
XtRealizeWidget(_dummy);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
message_output(String message)
|
||||
{
|
||||
XmString item;
|
||||
|
||||
assert( XfeIsAlive(_log_list) );
|
||||
|
||||
if (!message)
|
||||
{
|
||||
message = "NULL";
|
||||
}
|
||||
|
||||
item = XmStringCreate(message,XmFONTLIST_DEFAULT_TAG);
|
||||
|
||||
XmListAddItem(_log_list,item,0);
|
||||
|
||||
XmStringFree(item);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static String
|
||||
message_create(Widget w,String message)
|
||||
{
|
||||
String name;
|
||||
|
||||
static char buf[4096];
|
||||
static int count = 1;
|
||||
|
||||
if (XfeIsAlive(w))
|
||||
{
|
||||
name = XtName(w);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = "NULL";
|
||||
}
|
||||
|
||||
sprintf(buf,"%3d. %s(%s)",count,message,name);
|
||||
|
||||
count++;
|
||||
|
||||
return buf;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: LabelTest.c */
|
||||
/* Description: Test for XfeLabel widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
Widget label;
|
||||
|
||||
XfeAppCreateSimple("LabelTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
label = XtVaCreateManagedWidget("Label",
|
||||
xfeLabelWidgetClass,
|
||||
form,
|
||||
NULL);
|
||||
|
||||
XtAddCallback(label,XmNselectionChangedCallback,XfeLabelSelectionChangedCallback,NULL);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,243 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: LogoTest.c */
|
||||
/* Description: Test for XfeLogo widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static void animation_callback (Widget,XtPointer,XtPointer);
|
||||
static void init_animations (void);
|
||||
static void set_animation (Cardinal);
|
||||
|
||||
static void logo_activate_callback (Widget,XtPointer,XtPointer);
|
||||
static void start_callback (Widget,XtPointer,XtPointer);
|
||||
static void stop_callback (Widget,XtPointer,XtPointer);
|
||||
static void reset_callback (Widget,XtPointer,XtPointer);
|
||||
static void tick_callback (Widget,XtPointer,XtPointer);
|
||||
|
||||
#define NUM_ANIMATIONS 4
|
||||
#define ANIMATION_INTERVAL 100
|
||||
|
||||
static XfePixmapTable _animation_pixmaps[NUM_ANIMATIONS];
|
||||
static Cardinal _animation_frame_counts[NUM_ANIMATIONS];
|
||||
static Cardinal _current_animation = 0;
|
||||
static String _animation_names[NUM_ANIMATIONS] =
|
||||
{
|
||||
"Transparent Large",
|
||||
"Transparent Small",
|
||||
"Main Large",
|
||||
"Main Small"
|
||||
};
|
||||
|
||||
static Widget _logo = NULL;
|
||||
static Widget _progress_bar = NULL;
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
Widget tool_bar;
|
||||
Widget start;
|
||||
Widget stop;
|
||||
Widget reset;
|
||||
Widget tick;
|
||||
|
||||
XfeAppCreateSimple("LogoTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
_logo = XtVaCreateManagedWidget("Logo",
|
||||
xfeLogoWidgetClass,
|
||||
form,
|
||||
NULL);
|
||||
|
||||
_progress_bar = XtVaCreateManagedWidget("ProgressBar",
|
||||
xfeProgressBarWidgetClass,
|
||||
form,
|
||||
NULL);
|
||||
|
||||
tool_bar = XtVaCreateManagedWidget("ToolBar",
|
||||
xfeToolBarWidgetClass,
|
||||
form,
|
||||
NULL);
|
||||
|
||||
start = XtVaCreateManagedWidget("Start",
|
||||
xfeButtonWidgetClass,
|
||||
tool_bar,
|
||||
NULL);
|
||||
|
||||
stop = XtVaCreateManagedWidget("Stop",
|
||||
xfeButtonWidgetClass,
|
||||
tool_bar,
|
||||
NULL);
|
||||
|
||||
tick = XtVaCreateManagedWidget("Tick",
|
||||
xfeButtonWidgetClass,
|
||||
tool_bar,
|
||||
NULL);
|
||||
|
||||
reset = XtVaCreateManagedWidget("Reset",
|
||||
xfeButtonWidgetClass,
|
||||
tool_bar,
|
||||
NULL);
|
||||
|
||||
|
||||
init_animations();
|
||||
|
||||
XtVaSetValues(_logo,
|
||||
XmNbuttonLayout, XmBUTTON_LABEL_ON_BOTTOM,
|
||||
NULL);
|
||||
|
||||
XtAddCallback(_logo,XmNactivateCallback,logo_activate_callback,NULL);
|
||||
XtAddCallback(_logo,XmNanimationCallback,animation_callback,NULL);
|
||||
|
||||
XtAddCallback(start,XmNactivateCallback,start_callback,NULL);
|
||||
XtAddCallback(stop,XmNactivateCallback,stop_callback,NULL);
|
||||
XtAddCallback(reset,XmNactivateCallback,reset_callback,NULL);
|
||||
XtAddCallback(tick,XmNactivateCallback,tick_callback,NULL);
|
||||
|
||||
set_animation(0);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
set_animation(Cardinal i)
|
||||
{
|
||||
assert( i < NUM_ANIMATIONS );
|
||||
|
||||
assert( _animation_pixmaps != NULL );
|
||||
assert( _animation_pixmaps[i] != NULL );
|
||||
assert( _animation_frame_counts != NULL );
|
||||
|
||||
XtVaSetValues(_logo,
|
||||
XmNanimationPixmaps, _animation_pixmaps[i],
|
||||
XmNnumAnimationPixmaps, _animation_frame_counts[i],
|
||||
NULL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
animation_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
Cardinal i;
|
||||
char buf[1024];
|
||||
|
||||
XtVaGetValues(_logo,XmNcurrentPixmapIndex,&i,NULL);
|
||||
|
||||
sprintf(buf,"%s\n%d",_animation_names[_current_animation],i);
|
||||
|
||||
XfeSetXmStringPSZ(_logo,XmNlabelString,XmFONTLIST_DEFAULT_TAG,buf);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
logo_activate_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
_current_animation++;
|
||||
|
||||
if (_current_animation == NUM_ANIMATIONS)
|
||||
{
|
||||
_current_animation = 0;
|
||||
}
|
||||
|
||||
set_animation(_current_animation);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
start_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeLogoAnimationStart(_logo);
|
||||
|
||||
XfeProgressBarCylonStart(_progress_bar);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
stop_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeLogoAnimationStop(_logo);
|
||||
|
||||
XfeProgressBarCylonStop(_progress_bar);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
reset_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeLogoAnimationReset(_logo);
|
||||
|
||||
XfeProgressBarCylonReset(_progress_bar);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
tick_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeProgressBarCylonTick(_progress_bar);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
init_animations()
|
||||
{
|
||||
XfePixmapTable pixmaps = NULL;
|
||||
Cardinal num_pixmaps = 0;
|
||||
|
||||
/* Transparent 40x40 */
|
||||
pixmaps = NULL;
|
||||
num_pixmaps = 0;
|
||||
|
||||
XfeGetTransparent40x40Animation(_logo,&pixmaps,&num_pixmaps);
|
||||
|
||||
_animation_pixmaps[0] = pixmaps;
|
||||
_animation_frame_counts[0] = num_pixmaps;
|
||||
|
||||
/* Transparent 20x20 */
|
||||
pixmaps = NULL;
|
||||
num_pixmaps = 0;
|
||||
|
||||
XfeGetTransparent20x20Animation(_logo,&pixmaps,&num_pixmaps);
|
||||
|
||||
_animation_pixmaps[1] = pixmaps;
|
||||
_animation_frame_counts[1] = num_pixmaps;
|
||||
|
||||
/* Main 40x40 */
|
||||
pixmaps = NULL;
|
||||
num_pixmaps = 0;
|
||||
|
||||
XfeGetMain40x40Animation(_logo,&pixmaps,&num_pixmaps);
|
||||
|
||||
_animation_pixmaps[2] = pixmaps;
|
||||
_animation_frame_counts[2] = num_pixmaps;
|
||||
|
||||
/* Main 20x20 */
|
||||
pixmaps = NULL;
|
||||
num_pixmaps = 0;
|
||||
|
||||
XfeGetMain20x20Animation(_logo,&pixmaps,&num_pixmaps);
|
||||
|
||||
_animation_pixmaps[3] = pixmaps;
|
||||
_animation_frame_counts[3] = num_pixmaps;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -18,43 +18,56 @@
|
|||
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
DEPTH = ../../../..
|
||||
|
||||
XFE_DEPTH = ../..
|
||||
ifdef XFE_WIDGETS_BUILD_UNUSED
|
||||
|
||||
CSRCS = \
|
||||
ArrowTest.c \
|
||||
ButtonTest.c \
|
||||
CascadeTest.c \
|
||||
ChromeTest.c \
|
||||
ComboBoxTest.c \
|
||||
DashBoardTest.c \
|
||||
FontChooserTest.c \
|
||||
FrameShellTest.c \
|
||||
LabelTest.c \
|
||||
LogoTest.c \
|
||||
MenuTest.c \
|
||||
PaneTestOne.c \
|
||||
PaneTestThree.c \
|
||||
PaneTestTwo.c \
|
||||
PixmapTest.c \
|
||||
ProgressBarTest.c \
|
||||
TaskBarTestOne.c \
|
||||
TaskBarTestTwo.c \
|
||||
ToolBarTest.c \
|
||||
ToolBoxTest.c \
|
||||
ToolScrollTest.c \
|
||||
$(NULL)
|
||||
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_UNUSED
|
||||
|
||||
UNUSED_CSRCS = \
|
||||
ArrowTest.c \
|
||||
ChromeTest.c \
|
||||
ComboBoxTest.c \
|
||||
FontChooserTest.c \
|
||||
FrameShellTest.c \
|
||||
$(NULL)
|
||||
|
||||
|
||||
endif
|
||||
|
||||
CSRCS = \
|
||||
$(UNUSED_CSRCS) \
|
||||
ButtonTest.c \
|
||||
CascadeTest.c \
|
||||
DashBoardTest.c \
|
||||
LabelTest.c \
|
||||
LogoTest.c \
|
||||
MenuTest.c \
|
||||
PaneTestOne.c \
|
||||
PaneTestThree.c \
|
||||
PaneTestTwo.c \
|
||||
PixmapTest.c \
|
||||
ProgressBarTest.c \
|
||||
TaskBarTestOne.c \
|
||||
TaskBarTestTwo.c \
|
||||
ToolBarTest.c \
|
||||
ToolBoxTest.c \
|
||||
ToolScrollTest.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = \
|
||||
XfeTest \
|
||||
XfeWidgets
|
||||
|
||||
PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.exe))
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
DEFINES += $(XFE_EXTRA_DEFINES)
|
||||
|
||||
all:: $(PROGS)
|
||||
install:: $(PROGS)
|
||||
|
||||
INCLUDES += -I.. -I../icons
|
||||
|
||||
LDFLAGS =
|
||||
|
||||
ifeq ($(OS_ARCH),HP-UX)
|
||||
|
@ -73,8 +86,6 @@ SHARED_XFE_LIBS = \
|
|||
|
||||
ifeq (,$(filter Linux IRIX ,$(OS_ARCH)))
|
||||
|
||||
#ifneq ($(OS_ARCH),Linux)
|
||||
|
||||
SHARED_XFE_LIBS += $(DIST)/bin/libXpm.$(SHARED_EXT)
|
||||
STATIC_XFE_LIBS += $(DIST)/lib/libXpm.a
|
||||
|
||||
|
@ -100,7 +111,9 @@ else
|
|||
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
-include $(DEPTH)/config/motif.mk
|
||||
endif
|
||||
|
||||
XM_LD_FLAGS = -lXm $(NS_MOTIF2_XP_LD_FLAGS)
|
||||
|
||||
|
|
|
@ -1,411 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: MenuTest.c */
|
||||
/* Description: Test for XfeBmButton and XfeBmCascade widgets. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
#include <Xm/RowColumnP.h>
|
||||
|
||||
|
||||
static Widget create_pulldown (Widget,String);
|
||||
static Widget create_sep (Widget,String);
|
||||
static Widget create_bm_pulldown (Widget,String);
|
||||
static Widget create_item (Widget,String);
|
||||
static Widget create_cascade_alone_one (Widget parent,String name);
|
||||
static Widget create_cascade_alone_two (Widget parent,String name);
|
||||
static void activate_callback (Widget,XtPointer,XtPointer);
|
||||
static Widget get_sub_menu_id (Widget);
|
||||
|
||||
static void post_callback (Widget,XtPointer,XtPointer);
|
||||
static void event_loop (void);
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
Widget menu;
|
||||
Widget pane1;
|
||||
Widget pane2;
|
||||
Widget pane3;
|
||||
|
||||
XfeAppCreateSimple("MenuTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
menu = XmCreateMenuBar(form,"Menu",NULL,0);
|
||||
|
||||
pane1 = create_bm_pulldown(menu,"File");
|
||||
|
||||
#if 1
|
||||
pane2 = create_bm_pulldown(menu,"Options");
|
||||
#else
|
||||
pane2 = create_pulldown(menu,"Options");
|
||||
#endif
|
||||
|
||||
create_item(pane1,"Open");
|
||||
create_item(pane1,"Close");
|
||||
create_item(pane1,"Save");
|
||||
create_sep(pane1,"Sep2");
|
||||
create_item(pane1,"SaveAs");
|
||||
create_item(pane1,"Exit");
|
||||
|
||||
create_item(pane2,"Browser");
|
||||
create_item(pane2,"Mail");
|
||||
create_item(pane2,"News");
|
||||
create_item(pane2,"Editor");
|
||||
|
||||
pane3 = create_bm_pulldown(pane2,"More");
|
||||
|
||||
create_item(pane3,"Browser");
|
||||
create_item(pane3,"Mail");
|
||||
create_item(pane3,"News");
|
||||
create_item(pane3,"Editor");
|
||||
|
||||
create_cascade_alone_one(form,"CascadeAlone1");
|
||||
|
||||
create_cascade_alone_two(form,"CascadeAlone2");
|
||||
|
||||
XtManageChild(menu);
|
||||
|
||||
{
|
||||
Widget pb = XmCreatePushButton(form,"Caca",NULL,0);
|
||||
|
||||
XtManageChild(pb);
|
||||
}
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_pulldown(Widget parent,String name)
|
||||
{
|
||||
Widget cascade;
|
||||
Widget pane;
|
||||
|
||||
pane = XmCreatePulldownMenu(parent,"_Pane",NULL,0);
|
||||
|
||||
cascade = XtVaCreateManagedWidget(name,
|
||||
xmCascadeButtonWidgetClass,
|
||||
parent,
|
||||
XmNsubMenuId, pane,
|
||||
NULL);
|
||||
|
||||
|
||||
/* XtVaSetValues(pane,XmNtearOffModel,XmTEAR_OFF_ENABLED,NULL); */
|
||||
|
||||
return pane;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_bm_pulldown(Widget parent,String name)
|
||||
{
|
||||
Widget cascade;
|
||||
Widget pane;
|
||||
|
||||
static Pixmap arm_pixmap = XmUNSPECIFIED_PIXMAP;
|
||||
static Pixmap pixmap = XmUNSPECIFIED_PIXMAP;
|
||||
|
||||
|
||||
pane = XmCreatePulldownMenu(parent,"_Pane",NULL,0);
|
||||
|
||||
cascade =
|
||||
XtVaCreateManagedWidget(name,
|
||||
xfeBmCascadeWidgetClass,
|
||||
parent,
|
||||
XmNbuttonLayout, XmBUTTON_LABEL_ON_RIGHT,
|
||||
XmNsubMenuId, pane,
|
||||
NULL);
|
||||
|
||||
XtAddCallback(cascade,XmNactivateCallback,activate_callback,NULL);
|
||||
|
||||
/* XtVaSetValues(pane,XmNtearOffModel,XmTEAR_OFF_ENABLED,NULL); */
|
||||
|
||||
if (!XfePixmapGood(pixmap))
|
||||
{
|
||||
pixmap = XfeGetPixmap(cascade,"task_small_browser");
|
||||
}
|
||||
|
||||
if (!XfePixmapGood(arm_pixmap))
|
||||
{
|
||||
Pixel arm_color;
|
||||
|
||||
XtVaGetValues(cascade,XmNarmColor,&arm_color,NULL);
|
||||
|
||||
arm_pixmap = XfeGetPixmap(cascade,"task_small_browser_armed");
|
||||
}
|
||||
|
||||
if (XfePixmapGood(pixmap))
|
||||
{
|
||||
XtVaSetValues(cascade,XmNlabelPixmap,pixmap,NULL);
|
||||
}
|
||||
|
||||
if (XfePixmapGood(arm_pixmap))
|
||||
{
|
||||
XtVaSetValues(cascade,XmNarmPixmap,arm_pixmap,NULL);
|
||||
}
|
||||
|
||||
|
||||
return pane;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_item(Widget parent,String name)
|
||||
{
|
||||
Widget item;
|
||||
|
||||
static Pixmap arm_pixmap = XmUNSPECIFIED_PIXMAP;
|
||||
static Pixmap pixmap = XmUNSPECIFIED_PIXMAP;
|
||||
|
||||
item = XtVaCreateManagedWidget(name,
|
||||
#if 1
|
||||
xfeBmButtonWidgetClass,
|
||||
#else
|
||||
xmPushButtonWidgetClass,
|
||||
#endif
|
||||
parent,
|
||||
NULL);
|
||||
|
||||
if (!XfePixmapGood(pixmap))
|
||||
{
|
||||
pixmap = XfeGetPixmap(parent,"task_small_browser");
|
||||
}
|
||||
|
||||
if (!XfePixmapGood(arm_pixmap))
|
||||
{
|
||||
Pixel arm_color;
|
||||
|
||||
XtVaGetValues(item,XmNarmColor,&arm_color,NULL);
|
||||
|
||||
arm_pixmap = XfeGetPixmap(parent,"task_small_browser");
|
||||
}
|
||||
|
||||
if (XfePixmapGood(pixmap))
|
||||
{
|
||||
XtVaSetValues(item,XmNlabelPixmap,pixmap,NULL);
|
||||
}
|
||||
|
||||
if (XfePixmapGood(arm_pixmap))
|
||||
{
|
||||
XtVaSetValues(item,XmNarmPixmap,arm_pixmap,NULL);
|
||||
}
|
||||
|
||||
XtAddCallback(item,XmNactivateCallback,activate_callback,NULL);
|
||||
|
||||
XtManageChild(item);
|
||||
|
||||
return item;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_sep(Widget parent,String name)
|
||||
{
|
||||
Widget item;
|
||||
|
||||
item = XtVaCreateManagedWidget(name,
|
||||
xmSeparatorWidgetClass,
|
||||
parent,
|
||||
NULL);
|
||||
|
||||
XtManageChild(item);
|
||||
|
||||
return item;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
activate_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
unsigned char accent_type;
|
||||
|
||||
XtVaGetValues(w,XmNaccentType,&accent_type,NULL);
|
||||
|
||||
switch(accent_type)
|
||||
{
|
||||
case XmACCENT_TOP:
|
||||
printf("Activate(%s) ACCENT_TOP\n",XtName(w));
|
||||
break;
|
||||
|
||||
case XmACCENT_BOTTOM:
|
||||
printf("Activate(%s) ACCENT_BOTTOM\n",XtName(w));
|
||||
break;
|
||||
|
||||
case XmACCENT_NONE:
|
||||
printf("Activate(%s) ACCENT_NONE\n",XtName(w));
|
||||
break;
|
||||
|
||||
case XmACCENT_ALL:
|
||||
printf("Activate(%s) ACCENT_ALL\n",XtName(w));
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_cascade_alone_one(Widget parent,String name)
|
||||
{
|
||||
Widget cascade;
|
||||
Widget sub_menu_id;
|
||||
Widget pane;
|
||||
Widget pane2;
|
||||
Widget pane3;
|
||||
|
||||
cascade =
|
||||
XtVaCreateManagedWidget(name,
|
||||
xfeCascadeWidgetClass,
|
||||
parent,
|
||||
XmNbuttonLayout, XmBUTTON_LABEL_ON_BOTTOM,
|
||||
XmNbuttonType, XmBUTTON_PUSH,
|
||||
XmNmappingDelay, 0,
|
||||
NULL);
|
||||
|
||||
sub_menu_id = get_sub_menu_id(cascade);
|
||||
|
||||
assert( XfeIsAlive(sub_menu_id) );
|
||||
|
||||
/* Turn accent drawing on */
|
||||
XfeBmAccentSetFileMode(XmACCENT_FILE_ANYWHERE);
|
||||
XfeBmAccentEnable();
|
||||
|
||||
XtVaSetValues(sub_menu_id,XmNtearOffModel,XmTEAR_OFF_ENABLED,NULL);
|
||||
|
||||
#if 1
|
||||
/* XtVaSetValues(cascade,XmNpixmap,_bm_pixmap,NULL);*/
|
||||
XtVaSetValues(cascade,XmNbuttonLayout,XmBUTTON_LABEL_ON_BOTTOM,NULL);
|
||||
#endif
|
||||
|
||||
create_item(sub_menu_id,"Open");
|
||||
create_item(sub_menu_id,"Close");
|
||||
pane = create_bm_pulldown(sub_menu_id,"More");
|
||||
create_item(sub_menu_id,"Save");
|
||||
create_item(sub_menu_id,"SaveAs");
|
||||
create_item(sub_menu_id,"Exit");
|
||||
|
||||
/*pane = create_pulldown(sub_menu_id,"More");*/
|
||||
|
||||
pane2 = create_bm_pulldown(pane,"More 2");
|
||||
|
||||
create_item(pane,"Browser");
|
||||
create_item(pane,"Mail");
|
||||
create_item(pane,"News");
|
||||
create_item(pane,"Editor");
|
||||
|
||||
pane3 = create_bm_pulldown(pane2,"More 3");
|
||||
|
||||
create_item(pane2,"Browser");
|
||||
create_item(pane2,"Mail");
|
||||
create_item(pane2,"News");
|
||||
create_item(pane2,"Editor");
|
||||
|
||||
create_item(pane3,"Browser");
|
||||
create_item(pane3,"Mail");
|
||||
create_item(pane3,"News");
|
||||
create_item(pane3,"Editor");
|
||||
|
||||
XtAddCallback(cascade,XmNactivateCallback,post_callback,NULL);
|
||||
|
||||
return cascade;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_cascade_alone_two(Widget parent,String name)
|
||||
{
|
||||
Widget cascade;
|
||||
Widget sub_menu_id;
|
||||
Widget pane;
|
||||
|
||||
cascade =
|
||||
XtVaCreateManagedWidget(name,
|
||||
xfeCascadeWidgetClass,
|
||||
parent,
|
||||
/* XmNpixmap, _bm_pixmap,*/
|
||||
XmNbuttonLayout, XmBUTTON_LABEL_ON_BOTTOM,
|
||||
XmNbuttonType, XmBUTTON_PUSH,
|
||||
NULL);
|
||||
|
||||
sub_menu_id = get_sub_menu_id(cascade);
|
||||
|
||||
/* XtVaSetValues(sub_menu_id,XmNtearOffModel,XmTEAR_OFF_ENABLED,NULL); */
|
||||
|
||||
create_item(sub_menu_id,"Open");
|
||||
create_item(sub_menu_id,"Close");
|
||||
create_item(sub_menu_id,"Save");
|
||||
create_item(sub_menu_id,"SaveAs");
|
||||
create_item(sub_menu_id,"Exit");
|
||||
|
||||
pane = create_bm_pulldown(sub_menu_id,"More");
|
||||
/*pane = create_pulldown(sub_menu_id,"More");*/
|
||||
|
||||
#if 0
|
||||
create_item(pane,"Browser");
|
||||
create_item(pane,"Mail");
|
||||
create_item(pane,"News");
|
||||
create_item(pane,"Editor");
|
||||
#endif
|
||||
|
||||
|
||||
return cascade;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
get_sub_menu_id(Widget w)
|
||||
{
|
||||
Widget sub_menu_id;
|
||||
|
||||
XtVaGetValues(w,XmNsubMenuId,&sub_menu_id,NULL);
|
||||
|
||||
return sub_menu_id;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
post_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeSleep(w,event_loop,2000);
|
||||
|
||||
XfeBmAccentEnable();
|
||||
|
||||
XfeCascadeArmAndPost(w,NULL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
event_loop(void)
|
||||
{
|
||||
XtAppContext app = XfeAppContext();
|
||||
XEvent event;
|
||||
|
||||
/* XtAppLock(app); */
|
||||
|
||||
while(1)
|
||||
{
|
||||
XtAppNextEvent(app,&event);
|
||||
|
||||
XtDispatchEvent(&event);
|
||||
}
|
||||
|
||||
/* XtAppUnlock(app); */
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,101 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: PaneTestOne.c */
|
||||
/* Description: Test for XfePane widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget frame;
|
||||
Widget main_form;
|
||||
Widget main_pane;
|
||||
|
||||
Widget e_pane;
|
||||
Widget w_pane;
|
||||
|
||||
Widget ne_pane;
|
||||
Widget nw_pane;
|
||||
Widget se_pane;
|
||||
Widget sw_pane;
|
||||
|
||||
XfeAppCreateSimple("PaneTestOne",&argc,argv,"Frame",&frame,&main_form);
|
||||
|
||||
main_pane = XtVaCreateManagedWidget("MainPane",
|
||||
xfePaneWidgetClass,
|
||||
main_form,
|
||||
NULL);
|
||||
|
||||
e_pane = XtVaCreateManagedWidget("EPane",
|
||||
xfePaneWidgetClass,
|
||||
main_pane,
|
||||
NULL);
|
||||
|
||||
w_pane = XtVaCreateManagedWidget("WPane",
|
||||
xfePaneWidgetClass,
|
||||
main_pane,
|
||||
NULL);
|
||||
|
||||
ne_pane = XtVaCreateManagedWidget("NEPane",
|
||||
xfePaneWidgetClass,
|
||||
e_pane,
|
||||
NULL);
|
||||
|
||||
se_pane = XtVaCreateManagedWidget("NEPane",
|
||||
xfePaneWidgetClass,
|
||||
e_pane,
|
||||
NULL);
|
||||
|
||||
nw_pane = XtVaCreateManagedWidget("NWPane",
|
||||
xfePaneWidgetClass,
|
||||
w_pane,
|
||||
NULL);
|
||||
|
||||
sw_pane = XtVaCreateManagedWidget("SWPane",
|
||||
xfePaneWidgetClass,
|
||||
w_pane,
|
||||
NULL);
|
||||
|
||||
XfeCreateFormAndButton(se_pane,"Form","SE1",5,True,NULL,0);
|
||||
XfeCreateFormAndButton(se_pane,"Form","SE2",5,True,NULL,0);
|
||||
|
||||
XfeCreateFormAndButton(sw_pane,"Form","SW1",5,True,NULL,0);
|
||||
XfeCreateFormAndButton(sw_pane,"Form","SW2",5,True,NULL,0);
|
||||
|
||||
XfeCreateFormAndButton(ne_pane,"Form","NE1",5,True,NULL,0);
|
||||
XfeCreateFormAndButton(ne_pane,"Form","NE2",5,True,NULL,0);
|
||||
|
||||
XfeCreateFormAndButton(nw_pane,"Form","NW1",5,True,NULL,0);
|
||||
XfeCreateFormAndButton(nw_pane,"Form","NW2",5,True,NULL,0);
|
||||
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,790 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: PaneTestThree.c */
|
||||
/* Description: Test for XfePane widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static Widget pane_create (Widget,String);
|
||||
static void pane_add_buttons (Widget,Widget,Widget);
|
||||
static void pane_add_title (Widget);
|
||||
static void pane_add_forms (Widget,Widget *,Widget *);
|
||||
static void menu_item_cb (Widget,XtPointer,XtPointer);
|
||||
static void toggle_managed_cb (Widget,XtPointer,XtPointer);
|
||||
|
||||
static Widget create_simple_pane_frame (String);
|
||||
static Widget create_form_and_button (Widget,unsigned char,
|
||||
unsigned char,Widget,String,
|
||||
String,Dimension);
|
||||
|
||||
static Widget mail_create_pane (Widget,String);
|
||||
static Widget mail_create_frame (String);
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec file_items[] =
|
||||
{
|
||||
{ "Open", XfeMENU_PUSH },
|
||||
{ "Save", XfeMENU_PUSH },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Exit", XfeMENU_PUSH, XfeExitCallback },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec orientation_items[] =
|
||||
{
|
||||
{ "OrientationVertical", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "OrientationHorizontal", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec pane_sash_type_items[] =
|
||||
{
|
||||
{ "pane_sash_double_line", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "pane_sash_filled_rectangle", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "pane_sash_live", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "pane_sash_rectangle", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "pane_sash_single_line", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec button_boolean_items[] =
|
||||
{
|
||||
{ "TraversalOn", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Sensitive", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "UsePreferredWidth", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "UsePreferredHeight", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec misc_items[] =
|
||||
{
|
||||
{ "Orientation", XfeMENU_PANE, NULL, orientation_items },
|
||||
{ "PaneSashType", XfeMENU_PANE, NULL, pane_sash_type_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec dimension_items[] =
|
||||
{
|
||||
{ "0", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "1", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "2", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "3", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "4", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "5", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "6", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "7", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "8", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "9", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "10", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "20", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "30", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "40", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "50", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "100", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "200", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "300", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "400", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "500", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "1000", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec margin_items[] =
|
||||
{
|
||||
{ "MarginLeft", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "MarginRight", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "MarginTop", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "MarginBottom", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "MarginAll" , XfeMENU_PANE, NULL, dimension_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec managing_items[] =
|
||||
{
|
||||
{ "One" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "OneTop" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "OneBottom" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "OneLeft" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "OneRight" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Two" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "TwoTop" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "TwoBottom" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "TwoLeft" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "TwoRight" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec dimensions_items[] =
|
||||
{
|
||||
{ "Width", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "Height", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "HighlightThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "ShadowThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "SashOffset", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "SashShadowThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "SashSpacing", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "SashThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Margins", XfeMENU_PANE, NULL, margin_items },
|
||||
{ "RaiseBorderThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "ArmOffset", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "SashPosition", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuPaneRec pane_items[] =
|
||||
{
|
||||
{ "File", file_items },
|
||||
{ "Managing", managing_items },
|
||||
{ "Dimensions", dimensions_items },
|
||||
{ "BooleanItems", button_boolean_items },
|
||||
{ "MiscItems", misc_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget mail_frame;
|
||||
|
||||
XfeAppCreate("PaneTestThree",&argc,argv);
|
||||
|
||||
mail_frame = mail_create_frame("MailShell");
|
||||
|
||||
XtPopup(mail_frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
pane_create(Widget parent,String name)
|
||||
{
|
||||
Widget pane;
|
||||
|
||||
pane = XtVaCreateManagedWidget(name,
|
||||
xfePaneWidgetClass,
|
||||
parent,
|
||||
NULL);
|
||||
return pane;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
pane_add_forms(Widget pane,
|
||||
Widget * form_one_out,
|
||||
Widget * form_two_out)
|
||||
{
|
||||
Widget form_one = NULL;
|
||||
Widget form_two = NULL;
|
||||
unsigned char orientation;
|
||||
String form_one_name;
|
||||
String form_two_name;
|
||||
|
||||
assert( XfeIsAlive(pane) );
|
||||
|
||||
XtVaGetValues(pane,XmNorientation,&orientation,NULL);
|
||||
|
||||
if (orientation == XmVERTICAL)
|
||||
{
|
||||
form_one_name = "TopForm";
|
||||
form_two_name = "BottomForm";
|
||||
}
|
||||
else
|
||||
{
|
||||
form_one_name = "LeftForm";
|
||||
form_two_name = "RightForm";
|
||||
}
|
||||
|
||||
form_one = XtVaCreateManagedWidget(form_one_name,
|
||||
xmFormWidgetClass,
|
||||
pane,
|
||||
NULL);
|
||||
|
||||
form_two = XtVaCreateManagedWidget(form_two_name,
|
||||
xmFormWidgetClass,
|
||||
pane,
|
||||
NULL);
|
||||
|
||||
*form_one_out = form_one;
|
||||
*form_two_out = form_two;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
pane_add_buttons(Widget pane,
|
||||
Widget form_one,
|
||||
Widget form_two)
|
||||
{
|
||||
Widget button_one;
|
||||
Widget button_two;
|
||||
unsigned char orientation;
|
||||
String button_one_name;
|
||||
String button_two_name;
|
||||
|
||||
assert( XfeIsAlive(pane) );
|
||||
assert( XfeIsAlive(form_one) );
|
||||
assert( XfeIsAlive(form_two) );
|
||||
|
||||
XtVaGetValues(pane,XmNorientation,&orientation,NULL);
|
||||
|
||||
if (orientation == XmVERTICAL)
|
||||
{
|
||||
button_one_name = "TopButton";
|
||||
button_two_name = "BottomButton";
|
||||
}
|
||||
else
|
||||
{
|
||||
button_one_name = "LeftButton";
|
||||
button_two_name = "RightButton";
|
||||
}
|
||||
|
||||
button_one = XtVaCreateManagedWidget(button_one_name,
|
||||
xmPushButtonWidgetClass,
|
||||
form_one,
|
||||
NULL);
|
||||
|
||||
button_two = XtVaCreateManagedWidget(button_two_name,
|
||||
xmPushButtonWidgetClass,
|
||||
form_two,
|
||||
NULL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
pane_add_title(Widget pane)
|
||||
{
|
||||
Widget sash_form;
|
||||
Widget arrow;
|
||||
Widget label;
|
||||
unsigned char orientation;
|
||||
String arrow_name;
|
||||
String label_name;
|
||||
|
||||
assert( XfeIsAlive(pane) );
|
||||
|
||||
XtVaGetValues(pane,XmNorientation,&orientation,NULL);
|
||||
|
||||
if (orientation == XmVERTICAL)
|
||||
{
|
||||
arrow_name = "VerticalArrow";
|
||||
label_name = "VerticalLabel";
|
||||
}
|
||||
else
|
||||
{
|
||||
arrow_name = "HorizontalArrow";
|
||||
label_name = "HorizontalLabel";
|
||||
}
|
||||
|
||||
/* XtVaGetValues(pane,XmNsashForm,&sash_form,NULL); */
|
||||
|
||||
assert( XfeIsAlive(sash_form) );
|
||||
|
||||
if (orientation == XmVERTICAL)
|
||||
{
|
||||
arrow = XtVaCreateManagedWidget(arrow_name,
|
||||
xmArrowButtonWidgetClass,
|
||||
sash_form,
|
||||
NULL);
|
||||
}
|
||||
|
||||
label = XtVaCreateManagedWidget(label_name,
|
||||
xmLabelWidgetClass,
|
||||
sash_form,
|
||||
XmNleftWidget, arrow,
|
||||
NULL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_simple_pane_frame(String frame_name)
|
||||
{
|
||||
Widget frame;
|
||||
Widget form;
|
||||
Widget menu;
|
||||
|
||||
Widget pane;
|
||||
|
||||
Widget one;
|
||||
Widget two;
|
||||
|
||||
frame = XfeFrameCreate(frame_name,NULL,0);
|
||||
|
||||
form = XfeDescendantFindByName(frame,"MainForm",XfeFIND_ANY,False);
|
||||
|
||||
pane = XtVaCreateManagedWidget("Pane",xfePaneWidgetClass,form,NULL);
|
||||
|
||||
menu = XfeMenuBarCreate(form,"MenuBar",pane_items,(XtPointer) pane,NULL,0);
|
||||
|
||||
one = XtVaCreateManagedWidget("One",xmFormWidgetClass,pane,NULL);
|
||||
|
||||
two = XtVaCreateManagedWidget("Two",xmFormWidgetClass,pane,NULL);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_ONE,
|
||||
XmPANE_CHILD_ATTACH_TOP,
|
||||
one,"OneTop","Top",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_ONE,
|
||||
XmPANE_CHILD_ATTACH_BOTTOM,
|
||||
one,"OneBottom","Bottom",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_ONE,
|
||||
XmPANE_CHILD_ATTACH_LEFT,
|
||||
one,"OneLeft","Left",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_ONE,
|
||||
XmPANE_CHILD_ATTACH_RIGHT,
|
||||
one,"OneRight","Right",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_TWO,
|
||||
XmPANE_CHILD_ATTACH_TOP,
|
||||
two,"TwoTop","Top",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_TWO,
|
||||
XmPANE_CHILD_ATTACH_BOTTOM,
|
||||
two,"TwoBottom","Bottom",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_TWO,
|
||||
XmPANE_CHILD_ATTACH_LEFT,
|
||||
two,"TwoLeft","Left",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_TWO,
|
||||
XmPANE_CHILD_ATTACH_RIGHT,
|
||||
two,"TwoRight","Right",2);
|
||||
return frame;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
menu_item_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
Widget pane = (Widget) client_data;
|
||||
String name = XtName(w);
|
||||
String parent_name = XtName(XtParent(w));
|
||||
Arg av[20];
|
||||
Cardinal ac = 0;
|
||||
|
||||
printf("menu_item_cb(%s,%s) pane = %s\n",name,parent_name,XtName(pane));
|
||||
|
||||
if (!XfeIsAlive(pane))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(name,"TraversalOn") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(pane,XmNtraversalOn);
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_double_line") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_DOUBLE_LINE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_live") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_LIVE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_rectangle") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_RECTANGLE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_filled_rectangle") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_FILLED_RECTANGLE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_single_line") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_SINGLE_LINE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"Sensitive") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(pane,XmNsensitive);
|
||||
}
|
||||
else if (strcmp(name,"UsePreferredWidth") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(pane,XmNusePreferredWidth);
|
||||
}
|
||||
else if (strcmp(name,"UsePreferredHeight") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(pane,XmNusePreferredHeight);
|
||||
}
|
||||
else if (strcmp(name,"ShadowIn") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_IN); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowOut") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_OUT); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowEtchedIn") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_ETCHED_IN); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowEtchedOut") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_ETCHED_OUT); ac++;
|
||||
}
|
||||
else if (strcmp(name,"AlignmentBeginning") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNlabelAlignment,XmALIGNMENT_BEGINNING); ac++;
|
||||
}
|
||||
else if (strcmp(name,"AlignmentCenter") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNlabelAlignment,XmALIGNMENT_CENTER); ac++;
|
||||
}
|
||||
else if (strcmp(name,"AlignmentEnd") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNlabelAlignment,XmALIGNMENT_END); ac++;
|
||||
}
|
||||
|
||||
if (strcmp(parent_name,"MarginLeft") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginLeft,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginRight") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginRight,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginTop") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginTop,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginBottom") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginBottom,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginAll") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginLeft,atoi(name)); ac++;
|
||||
XtSetArg(av[ac],XmNmarginRight,atoi(name)); ac++;
|
||||
XtSetArg(av[ac],XmNmarginTop,atoi(name)); ac++;
|
||||
XtSetArg(av[ac],XmNmarginBottom,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"Width") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNwidth,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"Height") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNheight,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"ShadowThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"SashOffset") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashOffset,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"SashSpacing") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashSpacing,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"SashThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"SashShadowThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashShadowThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"HighlightThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNhighlightThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"RaiseBorderThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNraiseBorderThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"ArmOffset") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNarmOffset,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(name,"OrientationVertical") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNorientation,XmVERTICAL); ac++;
|
||||
}
|
||||
else if (strcmp(name,"OrientationHorizontal") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNorientation,XmHORIZONTAL); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"Managing") == 0)
|
||||
{
|
||||
Widget child = XfeDescendantFindByName(pane,name,XfeFIND_ANY,False);
|
||||
|
||||
if (XfeIsAlive(child))
|
||||
{
|
||||
XfeToggleManagedState(child);
|
||||
}
|
||||
}
|
||||
else if (strcmp(parent_name,"SashPosition") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashPosition,atoi(name)); ac++;
|
||||
}
|
||||
|
||||
if (ac)
|
||||
{
|
||||
XtSetValues(pane,av,ac);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
toggle_managed_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
Widget pane = (Widget) client_data;
|
||||
|
||||
if (XfeIsAlive(pane))
|
||||
{
|
||||
XfeToggleManagedState(pane);
|
||||
|
||||
if (XfeIsArrow(w))
|
||||
{
|
||||
unsigned char arrow_direction;
|
||||
|
||||
XtVaGetValues(w,XmNarrowDirection,&arrow_direction,NULL);
|
||||
|
||||
if (arrow_direction == XmARROW_DOWN)
|
||||
{
|
||||
arrow_direction = XmARROW_UP;
|
||||
}
|
||||
else if (arrow_direction == XmARROW_UP)
|
||||
{
|
||||
arrow_direction = XmARROW_DOWN;
|
||||
}
|
||||
else if (arrow_direction == XmARROW_RIGHT)
|
||||
{
|
||||
arrow_direction = XmARROW_LEFT;
|
||||
}
|
||||
else if (arrow_direction == XmARROW_LEFT)
|
||||
{
|
||||
arrow_direction = XmARROW_RIGHT;
|
||||
}
|
||||
|
||||
XtVaSetValues(w,XmNarrowDirection,arrow_direction,NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_form_and_button(Widget pw,
|
||||
unsigned char child_type,
|
||||
unsigned char child_attachment,
|
||||
Widget target,
|
||||
String form_name,
|
||||
String button_name,
|
||||
Dimension offset)
|
||||
{
|
||||
Widget form = NULL;
|
||||
Widget button = NULL;
|
||||
Arg av[20];
|
||||
Cardinal ac = 0;
|
||||
|
||||
XtSetArg(av[ac],XmNpaneChildType, child_type); ac++;
|
||||
XtSetArg(av[ac],XmNpaneChildAttachment, child_attachment); ac++;
|
||||
XtSetArg(av[ac],XmNalwaysVisible, True); ac++;
|
||||
|
||||
#if 1
|
||||
|
||||
form = XfeCreateFormAndButton(pw,form_name,button_name,offset,True,av,ac);
|
||||
|
||||
button = XfeDescendantFindByName(form,button_name,XfeFIND_ANY,False);
|
||||
|
||||
assert( XfeIsAlive(button) );
|
||||
|
||||
XtAddCallback(button,XmNactivateCallback,toggle_managed_cb,target);
|
||||
|
||||
#else
|
||||
|
||||
XtSetArg(av[ac],XmNwidth, 20); ac++;
|
||||
XtSetArg(av[ac],XmNheight, 20); ac++;
|
||||
|
||||
form = XtCreateManagedWidget(form_name,xmFormWidgetClass,pw,av,ac);
|
||||
|
||||
#endif
|
||||
|
||||
return form;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static Widget
|
||||
mail_create_pane(Widget pw,String name)
|
||||
{
|
||||
Widget mail_pane;
|
||||
Widget message_pane;
|
||||
Widget thread_form;
|
||||
Widget message_form;
|
||||
Widget folders_form;
|
||||
Widget main_tab;
|
||||
|
||||
Widget attachments_pane;
|
||||
Widget attachments_tool_bar;
|
||||
Widget attachments_form;
|
||||
Widget attachments_sw;
|
||||
|
||||
Arg av[20];
|
||||
Cardinal ac = 0;
|
||||
|
||||
Widget message_collapse_form;
|
||||
Widget message_collapse_arrow;
|
||||
Widget message_collapse_label;
|
||||
Widget folders_collapse_form;
|
||||
Widget folders_collapse_arrow;
|
||||
Widget folders_collapse_label;
|
||||
|
||||
/* Main mail pane */
|
||||
mail_pane = XtVaCreateManagedWidget(name,
|
||||
xfePaneWidgetClass,
|
||||
pw,
|
||||
NULL);
|
||||
|
||||
folders_form = XtVaCreateManagedWidget("FoldersForm",
|
||||
xmFormWidgetClass,
|
||||
mail_pane,
|
||||
NULL);
|
||||
|
||||
/* Message pane */
|
||||
message_pane = XtVaCreateManagedWidget("MessagePane",
|
||||
xfePaneWidgetClass,
|
||||
mail_pane,
|
||||
NULL);
|
||||
|
||||
thread_form = XtVaCreateManagedWidget("ThreadForm",
|
||||
xmFormWidgetClass,
|
||||
message_pane,
|
||||
NULL);
|
||||
|
||||
/* Attachments pane */
|
||||
attachments_pane = XtVaCreateManagedWidget("AttachmentsPane",
|
||||
xfePaneWidgetClass,
|
||||
message_pane,
|
||||
NULL);
|
||||
|
||||
|
||||
message_form = XtVaCreateManagedWidget("MessageForm",
|
||||
xmFormWidgetClass,
|
||||
attachments_pane,
|
||||
NULL);
|
||||
|
||||
message_collapse_form = XtVaCreateManagedWidget("MessageCollapseForm",
|
||||
xmFormWidgetClass,
|
||||
message_pane,
|
||||
NULL);
|
||||
|
||||
message_collapse_arrow = XtCreateManagedWidget("MessageCollapseArrow",
|
||||
xfeArrowWidgetClass,
|
||||
message_collapse_form,
|
||||
NULL,0);
|
||||
|
||||
message_collapse_label = XtCreateManagedWidget("MessageCollapseLabel",
|
||||
xmLabelWidgetClass,
|
||||
message_collapse_form,
|
||||
NULL,0);
|
||||
|
||||
/* Toggle the vertical attachments pane */
|
||||
XtAddCallback(message_collapse_arrow,
|
||||
XmNactivateCallback,
|
||||
toggle_managed_cb,
|
||||
attachments_pane);
|
||||
|
||||
/* Attachments form */
|
||||
attachments_form = XtVaCreateManagedWidget("AttachmentsForm",
|
||||
xmFormWidgetClass,
|
||||
attachments_pane,
|
||||
NULL);
|
||||
|
||||
attachments_sw = XtVaCreateManagedWidget("AttachmentsSW",
|
||||
xmScrolledWindowWidgetClass,
|
||||
attachments_form,
|
||||
NULL);
|
||||
|
||||
attachments_tool_bar = XfeCreateLoadedToolBar(attachments_sw,
|
||||
"AttachmentsToolBar",
|
||||
"Attach",
|
||||
14,
|
||||
4,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* Folders collapse form */
|
||||
folders_collapse_form = XtVaCreateManagedWidget("FoldersCollapseForm",
|
||||
xmFormWidgetClass,
|
||||
mail_pane,
|
||||
NULL);
|
||||
|
||||
folders_collapse_arrow = XtCreateManagedWidget("FoldersCollapseArrow",
|
||||
xfeArrowWidgetClass,
|
||||
folders_collapse_form,
|
||||
NULL,0);
|
||||
|
||||
folders_collapse_label = XtCreateManagedWidget("FoldersCollapseLabel",
|
||||
xmLabelWidgetClass,
|
||||
folders_collapse_form,
|
||||
NULL,0);
|
||||
|
||||
/* Toggle the main horizontal pane */
|
||||
XtAddCallback(folders_collapse_arrow,
|
||||
XmNactivateCallback,
|
||||
toggle_managed_cb,
|
||||
folders_form);
|
||||
|
||||
return mail_pane;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
mail_create_frame(String frame_name)
|
||||
{
|
||||
Widget frame;
|
||||
Widget form;
|
||||
Widget menu;
|
||||
|
||||
Widget pane;
|
||||
|
||||
Widget one;
|
||||
Widget two;
|
||||
|
||||
frame = XfeFrameCreate(frame_name,NULL,0);
|
||||
|
||||
form = XfeDescendantFindByName(frame,"MainForm",XfeFIND_ANY,False);
|
||||
|
||||
pane = mail_create_pane(form,"MailPane");
|
||||
|
||||
return frame;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,499 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: PaneTestTwo.c */
|
||||
/* Description: Test for XfePane widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static void menu_item_cb (Widget,XtPointer,XtPointer);
|
||||
static void toggle_managed_cb (Widget,XtPointer,XtPointer);
|
||||
|
||||
static Widget create_simple_pane_frame (String);
|
||||
static Widget create_form_and_button (Widget,unsigned char,
|
||||
unsigned char,Widget,String,
|
||||
String,Dimension);
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec file_items[] =
|
||||
{
|
||||
{ "Open", XfeMENU_PUSH },
|
||||
{ "Save", XfeMENU_PUSH },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Exit", XfeMENU_PUSH, XfeExitCallback },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec orientation_items[] =
|
||||
{
|
||||
{ "OrientationVertical", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "OrientationHorizontal", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec pane_sash_type_items[] =
|
||||
{
|
||||
{ "pane_sash_double_line", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "pane_sash_filled_rectangle", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "pane_sash_live", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "pane_sash_rectangle", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "pane_sash_single_line", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec button_boolean_items[] =
|
||||
{
|
||||
{ "TraversalOn", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Sensitive", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "UsePreferredWidth", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "UsePreferredHeight", XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec misc_items[] =
|
||||
{
|
||||
{ "Orientation", XfeMENU_PANE, NULL, orientation_items },
|
||||
{ "PaneSashType", XfeMENU_PANE, NULL, pane_sash_type_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec dimension_items[] =
|
||||
{
|
||||
{ "0", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "1", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "2", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "3", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "4", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "5", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "6", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "7", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "8", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "9", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "10", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "20", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "30", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "40", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "50", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "100", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "200", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "300", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "400", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "500", XfeMENU_RADIO, menu_item_cb },
|
||||
{ "1000", XfeMENU_RADIO, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec margin_items[] =
|
||||
{
|
||||
{ "MarginLeft", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "MarginRight", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "MarginTop", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "MarginBottom", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "MarginAll" , XfeMENU_PANE, NULL, dimension_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec managing_items[] =
|
||||
{
|
||||
{ "One" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "OneTop" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "OneBottom" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "OneLeft" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "OneRight" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Two" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "TwoTop" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "TwoBottom" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "TwoLeft" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ "TwoRight" , XfeMENU_TOGGLE, menu_item_cb },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuItemRec dimensions_items[] =
|
||||
{
|
||||
{ "Width", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "Height", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "HighlightThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "ShadowThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "SashOffset", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "SashShadowThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "SashSpacing", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "SashThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "Margins", XfeMENU_PANE, NULL, margin_items },
|
||||
{ "RaiseBorderThickness", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "ArmOffset", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ "------------", XfeMENU_SEP },
|
||||
{ "SashPosition", XfeMENU_PANE, NULL, dimension_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
static XfeMenuPaneRec pane_items[] =
|
||||
{
|
||||
{ "File", file_items },
|
||||
{ "Managing", managing_items },
|
||||
{ "Dimensions", dimensions_items },
|
||||
{ "BooleanItems", button_boolean_items },
|
||||
{ "MiscItems", misc_items },
|
||||
{ NULL }
|
||||
};
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget simple_frame;
|
||||
|
||||
XfeAppCreate("PaneTestTwo",&argc,argv);
|
||||
|
||||
simple_frame = create_simple_pane_frame("Frame");
|
||||
|
||||
XtPopup(simple_frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_simple_pane_frame(String frame_name)
|
||||
{
|
||||
Widget frame;
|
||||
Widget form;
|
||||
Widget menu;
|
||||
|
||||
Widget pane;
|
||||
|
||||
Widget one;
|
||||
Widget two;
|
||||
|
||||
frame = XfeFrameCreate(frame_name,NULL,0);
|
||||
|
||||
form = XfeDescendantFindByName(frame,"MainForm",XfeFIND_ANY,False);
|
||||
|
||||
pane = XtVaCreateManagedWidget("Pane",xfePaneWidgetClass,form,NULL);
|
||||
|
||||
menu = XfeMenuBarCreate(form,"MenuBar",pane_items,(XtPointer) pane,NULL,0);
|
||||
|
||||
one = XtVaCreateManagedWidget("One",xmFormWidgetClass,pane,NULL);
|
||||
|
||||
two = XtVaCreateManagedWidget("Two",xmFormWidgetClass,pane,NULL);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_ONE,
|
||||
XmPANE_CHILD_ATTACH_TOP,
|
||||
one,"OneTop","Top",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_ONE,
|
||||
XmPANE_CHILD_ATTACH_BOTTOM,
|
||||
one,"OneBottom","Bottom",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_ONE,
|
||||
XmPANE_CHILD_ATTACH_LEFT,
|
||||
one,"OneLeft","Left",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_ONE,
|
||||
XmPANE_CHILD_ATTACH_RIGHT,
|
||||
one,"OneRight","Right",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_TWO,
|
||||
XmPANE_CHILD_ATTACH_TOP,
|
||||
two,"TwoTop","Top",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_TWO,
|
||||
XmPANE_CHILD_ATTACH_BOTTOM,
|
||||
two,"TwoBottom","Bottom",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_TWO,
|
||||
XmPANE_CHILD_ATTACH_LEFT,
|
||||
two,"TwoLeft","Left",2);
|
||||
|
||||
create_form_and_button(pane,
|
||||
XmPANE_CHILD_ATTACHMENT_TWO,
|
||||
XmPANE_CHILD_ATTACH_RIGHT,
|
||||
two,"TwoRight","Right",2);
|
||||
return frame;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
menu_item_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
Widget pane = (Widget) client_data;
|
||||
String name = XtName(w);
|
||||
String parent_name = XtName(XtParent(w));
|
||||
Arg av[20];
|
||||
Cardinal ac = 0;
|
||||
|
||||
printf("menu_item_cb(%s,%s) pane = %s\n",name,parent_name,XtName(pane));
|
||||
|
||||
if (!XfeIsAlive(pane))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(name,"TraversalOn") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(pane,XmNtraversalOn);
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_double_line") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_DOUBLE_LINE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_live") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_LIVE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_rectangle") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_RECTANGLE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_filled_rectangle") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_FILLED_RECTANGLE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"pane_sash_single_line") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNpaneSashType,XmPANE_SASH_SINGLE_LINE); ac++;
|
||||
}
|
||||
else if (strcmp(name,"Sensitive") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(pane,XmNsensitive);
|
||||
}
|
||||
else if (strcmp(name,"UsePreferredWidth") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(pane,XmNusePreferredWidth);
|
||||
}
|
||||
else if (strcmp(name,"UsePreferredHeight") == 0)
|
||||
{
|
||||
XfeResourceToggleBoolean(pane,XmNusePreferredHeight);
|
||||
}
|
||||
else if (strcmp(name,"ShadowIn") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_IN); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowOut") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_OUT); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowEtchedIn") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_ETCHED_IN); ac++;
|
||||
}
|
||||
else if (strcmp(name,"ShadowEtchedOut") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowType,XmSHADOW_ETCHED_OUT); ac++;
|
||||
}
|
||||
else if (strcmp(name,"AlignmentBeginning") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNlabelAlignment,XmALIGNMENT_BEGINNING); ac++;
|
||||
}
|
||||
else if (strcmp(name,"AlignmentCenter") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNlabelAlignment,XmALIGNMENT_CENTER); ac++;
|
||||
}
|
||||
else if (strcmp(name,"AlignmentEnd") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNlabelAlignment,XmALIGNMENT_END); ac++;
|
||||
}
|
||||
|
||||
if (strcmp(parent_name,"MarginLeft") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginLeft,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginRight") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginRight,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginTop") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginTop,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginBottom") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginBottom,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"MarginAll") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNmarginLeft,atoi(name)); ac++;
|
||||
XtSetArg(av[ac],XmNmarginRight,atoi(name)); ac++;
|
||||
XtSetArg(av[ac],XmNmarginTop,atoi(name)); ac++;
|
||||
XtSetArg(av[ac],XmNmarginBottom,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"Width") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNwidth,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"Height") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNheight,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"ShadowThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNshadowThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"SashOffset") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashOffset,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"SashSpacing") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashSpacing,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"SashThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"SashShadowThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashShadowThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"HighlightThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNhighlightThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"RaiseBorderThickness") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNraiseBorderThickness,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"ArmOffset") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNarmOffset,atoi(name)); ac++;
|
||||
}
|
||||
else if (strcmp(name,"OrientationVertical") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNorientation,XmVERTICAL); ac++;
|
||||
}
|
||||
else if (strcmp(name,"OrientationHorizontal") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNorientation,XmHORIZONTAL); ac++;
|
||||
}
|
||||
else if (strcmp(parent_name,"Managing") == 0)
|
||||
{
|
||||
Widget child = XfeDescendantFindByName(pane,name,XfeFIND_ANY,False);
|
||||
|
||||
if (XfeIsAlive(child))
|
||||
{
|
||||
XfeToggleManagedState(child);
|
||||
}
|
||||
}
|
||||
else if (strcmp(parent_name,"SashPosition") == 0)
|
||||
{
|
||||
XtSetArg(av[ac],XmNsashPosition,atoi(name)); ac++;
|
||||
}
|
||||
|
||||
if (ac)
|
||||
{
|
||||
XtSetValues(pane,av,ac);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
toggle_managed_cb(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
Widget pane = (Widget) client_data;
|
||||
|
||||
if (XfeIsAlive(pane))
|
||||
{
|
||||
XfeToggleManagedState(pane);
|
||||
|
||||
if (XfeIsArrow(w))
|
||||
{
|
||||
unsigned char arrow_direction;
|
||||
|
||||
XtVaGetValues(w,XmNarrowDirection,&arrow_direction,NULL);
|
||||
|
||||
if (arrow_direction == XmARROW_DOWN)
|
||||
{
|
||||
arrow_direction = XmARROW_UP;
|
||||
}
|
||||
else if (arrow_direction == XmARROW_UP)
|
||||
{
|
||||
arrow_direction = XmARROW_DOWN;
|
||||
}
|
||||
else if (arrow_direction == XmARROW_RIGHT)
|
||||
{
|
||||
arrow_direction = XmARROW_LEFT;
|
||||
}
|
||||
else if (arrow_direction == XmARROW_LEFT)
|
||||
{
|
||||
arrow_direction = XmARROW_RIGHT;
|
||||
}
|
||||
|
||||
XtVaSetValues(w,XmNarrowDirection,arrow_direction,NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_form_and_button(Widget pw,
|
||||
unsigned char child_type,
|
||||
unsigned char child_attachment,
|
||||
Widget target,
|
||||
String form_name,
|
||||
String button_name,
|
||||
Dimension offset)
|
||||
{
|
||||
Widget form = NULL;
|
||||
Widget button = NULL;
|
||||
Arg av[20];
|
||||
Cardinal ac = 0;
|
||||
|
||||
XtSetArg(av[ac],XmNpaneChildType, child_type); ac++;
|
||||
XtSetArg(av[ac],XmNpaneChildAttachment, child_attachment); ac++;
|
||||
XtSetArg(av[ac],XmNalwaysVisible, True); ac++;
|
||||
|
||||
#if 1
|
||||
|
||||
form = XfeCreateFormAndButton(pw,form_name,button_name,offset,True,av,ac);
|
||||
|
||||
button = XfeDescendantFindByName(form,button_name,XfeFIND_ANY,False);
|
||||
|
||||
assert( XfeIsAlive(button) );
|
||||
|
||||
XtAddCallback(button,XmNactivateCallback,toggle_managed_cb,target);
|
||||
|
||||
#else
|
||||
|
||||
XtSetArg(av[ac],XmNwidth, 20); ac++;
|
||||
XtSetArg(av[ac],XmNheight, 20); ac++;
|
||||
|
||||
form = XtCreateManagedWidget(form_name,xmFormWidgetClass,pw,av,ac);
|
||||
|
||||
#endif
|
||||
|
||||
return form;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,142 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: PixmapTest.c */
|
||||
/* Description: Test for pixmap funcs. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <X11/xpm.h>
|
||||
|
||||
#define ICON_SMALL "../icons/taskbar/task_small_browser.xpm"
|
||||
#define ICON_SMALL_ARMED "../icons/taskbar/task_small_browser_armed.xpm"
|
||||
#define ICON_SMALL_RAISED "../icons/taskbar/task_small_browser_raised.xpm"
|
||||
|
||||
#define ICON "../icons/taskbar/task_browser.xpm"
|
||||
#define ICON_ARMED "../icons/taskbar/task_browser_armed.xpm"
|
||||
#define ICON_RAISED "../icons/taskbar/task_browser_raised.xpm"
|
||||
|
||||
static Boolean get_icon(Widget,String,Pixmap *,Pixmap *);
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget small;
|
||||
Widget large;
|
||||
Widget form;
|
||||
Widget frame;
|
||||
|
||||
Pixmap icon;
|
||||
Pixmap icon_armed;
|
||||
Pixmap icon_raised;
|
||||
|
||||
Pixmap icon_mask;
|
||||
Pixmap icon_armed_mask;
|
||||
Pixmap icon_raised_mask;
|
||||
|
||||
Pixmap icon_small;
|
||||
Pixmap icon_small_armed;
|
||||
Pixmap icon_small_raised;
|
||||
|
||||
Pixmap icon_small_mask;
|
||||
Pixmap icon_small_armed_mask;
|
||||
Pixmap icon_small_raised_mask;
|
||||
|
||||
XfeAppCreateSimple("PixmapTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
large = XfeCreateButton(form,"Large",NULL,0);
|
||||
|
||||
small = XfeCreateButton(form,"Small",NULL,0);
|
||||
|
||||
get_icon(large,ICON,&icon,&icon_mask);
|
||||
get_icon(large,ICON_ARMED,&icon_armed,&icon_armed_mask);
|
||||
get_icon(large,ICON_RAISED,&icon_raised,&icon_raised_mask);
|
||||
|
||||
get_icon(small,ICON_SMALL,&icon_small,&icon_small_mask);
|
||||
get_icon(small,ICON_SMALL_ARMED,&icon_small_armed,&icon_small_armed_mask);
|
||||
get_icon(small,ICON_SMALL_RAISED,&icon_small_raised,&icon_small_raised_mask);
|
||||
|
||||
|
||||
#if 0
|
||||
XtVaSetValues(large,
|
||||
XmNpixmap, icon,
|
||||
XmNpixmapMask, icon_mask,
|
||||
XmNarmedPixmap, icon_armed,
|
||||
XmNarmedPixmapMask, icon_armed_mask,
|
||||
XmNraisedPixmap, icon_raised,
|
||||
XmNraisedPixmapMask, icon_raised_mask,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(small,
|
||||
XmNpixmap, icon_small,
|
||||
XmNpixmapMask, icon_small_mask,
|
||||
XmNarmedPixmap, icon_small_armed,
|
||||
XmNarmedPixmapMask, icon_small_armed_mask,
|
||||
XmNraisedPixmap, icon_small_raised,
|
||||
XmNraisedPixmapMask, icon_small_raised_mask,
|
||||
NULL);
|
||||
#else
|
||||
XtVaSetValues(large,
|
||||
XmNpixmap, XfeGetPixmap(large,"task_editor"),
|
||||
XmNpixmapMask, XfeGetMask(large,"task_editor"),
|
||||
XmNarmedPixmap, XfeGetPixmap(large,"task_editor_armed"),
|
||||
XmNarmedPixmapMask, XfeGetMask(large,"task_editor_armed"),
|
||||
XmNraisedPixmap, XfeGetPixmap(large,"task_editor_raised"),
|
||||
XmNraisedPixmapMask, XfeGetMask(large,"task_editor_raised"),
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(small,
|
||||
XmNpixmap, XfeGetPixmap(large,"task_small_editor"),
|
||||
XmNpixmapMask, XfeGetMask(large,"task_small_editor"),
|
||||
XmNarmedPixmap, XfeGetPixmap(large,"task_small_editor_armed"),
|
||||
XmNarmedPixmapMask, XfeGetMask(large,"task_small_editor_armed"),
|
||||
XmNraisedPixmap, XfeGetPixmap(large,"task_small_editor_raised"),
|
||||
XmNraisedPixmapMask, XfeGetMask(large,"task_small_editor_raised"),
|
||||
NULL);
|
||||
|
||||
#endif
|
||||
|
||||
XtManageChild(large);
|
||||
XtManageChild(small);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Boolean
|
||||
get_icon(Widget w,String filename,Pixmap * pixmap,Pixmap * mask)
|
||||
{
|
||||
return XfeAllocatePixmapFromFile(filename,
|
||||
XtDisplay(w),
|
||||
DefaultRootWindow(XtDisplay(w)),
|
||||
XfeColormap(w),
|
||||
40000,
|
||||
XfeDepth(w),
|
||||
XfeBackground(w),
|
||||
pixmap,
|
||||
mask);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,201 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: ProgressBarTest.c */
|
||||
/* Description: Test for XfeProgressBar widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static void StartSweep (Widget,int);
|
||||
static void SweepTimeout (XtPointer,XtIntervalId *);
|
||||
|
||||
static void StartMessages (Widget,int);
|
||||
static void MessageTimeout (XtPointer,XtIntervalId *);
|
||||
|
||||
#define SWEEP_INTERVAL 100
|
||||
#define MESSAGE_INTERVAL 500
|
||||
|
||||
#define MAX_PERCENT 100
|
||||
#define MIN_PERCENT 0
|
||||
|
||||
static String _messages[] =
|
||||
{
|
||||
"A News error occurred",
|
||||
"If you are unable to connect again later, contact",
|
||||
"If you are unable to connect again, contact the",
|
||||
"Netscape is unable to complete a socket connection",
|
||||
"Netscape is unable to complete a socket connection ",
|
||||
"Netscape is unable to connect to the server at",
|
||||
"Netscape is unable to connect to your proxy server.",
|
||||
"Netscape refuses to connect to this server.",
|
||||
"Netscape was unable to connect to the SMTP server.",
|
||||
"Netscape was unable to create a network socket connection.",
|
||||
"Netscape was unble to connect to the secure news server",
|
||||
"Netscape's network connection was refused by the server",
|
||||
"Please try your connection again)",
|
||||
"The server has disconnected.",
|
||||
"The server may not be accepting connections or the end of the world is upon us very soon.",
|
||||
"Try connecting again later or try restarting Netscape.",
|
||||
"Try connecting again later or try restarting Netscape. You can try to connect later if you like.",
|
||||
"Try connecting again later.",
|
||||
"Try connecting again.",
|
||||
"You will not be able to connect to this site securely.",
|
||||
"You will probably be unable to connect to this site securely, or you can risk being stolen from.",
|
||||
"server to establish a data connection.",
|
||||
"unable to connect to server (TCP Error"
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
Widget status_form;
|
||||
Widget status_frame;
|
||||
|
||||
Widget progress_bar;
|
||||
Widget status_bar;
|
||||
Widget task_bar;
|
||||
|
||||
XfeAppCreateSimple("ProgressBarTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
status_frame = XfeCreateManagedFrame(form,"StatusFrame",NULL,0);
|
||||
|
||||
status_form = XfeCreateManagedForm(status_frame,"StatusForm",NULL,0);
|
||||
|
||||
task_bar = XtCreateManagedWidget("TaskBar",
|
||||
xmPushButtonWidgetClass,
|
||||
status_form,NULL,0);
|
||||
|
||||
progress_bar =
|
||||
XtVaCreateManagedWidget("ProgressBar",
|
||||
xfeProgressBarWidgetClass,
|
||||
status_form,
|
||||
XmNrightWidget, task_bar,
|
||||
NULL);
|
||||
|
||||
status_bar =
|
||||
XtVaCreateWidget("StatusBar",
|
||||
xfeLabelWidgetClass,
|
||||
status_form,
|
||||
XmNrightWidget, progress_bar,
|
||||
XmNtruncateProc, XfeGetTruncateXmStringProc(),
|
||||
XmNtruncateLabel, True,
|
||||
XmNshadowType, XmSHADOW_IN,
|
||||
NULL);
|
||||
|
||||
XtManageChild(status_bar);
|
||||
|
||||
StartSweep(progress_bar,SWEEP_INTERVAL);
|
||||
|
||||
StartMessages(status_bar,MESSAGE_INTERVAL);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
StartSweep(Widget w,int interval)
|
||||
{
|
||||
XfeAppAddTimeOut(interval,SweepTimeout,(XtPointer) w);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
SweepTimeout(XtPointer client_data,XtIntervalId * id)
|
||||
{
|
||||
Widget w = (Widget) client_data;
|
||||
static Boolean direction = True;
|
||||
static int percent = 0;
|
||||
|
||||
char buf[2048];
|
||||
XmString xm_label = NULL;
|
||||
|
||||
if (direction)
|
||||
{
|
||||
percent++;
|
||||
|
||||
if (percent > MAX_PERCENT)
|
||||
{
|
||||
percent = MAX_PERCENT;
|
||||
direction = False;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
percent--;
|
||||
|
||||
if (percent < MIN_PERCENT)
|
||||
{
|
||||
percent = MIN_PERCENT;
|
||||
direction = True;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(buf,"%d%% of 1234k",percent);
|
||||
|
||||
xm_label = XmStringCreateLocalized(buf);
|
||||
|
||||
XfeProgressBarSetComponents(w,xm_label,0,percent);
|
||||
|
||||
if (xm_label)
|
||||
{
|
||||
XmStringFree(xm_label);
|
||||
}
|
||||
|
||||
StartSweep(w,SWEEP_INTERVAL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
StartMessages(Widget w,int interval)
|
||||
{
|
||||
XfeAppAddTimeOut(interval,MessageTimeout,(XtPointer) w);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
MessageTimeout(XtPointer client_data,XtIntervalId * id)
|
||||
{
|
||||
Widget w = (Widget) client_data;
|
||||
static int i = 0;
|
||||
|
||||
char buf[2048];
|
||||
|
||||
if (!(i % 2))
|
||||
{
|
||||
sprintf(buf,"%s",_messages[i++ % XtNumber(_messages)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
buf[0] = '\0';
|
||||
i++;
|
||||
}
|
||||
|
||||
/* XfeProgressBarSetLabelPSZ(w,buf);*/
|
||||
XfeLabelSetStringPSZ(w,buf);
|
||||
|
||||
StartMessages(w,MESSAGE_INTERVAL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,254 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: TaskBarTestOne.c */
|
||||
/* Description: Test for XfeTaskBar widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
|
||||
#include <Xm/MwmUtil.h>
|
||||
|
||||
|
||||
#include <X11/Shell.h>
|
||||
|
||||
#include <Xfe/XfeP.h>
|
||||
|
||||
|
||||
static String names[] =
|
||||
{
|
||||
"One",
|
||||
"Two",
|
||||
"Three",
|
||||
"Four",
|
||||
"Five",
|
||||
"Six"
|
||||
};
|
||||
|
||||
static String icons_large[] =
|
||||
{
|
||||
"icons/bar_web.xpm",
|
||||
"icons/bar_news.xpm",
|
||||
"icons/bar_mail.xpm",
|
||||
"icons/bar_web.xpm",
|
||||
"icons/bar_news.xpm",
|
||||
"icons/bar_mail.xpm",
|
||||
};
|
||||
|
||||
#define LOGO_PIXMAP "icons/logo.xpm"
|
||||
#define DRAG_PIXMAP "icons/drag_tile.xpm"
|
||||
#define UNDOCK_PIXMAP "icons/undock.xpm"
|
||||
|
||||
static void undock_callback (Widget,XtPointer,XtPointer);
|
||||
static void dock_callback (Widget,XtPointer,XtPointer);
|
||||
static void tool_active_callback (Widget,XtPointer,XtPointer);
|
||||
|
||||
static Widget create_docked_task_bar (String,Widget);
|
||||
static Widget create_foating_task_bar (String,Widget);
|
||||
|
||||
static Widget _floating_tb = NULL;
|
||||
static Widget _floating_shell = NULL;
|
||||
static Widget _docked_tb = NULL;
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
|
||||
XfeAppCreateSimple("TaskBarTestOne",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
_docked_tb = create_docked_task_bar("DockedTaskBar",form);
|
||||
|
||||
_floating_tb = create_foating_task_bar("FloatingShell",_docked_tb);
|
||||
|
||||
XtAddCallback(_docked_tb,XmNactionCallback,undock_callback,NULL);
|
||||
|
||||
|
||||
#if 0
|
||||
XtAddCallback(_floating_tb,XmNactionCallback,dock_callback,NULL);
|
||||
#else
|
||||
XtAddCallback(_floating_tb,XmNcloseCallback,dock_callback,NULL);
|
||||
#endif
|
||||
|
||||
XtManageChild(_docked_tb);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_docked_task_bar(String name,Widget parent)
|
||||
{
|
||||
Widget tb;
|
||||
Cardinal i;
|
||||
Pixmap action_pixmap;
|
||||
|
||||
tb = XtVaCreateWidget(name,
|
||||
xfeTaskBarWidgetClass,
|
||||
parent,
|
||||
XmNshowActionButton, True,
|
||||
NULL);
|
||||
|
||||
action_pixmap = XfeGetPixmapFromFile(tb,UNDOCK_PIXMAP);
|
||||
|
||||
XtVaSetValues(tb,
|
||||
XmNactionPixmap, action_pixmap,
|
||||
NULL);
|
||||
|
||||
for (i = 0; i < XtNumber(names); i++)
|
||||
{
|
||||
Widget w;
|
||||
Pixmap p_normal;
|
||||
Pixmap p_raised;
|
||||
Pixmap p_armed;
|
||||
|
||||
w = XtVaCreateManagedWidget(names[i],
|
||||
xfeButtonWidgetClass,
|
||||
tb,
|
||||
NULL);
|
||||
|
||||
p_normal = XfeGetPixmapFromFile(w,icons_large[i]);
|
||||
p_raised = XfeGetPixmapFromFile(w,icons_large[i]);
|
||||
p_armed = XfeGetPixmapFromFile(w,icons_large[i]);
|
||||
|
||||
XtVaSetValues(w,
|
||||
XmNpixmap, p_normal,
|
||||
XmNraisedPixmap, p_raised,
|
||||
XmNarmedPixmap, p_armed,
|
||||
NULL);
|
||||
|
||||
XtAddCallback(w,XmNactivateCallback,tool_active_callback,NULL);
|
||||
}
|
||||
|
||||
return tb;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_foating_task_bar(String name,Widget parent)
|
||||
{
|
||||
Widget tb;
|
||||
Pixmap action_pixmap;
|
||||
Pixmap drag_pixmap;
|
||||
|
||||
int mask;
|
||||
int mode;
|
||||
int func;
|
||||
|
||||
mask = MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MENU;
|
||||
mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL;
|
||||
func = MWM_FUNC_CLOSE | MWM_FUNC_MOVE;
|
||||
|
||||
/* mask = 0;*/
|
||||
|
||||
_floating_shell =
|
||||
XtVaCreatePopupShell(name,
|
||||
xmDialogShellWidgetClass,
|
||||
XfeAncestorFindTopLevelShell(parent),
|
||||
XmNmwmDecorations, mask,
|
||||
XmNmwmInputMode, mode,
|
||||
XmNmwmFunctions, func,
|
||||
XmNallowShellResize, True,
|
||||
XmNdeleteResponse, XmDO_NOTHING,
|
||||
NULL);
|
||||
|
||||
tb = create_docked_task_bar("FloatingTaskBar",_floating_shell);
|
||||
|
||||
XtVaSetValues(tb,XmNshowActionButton,False,NULL);
|
||||
|
||||
action_pixmap = XfeGetPixmapFromFile(tb,LOGO_PIXMAP);
|
||||
drag_pixmap = XfeGetPixmapFromFile(tb,DRAG_PIXMAP);
|
||||
|
||||
#if 0
|
||||
XtVaSetValues(tb,
|
||||
XmNactionPixmap, action_pixmap,
|
||||
XmNdragPixmap, drag_pixmap,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
return tb;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
tool_active_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
/* I want more siblings */
|
||||
XtVaCreateManagedWidget("New Task",
|
||||
xfeButtonWidgetClass,
|
||||
XtParent(w),
|
||||
NULL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
undock_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
static first_map = True;
|
||||
|
||||
XtUnmanageChild(_docked_tb);
|
||||
|
||||
#if 0
|
||||
XtResizeWidget(_floating_shell,
|
||||
_XfeWidth(_floating_tb),
|
||||
_XfeHeight(_floating_tb),
|
||||
0);
|
||||
#endif
|
||||
|
||||
if (first_map)
|
||||
{
|
||||
Widget top_shell = XfeAncestorFindTopLevelShell(_docked_tb);
|
||||
|
||||
Position x =
|
||||
XfeRootX(top_shell) +
|
||||
XfeWidth(top_shell) -
|
||||
XfeWidth(_floating_tb) -
|
||||
0;
|
||||
|
||||
Position y =
|
||||
XfeRootY(top_shell) +
|
||||
XfeHeight(top_shell) -
|
||||
XfeHeight(_floating_tb) -
|
||||
0;
|
||||
|
||||
XtVaSetValues(_floating_shell,
|
||||
XmNx, x,
|
||||
XmNy, y,
|
||||
NULL);
|
||||
|
||||
first_map = False;
|
||||
}
|
||||
|
||||
XtManageChild(_floating_tb);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
dock_callback(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XtManageChild(_docked_tb);
|
||||
|
||||
XtUnmanageChild(_floating_tb);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,54 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: TaskBarTestTwo.c */
|
||||
/* Description: Test for XfeTaskBar widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static Widget _docked_tb = NULL;
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
|
||||
XfeAppCreateSimple("TaskBarTestTwo",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
_docked_tb = XfeCreateLoadedTaskBar(form,
|
||||
"DockedTaskBar",
|
||||
True,
|
||||
"task_",
|
||||
NULL,
|
||||
10,
|
||||
NULL);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -24,7 +24,7 @@
|
|||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
#include <Xfe/XfeTest.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
|
|
|
@ -1,182 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: ToolBoxTest.c */
|
||||
/* Description: Test for XfeToolBox widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
static Widget create_tool_item (Widget,String,Cardinal);
|
||||
static void close_cb (Widget,XtPointer,XtPointer);
|
||||
static void open_cb (Widget,XtPointer,XtPointer);
|
||||
static void new_item_cb (Widget,XtPointer,XtPointer);
|
||||
static void snap_cb (Widget,XtPointer,XtPointer);
|
||||
static void swap_cb (Widget,XtPointer,XtPointer);
|
||||
|
||||
static void button_cb (Widget,XtPointer,XtPointer);
|
||||
|
||||
|
||||
static String tool_names[] =
|
||||
{
|
||||
"red",
|
||||
"yellow",
|
||||
"green",
|
||||
#if 1
|
||||
"blue",
|
||||
"orange",
|
||||
"purple",
|
||||
"pink",
|
||||
"aliceblue"
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
static int tool_heights[] =
|
||||
{
|
||||
2,
|
||||
4,
|
||||
6,
|
||||
8,
|
||||
10,
|
||||
12,
|
||||
10,
|
||||
8
|
||||
};
|
||||
|
||||
#define NUM_TOOLS XtNumber(tool_names)
|
||||
|
||||
static Widget tool_widgets[NUM_TOOLS];
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
|
||||
Widget tb;
|
||||
Cardinal i;
|
||||
|
||||
XfeAppCreateSimple("ToolBoxTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
tb = XfeCreateLoadedToolBox(form,"ToolBox",NULL,0);
|
||||
|
||||
for (i = 0; i < NUM_TOOLS; i++)
|
||||
{
|
||||
tool_widgets[i] = create_tool_item(tb,
|
||||
tool_names[i],
|
||||
tool_heights[i]);
|
||||
}
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static Widget
|
||||
create_tool_item(Widget parent,String name,Cardinal nitems)
|
||||
{
|
||||
Widget tool_item;
|
||||
Widget tool_bar;
|
||||
Widget logo;
|
||||
|
||||
tool_item =
|
||||
XtVaCreateManagedWidget(name,
|
||||
xfeToolItemWidgetClass,
|
||||
parent,
|
||||
XmNusePreferredHeight, True,
|
||||
XmNusePreferredWidth, False,
|
||||
XmNbackground, XfeGetPixel(name),
|
||||
NULL);
|
||||
|
||||
logo =
|
||||
XtVaCreateManagedWidget("Logo",
|
||||
xfeLogoWidgetClass,
|
||||
tool_item,
|
||||
XmNbackground, XfeGetPixel(name),
|
||||
NULL);
|
||||
|
||||
tool_bar = XfeCreateLoadedToolBar(tool_item,
|
||||
"ToolBar",
|
||||
"Item",
|
||||
nitems,
|
||||
nitems / 10,
|
||||
XfeArmCallback,
|
||||
XfeDisarmCallback,
|
||||
XfeActivateCallback,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(tool_bar,XmNbackground,XfeGetPixel(name),NULL);
|
||||
|
||||
XfeToolBoxAddDragDescendant(parent,tool_item);
|
||||
XfeToolBoxAddDragDescendant(parent,tool_bar);
|
||||
XfeToolBoxAddDragDescendant(parent,logo);
|
||||
|
||||
return tool_item;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
snap_cb(Widget w,XtPointer clien_data,XtPointer call_data)
|
||||
{
|
||||
XfeToolBoxCallbackStruct * cbs = (XfeToolBoxCallbackStruct *) call_data;
|
||||
|
||||
printf("snap (%s at %d)\n",XtName(cbs->item),cbs->index);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
new_item_cb(Widget w,XtPointer clien_data,XtPointer call_data)
|
||||
{
|
||||
XfeToolBoxCallbackStruct * cbs = (XfeToolBoxCallbackStruct *) call_data;
|
||||
|
||||
printf("new_item (%s at %d)\n",XtName(cbs->item),cbs->index);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
close_cb(Widget w,XtPointer clien_data,XtPointer call_data)
|
||||
{
|
||||
XfeToolBoxCallbackStruct * cbs = (XfeToolBoxCallbackStruct *) call_data;
|
||||
|
||||
printf("close (%s at %d)\n",XtName(cbs->item),cbs->index);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
open_cb(Widget w,XtPointer clien_data,XtPointer call_data)
|
||||
{
|
||||
XfeToolBoxCallbackStruct * cbs = (XfeToolBoxCallbackStruct *) call_data;
|
||||
|
||||
printf("open (%s at %d)\n",XtName(cbs->item),cbs->index);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
swap_cb(Widget w,XtPointer clien_data,XtPointer call_data)
|
||||
{
|
||||
XfeToolBoxSwapCallbackStruct * cbs =
|
||||
(XfeToolBoxSwapCallbackStruct *) call_data;
|
||||
|
||||
printf("swap (%s with %s from %d to %d)\n",
|
||||
XtName(cbs->swapped),XtName(cbs->displaced),
|
||||
cbs->from_index,cbs->to_index);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
|
@ -1,64 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*-----------------------------------------*/
|
||||
/* */
|
||||
/* Name: ToolScrollTest.c */
|
||||
/* Description: Test for XfeToolScroll widget. */
|
||||
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <XfeTest/XfeTest.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
Widget form;
|
||||
Widget frame;
|
||||
Widget tool_scroll;
|
||||
Widget tool_bar;
|
||||
|
||||
XfeAppCreateSimple("ToolScrollTest",&argc,argv,"MainFrame",&frame,&form);
|
||||
|
||||
tool_scroll = XtVaCreateManagedWidget("ToolScroll",
|
||||
xfeToolScrollWidgetClass,
|
||||
form,
|
||||
NULL);
|
||||
|
||||
XtVaGetValues(tool_scroll,XmNtoolBar,&tool_bar,NULL);
|
||||
|
||||
XfeLoadToolBar(tool_bar,
|
||||
"Tool",
|
||||
15,
|
||||
3,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
XfeOrientedChildrenSetAllowDrag(tool_bar,True);
|
||||
|
||||
XtPopup(frame,XtGrabNone);
|
||||
|
||||
XfeAppMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
Загрузка…
Ссылка в новой задаче