diff --git a/cmd/xfe/XfeWidgets/tests/ArrowTest.ad b/cmd/xfe/XfeWidgets/tests/ArrowTest.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ArrowTest.c b/cmd/xfe/XfeWidgets/tests/ArrowTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ButtonTest.ad b/cmd/xfe/XfeWidgets/tests/ButtonTest.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ButtonTest.c b/cmd/xfe/XfeWidgets/tests/ButtonTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/CascadeTest.ad b/cmd/xfe/XfeWidgets/tests/CascadeTest.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/CascadeTest.c b/cmd/xfe/XfeWidgets/tests/CascadeTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ChromeTest.c b/cmd/xfe/XfeWidgets/tests/ChromeTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ComboBoxTest.c b/cmd/xfe/XfeWidgets/tests/ComboBoxTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/DashBoardTest.c b/cmd/xfe/XfeWidgets/tests/DashBoardTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/FontChooserTest.ad b/cmd/xfe/XfeWidgets/tests/FontChooserTest.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/FontChooserTest.c b/cmd/xfe/XfeWidgets/tests/FontChooserTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/FrameShellTest.ad b/cmd/xfe/XfeWidgets/tests/FrameShellTest.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/FrameShellTest.c b/cmd/xfe/XfeWidgets/tests/FrameShellTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/LabelTest.ad b/cmd/xfe/XfeWidgets/tests/LabelTest.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/LabelTest.c b/cmd/xfe/XfeWidgets/tests/LabelTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/LogoTest.ad b/cmd/xfe/XfeWidgets/tests/LogoTest.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/LogoTest.c b/cmd/xfe/XfeWidgets/tests/LogoTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/Makefile b/cmd/xfe/XfeWidgets/tests/Makefile index c5096e055cb..2679affff20 100644 --- a/cmd/xfe/XfeWidgets/tests/Makefile +++ b/cmd/xfe/XfeWidgets/tests/Makefile @@ -15,52 +15,19 @@ # Copyright (C) 1998 Netscape Communications Corporation. All Rights # Reserved. + +########################################################################## +# +# Name: Makefile +# Description: Makefile for Xfe Widgets tests +# Author: Ramiro Estrugo +# +########################################################################## + DEPTH = ../../../.. -ifdef XFE_WIDGETS_BUILD_UNUSED -UNUSED_CSRCS = \ - ChromeTest.c \ - ComboBoxTest.c \ - FontChooserTest.c \ - FrameShellTest.c \ - $(NULL) - - -endif - -CSRCS = \ - $(UNUSED_CSRCS) \ - ArrowTest.c \ - 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 - -STATIC_PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.static)) -SHARED_PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.shared)) +DIRS = \ + Xfe \ + XmL include $(DEPTH)/config/rules.mk -include $(DEPTH)/cmd/xfe/XfeWidgets/XfeWidgets.mk - -all:: $(STATIC_PROGS) $(SHARED_PROGS) -install:: $(STATIC_PROGS) $(SHARED_PROGS) - -shared: $(SHARED_PROGS) -static: $(STATIC_PROGS) diff --git a/cmd/xfe/XfeWidgets/tests/PaneTestOne.ad b/cmd/xfe/XfeWidgets/tests/PaneTestOne.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/PaneTestOne.c b/cmd/xfe/XfeWidgets/tests/PaneTestOne.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/PaneTestThree.ad b/cmd/xfe/XfeWidgets/tests/PaneTestThree.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/PaneTestThree.c b/cmd/xfe/XfeWidgets/tests/PaneTestThree.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/PaneTestTwo.ad b/cmd/xfe/XfeWidgets/tests/PaneTestTwo.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/PaneTestTwo.c b/cmd/xfe/XfeWidgets/tests/PaneTestTwo.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/PixmapTest.ad b/cmd/xfe/XfeWidgets/tests/PixmapTest.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/PixmapTest.c b/cmd/xfe/XfeWidgets/tests/PixmapTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ProgressBarTest.c b/cmd/xfe/XfeWidgets/tests/ProgressBarTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/TaskBarTestOne.c b/cmd/xfe/XfeWidgets/tests/TaskBarTestOne.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/TaskBarTestTwo.c b/cmd/xfe/XfeWidgets/tests/TaskBarTestTwo.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ToolBarTest.ad b/cmd/xfe/XfeWidgets/tests/ToolBarTest.ad deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ToolBarTest.c b/cmd/xfe/XfeWidgets/tests/ToolBarTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ToolBoxTest.c b/cmd/xfe/XfeWidgets/tests/ToolBoxTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/ToolScrollTest.c b/cmd/xfe/XfeWidgets/tests/ToolScrollTest.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ArrowTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/ArrowTest.ad new file mode 100644 index 00000000000..c6f897f29a1 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ArrowTest.ad @@ -0,0 +1,59 @@ +! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*- +! +! 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. + +ArrowTest*MainForm.width: 800 +ArrowTest*MainForm.height: 400 +ArrowTest*MainForm*background: Gray70 +ArrowTest*MainForm.shadowThickness: 0 + + +ArrowTest*Arrow.leftAttachment: attach_form +ArrowTest*Arrow.topAttachment: attach_form +ArrowTest*Arrow.leftOffset: 10 +ArrowTest*Arrow.topOffset: 10 +ArrowTest*Arrow.arrowWidth: 100 +ArrowTest*Arrow.arrowHeight: 100 +!ArrowTest*Arrow.fillOnArm: false +!ArrowTest*Arrow.raiseOnEnter: false + +!ArrowTest*Arrow.raiseOnEnter: true +!ArrowTest*Arrow.fillOnRaise: true +!ArrowTest*Arrow.fillOnEnter: true + + +ArrowTest*Arrow.fillOnEnter: true + +!ArrowTest*Arrow.raiseBorderThickness: 1 + +!ArrowTest*Arrow.background: red +!ArrowTest*Arrow.foreground: blue + +ArrowTest*Arrow.foreground: red + +ArrowTest*Arrow.raiseForeground: blue + + +!ArrowTest*Arrow.borderWidth: 1 +!ArrowTest*Arrow.borderColor: red + +!ArrowTest*Arrow.armColor: red + + +ArrowTest*Arrow.emulateMotif: false + + + diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ArrowTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/ArrowTest.c new file mode 100644 index 00000000000..ed9794231d6 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ArrowTest.c @@ -0,0 +1,50 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +/*----------------------------------------------------------------------*/ +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ButtonTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/ButtonTest.ad new file mode 100644 index 00000000000..be73777a6d1 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ButtonTest.ad @@ -0,0 +1,87 @@ +! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*- +! +! 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. + + +ButtonTest*MainForm.width: 500 +ButtonTest*MainForm.height: 700 +ButtonTest*MainForm.background: Gray70 +ButtonTest*MainForm.shadowThickness: 0 +ButtonTest*MainForm.shadowType: shadow_in + +ButtonTest*fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +ButtonTest*labelFontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +ButtonTest*foreground: Black + +!! +!! MenuBar +!! +ButtonTest*MenuBar.leftAttachment: attach_form +ButtonTest*MenuBar.rightAttachment: attach_form +ButtonTest*MenuBar.topAttachment: attach_form +ButtonTest*MenuBar.bottomAttachment: attach_none + +ButtonTest*MenuBar*background: Gray65 +ButtonTest*MenuBar*shadowThickness: 2 + +ButtonTest*MenuBar*File.mnemonic: F +ButtonTest*MenuBar*Toggle.mnemonic: T + +ButtonTest*MenuBar*File*Exit.labelString: Exit +ButtonTest*MenuBar*File*Exit.acceleratorText: Alt-Q +ButtonTest*MenuBar*File*Exit.accelerator: AltQ +ButtonTest*MenuBar*File*Exit.mnemonic: x + +!! +!! ToolBar +!! +ButtonTest*ButtonTarget.leftAttachment: attach_form +ButtonTest*ButtonTarget.rightAttachment: attach_none +ButtonTest*ButtonTarget.topAttachment: attach_form +ButtonTest*ButtonTarget.bottomAttachment: attach_none + +!ButtonTest*ButtonTarget.topWidget: MenuBar + +ButtonTest*ButtonTarget.topOffset: 200 +ButtonTest*ButtonTarget.leftOffset: 50 + +ButtonTest*ButtonTarget.background: Gray70 + +ButtonTest*ButtonTarget.buttonType: button_push + +ButtonTest*ButtonTarget.raiseOnEnter: true + +ButtonTest*ButtonTarget.shadowThickness: 2 + +ButtonTest*ButtonTarget.raiseBorderThickness: 2 + +ButtonTest*ButtonTarget.marginLeft: 10 +ButtonTest*ButtonTarget.marginRight: 10 +ButtonTest*ButtonTarget.marginTop: 10 +ButtonTest*ButtonTarget.marginBottom: 10 + +!ButtonTest*ButtonTarget.buttonTrigger: button_trigger_either + +!ButtonTest*ButtonTarget.cursor: hand2 +ButtonTest*ButtonTarget.transparentCursor: cross + +!ButtonTest*ButtonTarget.selectionModifiers: Shift +ButtonTest*ButtonTarget.editModifiers: Shift + + + + + diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ButtonTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/ButtonTest.c new file mode 100644 index 00000000000..07120a4c35f --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ButtonTest.c @@ -0,0 +1,649 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +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)); +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/CascadeTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/CascadeTest.ad new file mode 100644 index 00000000000..70f3ecd3be6 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/CascadeTest.ad @@ -0,0 +1,82 @@ +! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*- +! +! 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. + + +CascadeTest*MainForm.width: 500 +CascadeTest*MainForm.height: 400 +CascadeTest*MainForm.background: Gray70 +CascadeTest*MainForm.shadowThickness: 0 +CascadeTest*MainForm.shadowType: shadow_in + +CascadeTest*fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +CascadeTest*foreground: Black + + + + +CascadeTest*ToolBar.bottomAttachment: attach_none +CascadeTest*ToolBar.leftAttachment: attach_form +CascadeTest*ToolBar.rightAttachment: attach_form +CascadeTest*ToolBar.topAttachment: attach_form +CascadeTest*ToolBar.leftOffset: 5 +CascadeTest*ToolBar.rightOffset: 5 +CascadeTest*ToolBar.topOffset: 5 +CascadeTest*ToolBar.shadowThickness: 1 +CascadeTest*ToolBar.shadowType: shadow_out +CascadeTest*ToolBar.background: Gray70 +CascadeTest*ToolBar.separatorThickness: 50 +!CascadeTest*ToolBar.orientation: vertical + +CascadeTest*ToolBar.orientation: horizontal + +CascadeTest*ToolBar.spacing: 0 + +CascadeTest*ToolBar.usePreferredWidth: false +CascadeTest*ToolBar.usePreferredHeight: true + +CascadeTest*ToolBar.showLogo: true +CascadeTest*ToolBar.forceWidth: true + + +CascadeTest*XfeCascade*traversalOn: no +CascadeTest*XfeCascade*highlightThickness: 0 +CascadeTest*XfeCascade*shadowThickness: 1 +CascadeTest*XfeCascade*highlightColor: Gray20 +CascadeTest*XfeCascade*background: Gray70 +CascadeTest*XfeCascade*buttonType: button_push +CascadeTest*XfeCascade*labelRaisedColor: red +CascadeTest*XfeCascade*labelAlignment: alignment_beginning +CascadeTest*XfeCascade*buttonLayout: button_label_on_bottom +CascadeTest*XfeCascade*shadowThickness: 1 + + +!CascadeTest*XfeCascade*XmRowColumn*background: red + + +CascadeTest*XfeCascade*popupDelay: 500 + + + +CascadeTest*Two.leftOffset: 10 +CascadeTest*Two.topOffset: 10 + + +CascadeTest*Four.leftOffset: 10 +CascadeTest*Four.topOffset: 10 + +CascadeTest*Eight.leftOffset: 10 +CascadeTest*Eight.topOffset: 10 diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/CascadeTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/CascadeTest.c new file mode 100644 index 00000000000..e679b80e9ef --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/CascadeTest.c @@ -0,0 +1,276 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + + +#include + +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/ChromeTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/ChromeTest.ad similarity index 100% rename from cmd/xfe/XfeWidgets/tests/ChromeTest.ad rename to cmd/xfe/XfeWidgets/tests/Xfe/ChromeTest.ad diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ChromeTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/ChromeTest.c new file mode 100644 index 00000000000..5cabb3a1f78 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ChromeTest.c @@ -0,0 +1,377 @@ +/* -*- 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: ChromeTest.c */ +/* Description: Test for XfeChrome widget. */ +/* Author: Ramiro Estrugo */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +static Widget create_chrome (Widget,String); +static Widget create_url_bar (Widget,String); +static Widget create_tool_box (Widget,String); +static void menu_item_cb (Widget,XtPointer,XtPointer); + +static void chrome_toggle (Widget,XtPointer,XtPointer); +static void chrome_flash (Widget,XtPointer,XtPointer); +static void dash_board_toggle (Widget,XtPointer,XtPointer); +static void dash_board_flash (Widget,XtPointer,XtPointer); + +/*----------------------------------------------------------------------*/ +static XfeMenuItemRec toggle_dash_board_items[] = +{ + { "ToolBar", XfeMENU_TOGGLE, dash_board_toggle }, + { "StatusBar", XfeMENU_TOGGLE, dash_board_toggle }, + { "ProgressBar", XfeMENU_TOGGLE, dash_board_toggle }, + { "TaskBar", XfeMENU_TOGGLE, dash_board_toggle }, + { NULL } +}; +/*----------------------------------------------------------------------*/ +static XfeMenuItemRec flash_dash_board_items[] = +{ + { "ToolBar", XfeMENU_PUSH, dash_board_flash }, + { "StatusBar", XfeMENU_PUSH, dash_board_flash }, + { "ProgressBar", XfeMENU_PUSH, dash_board_flash }, + { "TaskBar", XfeMENU_PUSH, dash_board_flash }, + { NULL } +}; +/*----------------------------------------------------------------------*/ +static XfeMenuItemRec file_items[] = +{ + { "Open", XfeMENU_PUSH }, + { "Save", XfeMENU_PUSH }, + { "Sep", XfeMENU_SEP }, + { "Exit", XfeMENU_PUSH, XfeExitCallback }, + { NULL } +}; +/*----------------------------------------------------------------------*/ +static XfeMenuItemRec toggle_items[] = +{ + { "MenuBar", XfeMENU_TOGGLE, chrome_toggle }, + { "ToolBox", XfeMENU_TOGGLE, chrome_toggle }, + { "DashBoard", XfeMENU_TOGGLE, chrome_toggle }, + { "View", XfeMENU_TOGGLE, chrome_toggle }, + { "TopView", XfeMENU_TOGGLE, chrome_toggle }, + { "BottomView", XfeMENU_TOGGLE, chrome_toggle }, + { "Sep", XfeMENU_SEP }, + { "DashBoard", XfeMENU_PANE, NULL, toggle_dash_board_items }, + { NULL } +}; +/*----------------------------------------------------------------------*/ +static XfeMenuItemRec flash_items[] = +{ + { "MenuBar", XfeMENU_PUSH, chrome_flash }, + { "ToolBox", XfeMENU_PUSH, chrome_flash }, + { "DashBoard", XfeMENU_PUSH, chrome_flash }, + { "View", XfeMENU_PUSH, chrome_flash }, + { "TopView", XfeMENU_PUSH, chrome_flash }, + { "BottomView", XfeMENU_PUSH, chrome_flash }, + { "Sep", XfeMENU_SEP }, + { "DashBoard", XfeMENU_PANE, NULL, flash_dash_board_items }, + { NULL } +}; +/*----------------------------------------------------------------------*/ +static XfeMenuItemRec options_items[] = +{ + { "One", XfeMENU_PUSH }, + { "Two", XfeMENU_PUSH }, + { "Three", XfeMENU_PUSH }, + { NULL } +}; +/*----------------------------------------------------------------------*/ +static XfeMenuItemRec help_items[] = +{ + { "Contents", XfeMENU_PUSH }, + { "Search", XfeMENU_PUSH }, + { "Sep", XfeMENU_SEP }, + { "About", XfeMENU_PUSH }, + { NULL } +}; +/*----------------------------------------------------------------------*/ +static XfeMenuPaneRec pane_items[] = +{ + { "File", file_items }, + { "Toggle", toggle_items }, + { "Flash", flash_items }, + { "Options", options_items }, + { "Help", help_items }, + { NULL } +}; +/*----------------------------------------------------------------------*/ +static Widget _chrome = NULL; + +static Widget _menu_bar = NULL; +static Widget _tool_box = NULL; +static Widget _dash_board = NULL; +static Widget _bottom_view = NULL; +static Widget _center_view = NULL; +static Widget _left_view = NULL; +static Widget _right_view = NULL; +static Widget _top_view = NULL; + +static Widget _personal_tool_bar = NULL; +static Widget _tool_bar = NULL; +static Widget _url_bar = NULL; + +/*----------------------------------------------------------------------*/ +int +main(int argc,char *argv[]) +{ + Widget form; + Widget frame; + + XfeAppCreateSimple("ChromeTest",&argc,argv,"MainFrame",&frame,&form); + + _menu_bar = XfeMenuBarCreate(form,"MainMenuBar",pane_items,NULL,NULL,0); + + _chrome = create_chrome(form,"Chrome"); + + XtPopup(frame,XtGrabNone); + + XfeAppMainLoop(); + + return 0; +} +/*----------------------------------------------------------------------*/ +static Widget +create_url_bar(Widget parent,String name) +{ + Widget url_bar; + Widget url_form; + Widget url_label; + Widget url_text; + Widget bookmark_button; + + url_bar = XtVaCreateManagedWidget(name, + xmFrameWidgetClass, + parent, + NULL); + + url_form = XtVaCreateManagedWidget("UrlForm", + xmFormWidgetClass, + url_bar, + NULL); + + bookmark_button = XtVaCreateManagedWidget("BookMarkButton", + xfeButtonWidgetClass, + url_form, + XmNleftAttachment, XmATTACH_FORM, + NULL); + + + url_label = XtVaCreateManagedWidget("UrlLabel", + xmLabelWidgetClass, + url_form, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, bookmark_button, + NULL); + +#if 1 + url_text = XtVaCreateManagedWidget("UrlText", + xmTextFieldWidgetClass, + url_form, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, url_label, + XmNrightAttachment, XmATTACH_FORM, + NULL); +#else + url_text = XtVaCreateManagedWidget("UrlCombo", + xfeFancyBoxWidgetClass, + url_form, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, url_label, + XmNrightAttachment, XmATTACH_FORM, + NULL); +#endif + + return url_bar; +} +/*----------------------------------------------------------------------*/ +static Widget +create_tool_box(Widget parent,String name) +{ + Widget tool_box; + + tool_box = XfeCreateLoadedToolBox(parent,"ToolBox",NULL,0); + + XtVaSetValues(tool_box, + XmNusePreferredWidth, False, + XmNusePreferredHeight, True, + NULL); + + return tool_box; +} +/*----------------------------------------------------------------------*/ +static Widget +create_chrome(Widget parent,String name) +{ + Widget chrome; + Widget menu_bar; + Widget tool_bar_one; + Widget url_bar; + Widget tool_bar_two; + + chrome = XtVaCreateManagedWidget(name, + xfeChromeWidgetClass, + parent, + NULL); + + menu_bar = XfeMenuBarCreate(chrome,"MenuBar",pane_items,NULL,NULL,0); + + XtSetSensitive(menu_bar,False); + + _dash_board = XfeCreateLoadedDashBoard( + chrome, /* pw */ + "DashBoard", /* name */ + "S", /* tool_prefix */ + XfeActivateCallback, /* tool_cb */ + 3, /* tool_count */ + "T", /* tool_prefix */ + False, /* tool_large */ + XfeActivateCallback, /* tool_cb */ + 4, /* tool_count */ + NULL, /* tool_bar_out */ + NULL, /* progress_bar_out */ + NULL, /* status_bar_out */ + NULL, /* task_bar_out */ + NULL, /* tool_items_out */ + NULL); /* task_items_out */ + + _tool_box = create_tool_box(chrome,"ToolBox"); + + tool_bar_one = XfeCreateLoadedToolBar(_tool_box, + "ToolBarOne", + "One", + 10, + 2, + XfeArmCallback, + XfeDisarmCallback, + XfeActivateCallback, + NULL); + + url_bar = create_url_bar(_tool_box,"ToolBarTwo"); + + + tool_bar_two = XfeCreateLoadedToolBar(_tool_box, + "ToolBarThree", + "Two", + 10, + 2, + XfeArmCallback, + XfeDisarmCallback, + XfeActivateCallback, + NULL); + + _center_view = XfeCreateFormAndButton(chrome, + "CenterView", + "Center", + 20, + False, + NULL,0); + + _top_view = XfeCreateFormAndButton(chrome, + "TopView", + "Top", + 10, + False, + NULL,0); + + _bottom_view = XfeCreateFormAndButton(chrome, + "BottomView", + "Bottom", + 10, + False, + NULL,0); + + _left_view = XfeCreateFormAndButton(chrome, + "LeftView", + "Left", + 10, + False, + NULL,0); + + _right_view = XfeCreateFormAndButton(chrome, + "RightView", + "Right", + 10, + False, + NULL,0); + + return chrome; +} +/*----------------------------------------------------------------------*/ +static void +menu_item_cb(Widget w,XtPointer client_data,XtPointer call_data) +{ + int code = (int) client_data; + + printf("code = %d\n",code); +} +/*----------------------------------------------------------------------*/ +static void +chrome_toggle(Widget w,XtPointer client_data,XtPointer call_data) +{ + String name = XtName(w); + Widget tw = XfeDescendantFindByName(_chrome,name,XfeFIND_ANY,False); + + if (XfeIsAlive(tw)) + { + XfeWidgetToggleManaged(tw); + } +} +/*----------------------------------------------------------------------*/ +static void +dash_board_toggle(Widget w,XtPointer client_data,XtPointer call_data) +{ + String name = XtName(w); + Widget tw = XfeDescendantFindByName(_dash_board,name,XfeFIND_ANY,False); + + if (XfeIsAlive(tw)) + { + XfeWidgetToggleManaged(tw); + } +} +/*----------------------------------------------------------------------*/ +static void +chrome_flash(Widget w,XtPointer client_data,XtPointer call_data) +{ + String name = XtName(w); + Widget tw = XfeDescendantFindByName(_chrome,name,XfeFIND_ANY,False); + + if (XfeIsAlive(tw)) + { + XfeWidgetFlash(tw,400,3); + } +} +/*----------------------------------------------------------------------*/ +static void +dash_board_flash(Widget w,XtPointer client_data,XtPointer call_data) +{ + String name = XtName(w); + Widget tw = XfeDescendantFindByName(_dash_board,name,XfeFIND_ANY,False); + + if (XfeIsAlive(tw)) + { + XfeWidgetFlash(tw,400,3); + } +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/ComboBoxTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/ComboBoxTest.ad similarity index 100% rename from cmd/xfe/XfeWidgets/tests/ComboBoxTest.ad rename to cmd/xfe/XfeWidgets/tests/Xfe/ComboBoxTest.ad diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ComboBoxTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/ComboBoxTest.c new file mode 100644 index 00000000000..6ae3c9d172c --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ComboBoxTest.c @@ -0,0 +1,243 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + + +#include + +#include + +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)); +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/DashBoardTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/DashBoardTest.ad similarity index 100% rename from cmd/xfe/XfeWidgets/tests/DashBoardTest.ad rename to cmd/xfe/XfeWidgets/tests/Xfe/DashBoardTest.ad diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/DashBoardTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/DashBoardTest.c new file mode 100644 index 00000000000..f08de79cdc8 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/DashBoardTest.c @@ -0,0 +1,178 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + + +#include + +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/FontChooserTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/FontChooserTest.ad new file mode 100644 index 00000000000..29572b39f49 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/FontChooserTest.ad @@ -0,0 +1,75 @@ +! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*- +! +! 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. + + +FontChooserTest*MainForm.width: 800 +FontChooserTest*MainForm.height: 400 +FontChooserTest*MainForm.background: Gray70 +FontChooserTest*MainForm.shadowThickness: 0 +FontChooserTest*MainForm.shadowType: shadow_in + +FontChooserTest*fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +FontChooserTest*foreground: Black + + +FontChooserTest*Row.adjustLast: False + +FontChooserTest*Row.orientation: horizontal +FontChooserTest*Row.numColumns: 6 +FontChooserTest*Row.packing: pack_tight + +FontChooserTest*XfeLabel*traversalOn: False +FontChooserTest*XfeLabel*highlightThickness: 0 +FontChooserTest*XfeLabel*highlightColor: Gray20 +FontChooserTest*XfeLabel*background: Gray70 +FontChooserTest*XfeLabel*labelType: label_raise +FontChooserTest*XfeLabel*raiseForeground: blue +FontChooserTest*XfeLabel*raiseBorderThickness: 1 +FontChooserTest*XfeLabel*highlightColor: black + +FontChooserTest*XfeLabel*labelLayout: label_label_on_bottom + +!FontChooserTest*FontChooser.rulesType: rules_date +FontChooserTest*FontChooser.rulesType: rules_option +!FontChooserTest*FontChooser.rulesType: rules_text + + +FontChooserTest*FontChooser.InputDateLabel.labelString: mm/dd/yy +FontChooserTest*FontChooser.ArticleLabel.labelString: the + +FontChooserTest*FontChooser*XmRowColumn.marginWidth: 0 +FontChooserTest*FontChooser*XmRowColumn.marginHeight: 0 +FontChooserTest*FontChooser*XmRowColumn.spacing: 0 + + +FontChooserTest*FontChooser*spacing: 0 + +FontChooserTest*FontChooser.leftAttachment: attach_form +FontChooserTest*FontChooser.rightAttachment: attach_none +FontChooserTest*FontChooser.topAttachment: attach_form +FontChooserTest*FontChooser.bottomAttachment: attach_none +FontChooserTest*FontChooser.leftOffset: 5 +FontChooserTest*FontChooser.rightOffset: 5 +FontChooserTest*FontChooser.topOffset: 5 +FontChooserTest*FontChooser.bottomOffset: 5 + +FontChooserTest*FontChooser.matchSubMenuWidth: true +FontChooserTest*FontChooser.buttonLayout: button_label_only +FontChooserTest*FontChooser.labelAlignment: alignment_end + + + diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/FontChooserTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/FontChooserTest.c new file mode 100644 index 00000000000..44f2abb8abb --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/FontChooserTest.c @@ -0,0 +1,91 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + + +#include + +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/FrameShellTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/FrameShellTest.ad new file mode 100644 index 00000000000..4b265edad38 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/FrameShellTest.ad @@ -0,0 +1,66 @@ +! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*- +! +! 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. + + +FrameShellTest*Control*MainForm.width: 500 +FrameShellTest*Control*MainForm.height: 400 +FrameShellTest*Control*MainForm.shadowThickness: 1 +FrameShellTest*Control*MainForm.background: gray70 + +FrameShellTest*Control*ToolBar*background: gray65 +FrameShellTest*Control*ToolBar.shadowThickness: 1 + +FrameShellTest*Control*ToolBar.topAttachment: attach_form +FrameShellTest*Control*ToolBar.bottomAttachment: attach_none +FrameShellTest*Control*ToolBar.leftAttachment: attach_form +FrameShellTest*Control*ToolBar.rightAttachment: attach_form +FrameShellTest*Control*ToolBar.topOffset: 1 +FrameShellTest*Control*ToolBar.leftOffset: 1 +FrameShellTest*Control*ToolBar.rightOffset: 1 +FrameShellTest*Control*ToolBar.usePreferredWidth: false + +FrameShellTest*Control*ToolBar.marginTop: 2 +FrameShellTest*Control*ToolBar.marginBottom: 2 +FrameShellTest*Control*ToolBar.marginLeft: 2 +FrameShellTest*Control*ToolBar.marginRight: 2 + +FrameShellTest*Control*ToolBar*marginTop: 2 +FrameShellTest*Control*ToolBar*marginBottom: 2 +FrameShellTest*Control*ToolBar*marginLeft: 2 +FrameShellTest*Control*ToolBar*marginRight: 2 +FrameShellTest*Control*ToolBar*fillOnRaise: true +FrameShellTest*Control*ToolBar*fillOnArm: true + +FrameShellTest*Control*ListSW*background: gray65 +FrameShellTest*Control*ListSW.topAttachment: attach_widget +FrameShellTest*Control*ListSW.bottomAttachment: attach_form +FrameShellTest*Control*ListSW.leftAttachment: attach_form +FrameShellTest*Control*ListSW.rightAttachment: attach_form +FrameShellTest*Control*ListSW.topWidget: ToolBar +FrameShellTest*Control*ListSW.topOffset: 1 +FrameShellTest*Control*ListSW.bottomOffset: 1 +FrameShellTest*Control*ListSW.leftOffset: 1 +FrameShellTest*Control*ListSW.rightOffset: 1 + +FrameShellTest*Control*ListSW.traversalOn: false +FrameShellTest*Control*ListSW.highlightThickness: 0 +FrameShellTest*Control*ListSW.shadowThickness: 1 + + +FrameShellTest*Dummy*MainForm.width: 500 +FrameShellTest*Dummy*MainForm.height: 400 + diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/FrameShellTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/FrameShellTest.c new file mode 100644 index 00000000000..e9aa17e0c55 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/FrameShellTest.c @@ -0,0 +1,277 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + + +#include + +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/LabelTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/LabelTest.ad new file mode 100644 index 00000000000..068a6bb83fe --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/LabelTest.ad @@ -0,0 +1,59 @@ +! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*- +! +! 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. + + +LabelTest*MainForm.width: 800 +LabelTest*MainForm.height: 400 +LabelTest*MainForm.background: Gray70 +LabelTest*MainForm.shadowThickness: 0 +LabelTest*MainForm.shadowType: shadow_in + +LabelTest*fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +LabelTest*labelFontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +LabelTest*foreground: Black + + +LabelTest*Row.adjustLast: False + +LabelTest*Row.orientation: horizontal +LabelTest*Row.numColumns: 6 +LabelTest*Row.packing: pack_tight + +LabelTest*XfeLabel*traversalOn: False +LabelTest*XfeLabel*highlightThickness: 0 +LabelTest*XfeLabel*highlightColor: Gray20 +LabelTest*XfeLabel*background: Gray70 +LabelTest*XfeLabel*labelType: label_raise +LabelTest*XfeLabel*raiseForeground: blue +LabelTest*XfeLabel*raiseBorderThickness: 1 +LabelTest*XfeLabel*highlightColor: black +!LabelTest*XfeLabel*fillOnRaise: false +!LabelTest*XfeLabel*fillOnArm: false +!LabelTest*XfeLabel*bufferType: buffer_private +!LabelTest*XfeLabel*labelLayout: label_label_only + +LabelTest*XfeLabel*labelLayout: label_label_on_bottom + + +LabelTest*Label.x: 100 +LabelTest*Label.y: 100 + +!LabelTest*Label.width: 100 +!LabelTest*Label.height: 100 + +!LabelTest*Label.usePreferredWidth: false +!LabelTest*Label.usePreferredHeight: false diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/LabelTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/LabelTest.c new file mode 100644 index 00000000000..3a1aee59341 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/LabelTest.c @@ -0,0 +1,52 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +/*----------------------------------------------------------------------*/ +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/LogoTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/LogoTest.ad new file mode 100644 index 00000000000..333743887d4 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/LogoTest.ad @@ -0,0 +1,47 @@ +! -*- Mode: Fundamental; tab-width: 8; indent-tabs-mode: nil -*- +! +! 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. + +Logot*MainForm.width: 500 +LogoTest*MainForm.height: 400 +LogoTest*MainForm.background: Gray70 +LogoTest*MainForm.shadowThickness: 0 +LogoTest*MainForm.shadowType: shadow_in + +LogoTest*Logo.x: 50 +LogoTest*Logo.y: 50 + +LogoTest*Logo.traversalOn: False +LogoTest*Logo.highlightThickness: 0 +LogoTest*Logo.shadowThickness: 1 +LogoTest*Logo.highlightColor: Gray20 +LogoTest*Logo.background: Gray70 +LogoTest*Logo.highlightColor: black + +LogoTest*ToolBar.x: 50 +LogoTest*ToolBar.y: 300 + +LogoTest*Logo.bufferType: buffer_shared + +LogoTest*ProgressBar.x: 50 +LogoTest*ProgressBar.y: 150 +LogoTest*ProgressBar.background: Gray70 +LogoTest*ProgressBar.width: 200 +LogoTest*ProgressBar.usePreferredWidth: False +LogoTest*ProgressBar.barColor: CadetBlue +LogoTest*ProgressBar.cylonWidth: 40 +LogoTest*ProgressBar.cylonInterval: 100 +LogoTest*ProgressBar.cylonOffset: 2 diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/LogoTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/LogoTest.c new file mode 100644 index 00000000000..0184f617c11 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/LogoTest.c @@ -0,0 +1,243 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + + +#include + +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/Makefile b/cmd/xfe/XfeWidgets/tests/Xfe/Makefile new file mode 100644 index 00000000000..dc22bbfe590 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/Makefile @@ -0,0 +1,66 @@ +#! gmake +# +# 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. + +DEPTH = ../../../../.. + +ifdef XFE_WIDGETS_BUILD_UNUSED +UNUSED_CSRCS = \ + ChromeTest.c \ + ComboBoxTest.c \ + FontChooserTest.c \ + FrameShellTest.c \ + $(NULL) + + +endif + +CSRCS = \ + $(UNUSED_CSRCS) \ + ArrowTest.c \ + 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 + +STATIC_PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.static)) +SHARED_PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.shared)) + +include $(DEPTH)/config/rules.mk +include $(DEPTH)/cmd/xfe/XfeWidgets/XfeWidgets.mk + +all:: $(STATIC_PROGS) $(SHARED_PROGS) +install:: $(STATIC_PROGS) $(SHARED_PROGS) + +shared: $(SHARED_PROGS) +static: $(STATIC_PROGS) diff --git a/cmd/xfe/XfeWidgets/tests/MenuTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/MenuTest.ad similarity index 100% rename from cmd/xfe/XfeWidgets/tests/MenuTest.ad rename to cmd/xfe/XfeWidgets/tests/Xfe/MenuTest.ad diff --git a/cmd/xfe/XfeWidgets/tests/MenuTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/MenuTest.c similarity index 100% rename from cmd/xfe/XfeWidgets/tests/MenuTest.c rename to cmd/xfe/XfeWidgets/tests/Xfe/MenuTest.c diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestOne.ad b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestOne.ad new file mode 100644 index 00000000000..61399c8af44 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestOne.ad @@ -0,0 +1,49 @@ +! -*- Mode: Fundamental; tab-width: 8; indent-tabs-mode: nil -*- +! +! 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. + +! + +PaneTestOne*MainForm.width: 600 +PaneTestOne*MainForm.height: 600 +PaneTestOne*MainForm.background: gray65 + +PaneTestOne*MainPane.leftAttachment: attach_form +PaneTestOne*MainPane.rightAttachment: attach_form +PaneTestOne*MainPane.topAttachment: attach_form +PaneTestOne*MainPane.bottomAttachment: attach_form +PaneTestOne*MainPane.leftOffset: 10 +PaneTestOne*MainPane.rightOffset: 10 +PaneTestOne*MainPane.topOffset: 10 +PaneTestOne*MainPane.bottomOffset: 10 +PaneTestOne*MainPane.sashPosition: 260 + +PaneTestOne*XfePane.background: gray65 +PaneTestOne*XfePane.shadowType: shadow_out +PaneTestOne*XfePane.paneSashType: pane_sash_live +PaneTestOne*XfePane.sashThickness: 6 +PaneTestOne*XfePane.sashShadowThickness: 2 +PaneTestOne*XfePane.shadowThickness: 0 + +PaneTestOne*MainPane.orientation: horizontal + + +PaneTestOne*WPane.orientation: vertical +PaneTestOne*EPane.orientation: vertical + +PaneTestOne*NWPane.orientation: vertical +PaneTestOne*SEPane.orientation: vertical + diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestOne.c b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestOne.c new file mode 100644 index 00000000000..3bc82785f9b --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestOne.c @@ -0,0 +1,101 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +/*----------------------------------------------------------------------*/ +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestThree.ad b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestThree.ad new file mode 100644 index 00000000000..44eb1ca9f45 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestThree.ad @@ -0,0 +1,199 @@ +! -*- Mode: Fundamental; tab-width: 8; indent-tabs-mode: nil -*- +! +! 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. + +! + +!! +!! The mail/news demo +!! +PaneTestThree*MainForm.width: 600 +PaneTestThree*MainForm.height: 600 +PaneTestThree*MainForm.background: gray70 + +PaneTestThree*paneSashType: pane_sash_live +!PaneTestThree*paneSashType: pane_sash_double_line + +PaneTestThree*sashShadowThickness: 0 + + +!! +!! The Mail/News Pane +!! +PaneTestThree*MailPane.background: gray70 +PaneTestThree*MailPane.leftAttachment: attach_form +PaneTestThree*MailPane.rightAttachment: attach_form +PaneTestThree*MailPane.topAttachment: attach_form +PaneTestThree*MailPane.bottomAttachment: attach_form +PaneTestThree*MailPane.leftOffset: 10 +PaneTestThree*MailPane.rightOffset: 10 +PaneTestThree*MailPane.topOffset: 10 +PaneTestThree*MailPane.bottomOffset: 10 +PaneTestThree*MailPane.shadowThickness: 0 +PaneTestThree*MailPane.shadowType: shadow_out +PaneTestThree*MailPane.orientation: horizontal +PaneTestThree*MailPane.sashThickness: 0 +PaneTestThree*MailPane.sashSpacing: 2 + +!! +!! The Collapsing Tab +!! +PaneTestThree*MailTab.shadowThickness: 0 + +!! +!! The Folders Form +!! +PaneTestThree*FoldersForm.shadowThickness: 1 +PaneTestThree*FoldersForm.shadowType: shadow_in +PaneTestThree*FoldersForm.background: gray65 + + +!! +!! The Folders Collapse Form +!! +PaneTestThree*FoldersCollapseForm*background: gray70 +PaneTestThree*FoldersCollapseForm.paneChildType: pane_child_attachment_one +PaneTestThree*FoldersCollapseForm.paneChildAttachment: pane_child_attach_right +PaneTestThree*FoldersCollapseForm.alwaysVisible: true +PaneTestThree*FoldersCollapseForm.allowDrag: true + +PaneTestThree*FoldersCollapseArrow.traversalOn: false +PaneTestThree*FoldersCollapseArrow.shadowThickness: 1 +PaneTestThree*FoldersCollapseArrow.highlightThickness: 0 +PaneTestThree*FoldersCollapseArrow.arrowDirection: arrow_left +PaneTestThree*FoldersCollapseArrow.arrowWidth: 10 +PaneTestThree*FoldersCollapseArrow.arrowHeight: 10 + +PaneTestThree*FoldersCollapseArrow.leftAttachment: attach_form +PaneTestThree*FoldersCollapseArrow.topAttachment: attach_form +PaneTestThree*FoldersCollapseArrow.bottomAttachment: attach_none +PaneTestThree*FoldersCollapseArrow.rightAttachment: attach_form +PaneTestThree*FoldersCollapseArrow.leftOffset: 2 +PaneTestThree*FoldersCollapseArrow.rightOffset: 3 + +PaneTestThree*FoldersCollapseLabel.topAttachment: attach_widget +PaneTestThree*FoldersCollapseLabel.bottomAttachment: attach_none +PaneTestThree*FoldersCollapseLabel.leftAttachment: attach_form +PaneTestThree*FoldersCollapseLabel.rightAttachment: attach_form +PaneTestThree*FoldersCollapseLabel.topWidget: FoldersCollapseArrow +PaneTestThree*FoldersCollapseLabel.topOffset: 4 +PaneTestThree*FoldersCollapseLabel.labelString: P\nu\ns\nh\n\nA\nr\nr\no\nw + +!! +!! The Message Pane +!! +PaneTestThree*MessagePane.background: gray70 +PaneTestThree*MessagePane.orientation: vertical +PaneTestThree*MessagePane.sashThickness: 0 +!PaneTestThree*MessagePane.allowDrag: true + +PaneTestThree*ThreadForm.shadowThickness: 1 +PaneTestThree*ThreadForm.shadowType: shadow_in +PaneTestThree*ThreadForm.background: gray65 + +PaneTestThree*MessageForm.shadowThickness: 1 +PaneTestThree*MessageForm.shadowType: shadow_in +PaneTestThree*MessageForm.background: gray65 + +PaneTestThree*AttachmentsForm.shadowThickness: 1 +PaneTestThree*AttachmentsForm.shadowType: shadow_in +PaneTestThree*AttachmentsForm.background: gray70 +PaneTestThree*AttachmentsForm.allowDrag: false +PaneTestThree*AttachmentsForm.allowResize: true + +PaneTestThree*AttachmentsSW*XmScrollBar*shadowThickness: 1 + +PaneTestThree*AttachmentsSW.scrollingPolicy: automatic +PaneTestThree*AttachmentsSW.shadowThickness: 0 +PaneTestThree*AttachmentsSW.shadowType: shadow_in +PaneTestThree*AttachmentsSW*background: gray65 +PaneTestThree*AttachmentsSW.topAttachment: attach_form +PaneTestThree*AttachmentsSW.bottomAttachment: attach_form +PaneTestThree*AttachmentsSW.leftAttachment: attach_form +PaneTestThree*AttachmentsSW.rightAttachment: attach_form +PaneTestThree*AttachmentsSW.topOffset: 1 +PaneTestThree*AttachmentsSW.leftOffset: 1 +PaneTestThree*AttachmentsSW.rightOffset: 1 +PaneTestThree*AttachmentsSW.bottomOffset: 1 + +PaneTestThree*AttachmentsSW.scrolledWindowMarginWidth: 0 +PaneTestThree*AttachmentsSW.scrolledWindowMarginHeight: 0 + +PaneTestThree*AttachmentsSW*traversalOn: false +PaneTestThree*AttachmentsSW*highlightThickness: 0 + +PaneTestThree*ScrolledWindowClipWindow*background: gray65 + + +PaneTestThree*AttachmentsToolBar.usePreferredHeight: true +PaneTestThree*AttachmentsToolBar.usePreferredWidth: true +PaneTestThree*AttachmentsToolBar.spacing: 8 +!PaneTestThree*AttachmentsToolBar*background: gray65 + +PaneTestThree*AttachmentsToolBar*XfeButton*selectionModifiers: Any +PaneTestThree*AttachmentsToolBar*XfeButton*shadowThickness: 0 +PaneTestThree*AttachmentsToolBar*XfeButton*highlightThickness: 0 +PaneTestThree*AttachmentsToolBar*XfeButton*traversalOn: false +PaneTestThree*AttachmentsToolBar*XfeButton*raiseOnEnter: false +PaneTestThree*AttachmentsToolBar*XfeButton*buttonType: button_push +PaneTestThree*AttachmentsToolBar*XfeButton*selectionColor: #FFFFCC + +PaneTestThree*AttachmentsToolBar*XfeButton*marginLeft: 2 +PaneTestThree*AttachmentsToolBar*XfeButton*marginRight: 2 +PaneTestThree*AttachmentsToolBar*XfeButton*marginTop: 2 +PaneTestThree*AttachmentsToolBar*XfeButton*marginBottom: 2 + +!! +!! The Message Collapse Form +!! +PaneTestThree*MessageCollapseForm*background: gray70 +PaneTestThree*MessageCollapseForm.paneChildType: pane_child_attachment_two +PaneTestThree*MessageCollapseForm.paneChildAttachment: pane_child_attach_top +PaneTestThree*MessageCollapseForm.alwaysVisible: true +PaneTestThree*MessageCollapseForm.allowDrag: true + +PaneTestThree*MessageCollapseArrow.traversalOn: false +PaneTestThree*MessageCollapseArrow.shadowThickness: 1 +PaneTestThree*MessageCollapseArrow.highlightThickness: 0 +PaneTestThree*MessageCollapseArrow.arrowDirection: arrow_down +PaneTestThree*MessageCollapseArrow.arrowWidth: 10 +PaneTestThree*MessageCollapseArrow.arrowHeight: 10 + +PaneTestThree*MessageCollapseArrow.leftAttachment: attach_form +PaneTestThree*MessageCollapseArrow.topAttachment: attach_form +PaneTestThree*MessageCollapseArrow.bottomAttachment: attach_form +PaneTestThree*MessageCollapseArrow.rightAttachment: attach_none +PaneTestThree*MessageCollapseArrow.topOffset: 2 +PaneTestThree*MessageCollapseArrow.bottomOffset: 3 + +PaneTestThree*MessageCollapseLabel.leftAttachment: attach_widget +PaneTestThree*MessageCollapseLabel.topAttachment: attach_form +PaneTestThree*MessageCollapseLabel.bottomAttachment: attach_form +PaneTestThree*MessageCollapseLabel.rightAttachment: attach_none +PaneTestThree*MessageCollapseLabel.leftWidget: MessageCollapseArrow +PaneTestThree*MessageCollapseLabel.leftOffset: 4 +PaneTestThree*MessageCollapseLabel.labelString: Push Arrow + +!! +!! The Message Pane +!! +PaneTestThree*AttachmentsPane.background: gray70 +PaneTestThree*AttachmentsPane.orientation: vertical +PaneTestThree*AttachmentsPane.sashThickness: 2 +PaneTestThree*AttachmentsPane.sashShadowThickness: 0 +PaneTestThree*AttachmentsPane.paneDragMode: pane_drag_preserve_two + +!PaneTestThree*AttachmentsForm*background: CadetBlue4 diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestThree.c b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestThree.c new file mode 100644 index 00000000000..eee8cc44cf2 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestThree.c @@ -0,0 +1,790 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestTwo.ad b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestTwo.ad new file mode 100644 index 00000000000..be725b89073 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestTwo.ad @@ -0,0 +1,91 @@ +! -*- Mode: Fundamental; tab-width: 8; indent-tabs-mode: nil -*- +! +! 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. + +! + +PaneTestTwo*MainForm.width: 600 +PaneTestTwo*MainForm.height: 600 +PaneTestTwo*MainForm.background: gray65 + +PaneTestTwo*MenuBar.leftAttachment: attach_form +PaneTestTwo*MenuBar.rightAttachment: attach_form +PaneTestTwo*MenuBar.topAttachment: attach_form +PaneTestTwo*MenuBar.bottomAttachment: attach_none +PaneTestTwo*MenuBar.leftOffset: 0 +PaneTestTwo*MenuBar.rightOffset: 0 +PaneTestTwo*MenuBar.topOffset: 0 +PaneTestTwo*MenuBar.bottomOffset: 0 +PaneTestTwo*MenuBar*background: gray60 +PaneTestTwo*MenuBar*foreground: black +PaneTestTwo*MenuBar*shadowThickness: 2 +PaneTestTwo*MenuBar*fontList: *-helvetica-medium-r-*-*-*-120-*-*-*-*-*-* + +PaneTestTwo*Pane.leftAttachment: attach_form +PaneTestTwo*Pane.rightAttachment: attach_form +PaneTestTwo*Pane.topAttachment: attach_form +PaneTestTwo*Pane.bottomAttachment: attach_form +PaneTestTwo*Pane.leftOffset: 10 +PaneTestTwo*Pane.rightOffset: 10 +PaneTestTwo*Pane.topOffset: 40 +PaneTestTwo*Pane.bottomOffset: 10 +PaneTestTwo*Pane.background: gray65 +PaneTestTwo*Pane.shadowThickness: 1 +PaneTestTwo*Pane.shadowType: shadow_out + +PaneTestTwo*Pane.marginLeft: 10 +PaneTestTwo*Pane.marginRight: 10 +PaneTestTwo*Pane.marginTop: 10 +PaneTestTwo*Pane.marginBottom: 10 + +!PaneTestTwo*Pane.orientation: horizontal + +PaneTestTwo*Pane.sashPosition: 200 +PaneTestTwo*Pane.sashThickness: 10 +PaneTestTwo*Pane.sashShadowThickness: 1 +!PaneTestTwo*Pane.sashShadowType: shadow_etched_in +PaneTestTwo*Pane.interactiveDragging: True + +PaneTestTwo*Pane*One*background: red +PaneTestTwo*Pane*Two*background: blue + +PaneTestTwo*Pane*XmPushButton*shadowThickness: 1 +PaneTestTwo*Pane*XmPushButton*highlightThickness: 0 +PaneTestTwo*Pane*XmPushButton*traversalOn: false + +PaneTestTwo*Pane*OneTop.background: green +PaneTestTwo*Pane*OneTop*labelString: T1 + +PaneTestTwo*Pane*OneBottom.background: yellow +PaneTestTwo*Pane*OneBottom*labelString: B1 + +PaneTestTwo*Pane*OneLeft.background: orange +PaneTestTwo*Pane*OneLeft*labelString: L1 + +PaneTestTwo*Pane*OneRight.background: purple +PaneTestTwo*Pane*OneRight*labelString: R1 + +PaneTestTwo*Pane*TwoTop.background: pink +PaneTestTwo*Pane*TwoTop*labelString: T2 + +PaneTestTwo*Pane*TwoBottom.background: skyblue +PaneTestTwo*Pane*TwoBottom*labelString: B2 + +PaneTestTwo*Pane*TwoLeft.background: cadetblue +PaneTestTwo*Pane*TwoLeft*labelString: L2 + +PaneTestTwo*Pane*TwoRight.background: brown +PaneTestTwo*Pane*TwoRight*labelString: R2 diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestTwo.c b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestTwo.c new file mode 100644 index 00000000000..ae55fc3ba07 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/PaneTestTwo.c @@ -0,0 +1,499 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/PixmapTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/PixmapTest.ad new file mode 100644 index 00000000000..d8d5f457289 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/PixmapTest.ad @@ -0,0 +1,59 @@ +! -*- Mode: Fundamental; tab-width: 8; indent-tabs-mode: nil -*- +! +! 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. + +! + +PixmapTest*MainForm.width: 500 +PixmapTest*MainForm.height: 700 +PixmapTest*MainForm.background: Gray70 +PixmapTest*MainForm.shadowThickness: 0 +PixmapTest*MainForm.shadowType: shadow_in + +PixmapTest*fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +PixmapTest*labelFontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +PixmapTest*foreground: Black + + +!! +!! Large +!! +PixmapTest*Large.leftAttachment: attach_form +PixmapTest*Large.rightAttachment: attach_none +PixmapTest*Large.topAttachment: attach_form +PixmapTest*Large.bottomAttachment: attach_none +PixmapTest*Large.topOffset: 50 +PixmapTest*Large.leftOffset: 50 +PixmapTest*Large.buttonLayout: button_pixmap_only + +PixmapTest*Large.raiseOnEnter: true + +!! +!! Small +!! +PixmapTest*Small.leftAttachment: attach_form +PixmapTest*Small.rightAttachment: attach_none +PixmapTest*Small.topAttachment: attach_widget +PixmapTest*Small.bottomAttachment: attach_none +PixmapTest*Small.topWidget: Large +PixmapTest*Small.topOffset: 50 +PixmapTest*Small.leftOffset: 50 +PixmapTest*Small.buttonLayout: button_pixmap_only + +PixmapTest*Small.raiseOnEnter: true + + + diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/PixmapTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/PixmapTest.c new file mode 100644 index 00000000000..1e4fdcde7bd --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/PixmapTest.c @@ -0,0 +1,142 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include +#include + +#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); +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/ProgressBarTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/ProgressBarTest.ad similarity index 100% rename from cmd/xfe/XfeWidgets/tests/ProgressBarTest.ad rename to cmd/xfe/XfeWidgets/tests/Xfe/ProgressBarTest.ad diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ProgressBarTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/ProgressBarTest.c new file mode 100644 index 00000000000..e1def9b6eb2 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ProgressBarTest.c @@ -0,0 +1,201 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +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); +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/TaskBarTestOne.ad b/cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestOne.ad similarity index 100% rename from cmd/xfe/XfeWidgets/tests/TaskBarTestOne.ad rename to cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestOne.ad diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestOne.c b/cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestOne.c new file mode 100644 index 00000000000..e5771675eda --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestOne.c @@ -0,0 +1,254 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + + +#include + + +#include + +#include + + +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); +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/TaskBarTestTwo.ad b/cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestTwo.ad similarity index 100% rename from cmd/xfe/XfeWidgets/tests/TaskBarTestTwo.ad rename to cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestTwo.ad diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestTwo.c b/cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestTwo.c new file mode 100644 index 00000000000..0d97d9b573e --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/TaskBarTestTwo.c @@ -0,0 +1,54 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +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; +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ToolBarTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/ToolBarTest.ad new file mode 100644 index 00000000000..388103aa630 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ToolBarTest.ad @@ -0,0 +1,152 @@ +! -*- Mode: Fundamental; tab-width: 8; indent-tabs-mode: nil -*- +! +! 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. + +! + +ToolBarTest*MainForm.width: 500 +ToolBarTest*MainForm.height: 400 +ToolBarTest*MainForm.background: Gray70 +ToolBarTest*MainForm.shadowThickness: 0 +ToolBarTest*MainForm.shadowType: shadow_in + +ToolBarTest*fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +ToolBarTest*labelFontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-* +ToolBarTest*foreground: Black + + + + +ToolBarTest*ToolBar.leftAttachment: attach_form +ToolBarTest*ToolBar.topAttachment: attach_form +ToolBarTest*ToolBar.bottomAttachment: attach_none +ToolBarTest*ToolBar.rightAttachment: attach_none +ToolBarTest*ToolBar.leftOffset: 5 +ToolBarTest*ToolBar.rightOffset: 5 +ToolBarTest*ToolBar.topOffset: 5 +ToolBarTest*ToolBar.shadowThickness: 1 +ToolBarTest*ToolBar.shadowType: shadow_out +ToolBarTest*ToolBar.background: Gray70 +ToolBarTest*ToolBar.highlightThickness: 1 +ToolBarTest*ToolBar.highlighted: True +ToolBarTest*ToolBar.buttonLayout: button_label_on_bottom + +!ToolBarTest*ToolBar.borderWidth: 1 +!ToolBarTest*ToolBar.borderColor: Red + +!ToolBarTest*ToolBar.orientation: vertical + +ToolBarTest*ToolBar.spacing: 0 + +ToolBarTest*ToolBar.forceWidth: false + +ToolBarTest*ToolBar.usePreferredWidth: true +ToolBarTest*ToolBar.usePreferredHeight: true + +!ToolBarTest*ToolBar.selectionPolicy: tool_bar_select_single +!ToolBarTest*ToolBar.selectionModifiers: Shift +ToolBarTest*ToolBar*editModifiers: Shift + + +ToolBarTest*ToolBar.allowWrap: true + +!ToolBarTest*XfeButton*bufferType: buffer_private +ToolBarTest*XfeButton*traversalOn: no +ToolBarTest*XfeButton*highlightThickness: 0 +ToolBarTest*XfeButton*shadowThickness: 1 +ToolBarTest*XfeButton*highlightColor: Gray20 +ToolBarTest*XfeButton*background: Gray70 +ToolBarTest*XfeButton*buttonType: button_push +ToolBarTest*XfeButton*labelRaisedColor: red +ToolBarTest*XfeButton*labelAlignment: alignment_beginning + + +ToolBarTest*XfeLabel*background: Gray70 +ToolBarTest*XfeLabel*traversalOn: no +ToolBarTest*XfeLabel*highlightThickness: 0 +ToolBarTest*XfeLabel*shadowThickness: 0 +ToolBarTest*XfeLabel*shadowType: XmSHADOW_IN +ToolBarTest*XfeLabel*labelString: + + +ToolBarTest*Two.leftOffset: 10 +ToolBarTest*Two.topOffset: 10 + + +ToolBarTest*Four.leftOffset: 10 +ToolBarTest*Four.topOffset: 10 + +ToolBarTest*Eight.leftOffset: 10 +ToolBarTest*Eight.topOffset: 10 + + + +ToolBarTest*vsep.orientation: horizontal +ToolBarTest*vsep.shadowThickness: 3 +ToolBarTest*vsep.background: Gray70 +ToolBarTest*vsep.height: 10 + +ToolBarTest*hsep.orientation: vertical +ToolBarTest*hsep.shadowThickness: 3 +ToolBarTest*hsep.background: Gray70 +ToolBarTest*hsep.width: 20 + + +ToolBarTest*Scale.leftAttachment: attach_form +ToolBarTest*Scale.topAttachment: attach_widget +ToolBarTest*Scale.bottomAttachment: attach_none +ToolBarTest*Scale.rightAttachment: attach_none +ToolBarTest*Scale.leftOffset: 5 +ToolBarTest*Scale.topOffset: 50 +ToolBarTest*Scale.topWidget: ToolBar +ToolBarTest*Scale.orientation: horizontal + + +ToolBarTest*Hide.leftAttachment: attach_widget +ToolBarTest*Hide.topAttachment: attach_widget +ToolBarTest*Hide.bottomAttachment: attach_none +ToolBarTest*Hide.rightAttachment: attach_none +ToolBarTest*Hide.leftOffset: 5 +ToolBarTest*Hide.topOffset: 50 +ToolBarTest*Hide.topWidget: ToolBar +ToolBarTest*Hide.leftWidget: Scale +ToolBarTest*Hide.leftOffset: 50 +ToolBarTest*Hide.labelString: Hide Indicator + +!ToolBarTest*ToolBar*Indicator.background: Red + +ToolBarTest*LocationToolBar.leftAttachment: attach_widget +ToolBarTest*LocationToolBar.topAttachment: attach_widget +ToolBarTest*LocationToolBar.bottomAttachment: attach_none +ToolBarTest*LocationToolBar.rightAttachment: attach_none +ToolBarTest*LocationToolBar.leftOffset: 5 +ToolBarTest*LocationToolBar.topOffset: 50 +ToolBarTest*LocationToolBar.topWidget: ToolBar +ToolBarTest*LocationToolBar.leftWidget: Hide +ToolBarTest*LocationToolBar.leftOffset: 50 +ToolBarTest*LocationToolBar.labelString: Hide Indicator +ToolBarTest*LocationToolBar.buttonLayout: button_label_only +ToolBarTest*LocationToolBar.childForceWidth: False +ToolBarTest*LocationToolBar.childForceHeight: True +ToolBarTest*LocationToolBar.childUsePreferredWidth: True +ToolBarTest*LocationToolBar.childUsePreferredHeight: False + + +ToolBarTest*LocationToolBar*Item1.labelString: None +ToolBarTest*LocationToolBar*Item2.labelString: Beginning +ToolBarTest*LocationToolBar*Item3.labelString: End +ToolBarTest*LocationToolBar*Item4.labelString: Middle + diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ToolBarTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/ToolBarTest.c new file mode 100644 index 00000000000..b87c1c644c0 --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ToolBarTest.c @@ -0,0 +1,146 @@ +/* -*- 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: ToolBarTest.c */ +/* Description: Test for XfeToolBar widget. */ +/* Author: Ramiro Estrugo */ +/* */ +/*----------------------------------------------------------------------*/ + +#include + +static void scale_cb (Widget,XtPointer,XtPointer); +static void hide_cb (Widget,XtPointer,XtPointer); +static void location_cb (Widget,XtPointer,XtPointer); + +static Widget _tool_bar = NULL; + +/*----------------------------------------------------------------------*/ +int +main(int argc,char *argv[]) +{ + Widget form; + Widget frame; + Widget scale; + Widget hide; + Widget location_tool_bar; + + XfeAppCreateSimple("ToolBarTest",&argc,argv,"MainFrame",&frame,&form); + + _tool_bar = XfeCreateLoadedToolBar(form, + "ToolBar", + "Tool", + 50, +/* 20, */ + 0, + XfeArmCallback, + XfeDisarmCallback, + XfeActivateCallback, + NULL); + + scale = XtVaCreateManagedWidget("Scale", + xmScaleWidgetClass, + form, + NULL); + + XtAddCallback(scale,XmNvalueChangedCallback,scale_cb,NULL); + XtAddCallback(scale,XmNdragCallback,scale_cb,NULL); + + hide = XtVaCreateManagedWidget("Hide", + xmPushButtonWidgetClass, + form, + NULL); + + XtAddCallback(hide,XmNactivateCallback,hide_cb,NULL); + + location_tool_bar = XfeCreateLoadedToolBar(form, + "LocationToolBar", + "Item", + 4, + 0, + NULL, + NULL, + location_cb, + NULL); + + XtPopup(frame,XtGrabNone); + + XfeAppMainLoop(); + + return 0; +} +/*----------------------------------------------------------------------*/ +static void +scale_cb(Widget w,XtPointer client_data,XtPointer call_data) +{ + int value; + + assert( XfeIsAlive(_tool_bar) ); + + XmScaleGetValue(w,&value); + + value = value / 10; + + printf("%s(%s,%d)\n",__FUNCTION__,XtName(w),value); + + XtVaSetValues(_tool_bar,XmNindicatorPosition,value,NULL); +} +/*----------------------------------------------------------------------*/ +static void +hide_cb(Widget w,XtPointer client_data,XtPointer call_data) +{ + assert( XfeIsAlive(_tool_bar) ); + + printf("%s(%s)\n",__FUNCTION__,XtName(w)); + + XtVaSetValues(_tool_bar,XmNindicatorPosition,XmINDICATOR_DONT_SHOW,NULL); +} +/*----------------------------------------------------------------------*/ +static void +location_cb(Widget w,XtPointer client_data,XtPointer call_data) +{ + unsigned char location = XmINDICATOR_LOCATION_NONE; + + assert( XfeIsAlive(_tool_bar) ); + + if (strcmp(XtName(w),"Item1") == 0) + { + location = XmINDICATOR_LOCATION_NONE; + } + else if (strcmp(XtName(w),"Item2") == 0) + { + location = XmINDICATOR_LOCATION_BEGINNING; + } + else if (strcmp(XtName(w),"Item3") == 0) + { + location = XmINDICATOR_LOCATION_END; + } + else if (strcmp(XtName(w),"Item4") == 0) + { + location = XmINDICATOR_LOCATION_MIDDLE; + } + + printf("%s(%s) location = %s\n", + __FUNCTION__, + XtName(w), + XfeDebugRepTypeValueToName(XmRToolBarIndicatorLocation,location)); + + XtVaSetValues(_tool_bar,XmNindicatorLocation,location,NULL); +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/ToolBoxTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/ToolBoxTest.ad similarity index 100% rename from cmd/xfe/XfeWidgets/tests/ToolBoxTest.ad rename to cmd/xfe/XfeWidgets/tests/Xfe/ToolBoxTest.ad diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ToolBoxTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/ToolBoxTest.c new file mode 100644 index 00000000000..c3daac28e9b --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ToolBoxTest.c @@ -0,0 +1,182 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +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); +} +/*----------------------------------------------------------------------*/ diff --git a/cmd/xfe/XfeWidgets/tests/ToolScrollTest.ad b/cmd/xfe/XfeWidgets/tests/Xfe/ToolScrollTest.ad similarity index 100% rename from cmd/xfe/XfeWidgets/tests/ToolScrollTest.ad rename to cmd/xfe/XfeWidgets/tests/Xfe/ToolScrollTest.ad diff --git a/cmd/xfe/XfeWidgets/tests/Xfe/ToolScrollTest.c b/cmd/xfe/XfeWidgets/tests/Xfe/ToolScrollTest.c new file mode 100644 index 00000000000..f2d2956d8ad --- /dev/null +++ b/cmd/xfe/XfeWidgets/tests/Xfe/ToolScrollTest.c @@ -0,0 +1,64 @@ +/* -*- 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 */ +/* */ +/*----------------------------------------------------------------------*/ + + +#include + +/*----------------------------------------------------------------------*/ +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; +} +/*----------------------------------------------------------------------*/