diff options
36 files changed, 720 insertions, 659 deletions
@@ -1,5 +1,32 @@ 2006-11-02 Daniel Steffen <das@users.sourceforge.net> + * generic/ttk/ttkBlink.c, generic/ttk/ttkButton.c: + * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c: + * generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c: + * generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c: + * generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c: + * generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c: + * generic/ttk/ttkLayout.c, generic/ttk/ttkManager.h: + * generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c: + * generic/ttk/ttkProgress.c, generic/ttk/ttkScale.c: + * generic/ttk/ttkScroll.c, generic/ttk/ttkScrollbar.c: + * generic/ttk/ttkSeparator.c, generic/ttk/ttkSquare.c: + * generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c: + * generic/ttk/ttkTheme.c, generic/ttk/ttkTheme.h: + * generic/ttk/ttkThemeInt.h, generic/ttk/ttkTrack.c: + * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c: + * generic/ttk/ttkWidget.h, macosx/ttkMacOSXTheme.c: + * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c: ensure + all global Ttk symbols have Ttk or ttk prefix; declare all externally + visible Ttk symbols not contained in stubs table as MODULE_SCOPE (or as + static when possible); so that 'make check{exports,stubs}' once again + complete without errors. + + * macosx/tkMacOSXColor.c (TkMacOSXCompareColors): ifdef out when unused. + + * macosx/Wish.xcodeproj/project.pbxproj: check autoconf/autoheader exit + status and stop build if they fail. + * macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): fix handling of Carbon Update events: the QuickDraw window update region was being ignored and all child TkWindows were sent an Expose XEvent even when diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c index cc87397..2476fcd 100644 --- a/generic/ttk/ttkBlink.c +++ b/generic/ttk/ttkBlink.c @@ -1,16 +1,16 @@ /* - * $Id: ttkBlink.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkBlink.c,v 1.2 2006/11/03 03:06:21 das Exp $ * * Copyright 2004, Joe English. * * Usage: - * BlinkCursor(corePtr), usually called in a widget's Init hook, + * TtkBlinkCursor(corePtr), usually called in a widget's Init hook, * arranges to periodically toggle the corePtr->flags CURSOR_ON bit * on and off (and schedule a redisplay) whenever the widget has focus. * * Note: Widgets may have additional logic to decide whether * to display the cursor or not (e.g., readonly or disabled states); - * BlinkCursor() does not account for this. + * TtkBlinkCursor() does not account for this. * * TODO: * Add script-level access to configure application-wide blink rate. @@ -155,11 +155,11 @@ CursorEventProc(ClientData clientData, XEvent *eventPtr) } /* - * BlinkCursor (main routine) -- + * TtkBlinkCursor (main routine) -- * Arrange to blink the cursor on and off whenever the * widget has focus. */ -void BlinkCursor(WidgetCore *corePtr) +void TtkBlinkCursor(WidgetCore *corePtr) { Tk_CreateEventHandler( corePtr->tkwin, CursorEventMask, CursorEventProc, corePtr); diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index eb6417a..e69c5c2 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -1,4 +1,4 @@ -/* $Id: ttkButton.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkButton.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (c) 2003, Joe English * * Ttk widget set: label, button, checkbutton, radiobutton, and @@ -83,7 +83,7 @@ static Tk_OptionSpec BaseOptionSpecs[] = */ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", "none", Tk_Offset(Base,base.compoundObj), -1, - 0,(ClientData)TTKCompoundStrings,GEOMETRY_CHANGED }, + 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, Tk_Offset(Base,base.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED}, @@ -95,7 +95,7 @@ static Tk_OptionSpec BaseOptionSpecs[] = "normal", Tk_Offset(Base,base.stateObj), -1, 0,0,STATE_CHANGED }, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* @@ -129,7 +129,7 @@ static void CoreImageChangedProc(ClientData clientData, TtkRedisplayWidget(corePtr); } -/* GetImageList -- +/* TtkGetImageList -- * ConfigureProc utility routine for handling -image option. * Verifies that -image is a valid image specification, * registers image-changed callbacks for each image (via Tk_GetImage). @@ -143,7 +143,7 @@ static void CoreImageChangedProc(ClientData clientData, * to a NULL-terminated list of Tk_Images; otherwise TCL_ERROR * and leaves an error message in the interpreter result. */ -int GetImageList( +int TtkGetImageList( Tcl_Interp *interp, WidgetCore *corePtr, Tcl_Obj *imageOption, @@ -202,10 +202,10 @@ int GetImageList( } /* - * FreeImageList -- - * Release an image list obtained by GetImageList. + * TtkFreeImageList -- + * Release an image list obtained by TtkGetImageList. */ -void FreeImageList(Tk_Image *imageList) +void TtkFreeImageList(Tk_Image *imageList) { Tk_Image *p; for (p = imageList; *p; ++p) @@ -229,7 +229,7 @@ BaseCleanup(void *recordPtr) if (basePtr->base.textVariableTrace) Ttk_UntraceVariable(basePtr->base.textVariableTrace); if (basePtr->base.images) - FreeImageList(basePtr->base.images); + TtkFreeImageList(basePtr->base.images); } static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask) @@ -244,15 +244,15 @@ static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask) if (!vt) return TCL_ERROR; } - if (basePtr->base.imageObj && GetImageList(interp, + if (basePtr->base.imageObj && TtkGetImageList(interp, &basePtr->core, basePtr->base.imageObj, &images) != TCL_OK) { goto error; } - if (CoreConfigure(interp, recordPtr, mask) != TCL_OK) { + if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { error: - if (images) FreeImageList(images); + if (images) TtkFreeImageList(images); if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } @@ -263,12 +263,12 @@ error: basePtr->base.textVariableTrace = vt; if (basePtr->base.images) { - FreeImageList(basePtr->base.images); + TtkFreeImageList(basePtr->base.images); } basePtr->base.images = images; if (mask & STATE_CHANGED) { - CheckStateOption(&basePtr->core, basePtr->base.stateObj); + TtkCheckStateOption(&basePtr->core, basePtr->base.stateObj); } return TCL_OK; @@ -344,15 +344,16 @@ static Tk_OptionSpec LabelOptionSpecs[] = static WidgetCommandSpec LabelCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, - { "instate", WidgetInstateCommand }, - { "state", WidgetStateCommand }, - { "identify", WidgetIdentifyCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "instate", TtkWidgetInstateCommand }, + { "state", TtkWidgetStateCommand }, + { "identify", TtkWidgetIdentifyCommand }, { NULL, NULL } }; -WidgetSpec LabelWidgetSpec = +MODULE_SCOPE WidgetSpec ttkLabelWidgetSpec; +WidgetSpec ttkLabelWidgetSpec = { "TLabel", /* className */ sizeof(Label), /* recordSize */ @@ -362,10 +363,10 @@ WidgetSpec LabelWidgetSpec = BaseCleanup, /* cleanupProc */ BaseConfigure, /* configureProc */ BasePostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ - WidgetDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetGetLayout, /* getLayoutProc */ + TtkWidgetSize, /* sizeProc */ + TtkWidgetDoLayout, /* layoutProc */ + TtkWidgetDisplay /* displayProc */ }; /*------------------------------------------------------------------------ @@ -397,7 +398,7 @@ static Tk_OptionSpec ButtonOptionSpecs[] = "", Tk_Offset(Button, button.commandObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-default", "default", "Default", "normal", Tk_Offset(Button, button.defaultStateObj), -1, - 0, (ClientData) TTKDefaultStrings, DEFAULTSTATE_CHANGED}, + 0, (ClientData) ttkDefaultStrings, DEFAULTSTATE_CHANGED}, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; @@ -417,9 +418,9 @@ static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) Ttk_GetButtonDefaultStateFromObj( NULL, buttonPtr->button.defaultStateObj, &defaultState); if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { - WidgetChangeState(&buttonPtr->core, TTK_STATE_ALTERNATE, 0); + TtkWidgetChangeState(&buttonPtr->core, TTK_STATE_ALTERNATE, 0); } else { - WidgetChangeState(&buttonPtr->core, 0, TTK_STATE_ALTERNATE); + TtkWidgetChangeState(&buttonPtr->core, 0, TTK_STATE_ALTERNATE); } } return TCL_OK; @@ -445,16 +446,17 @@ ButtonInvokeCommand( static WidgetCommandSpec ButtonCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, { "invoke", ButtonInvokeCommand }, - { "instate", WidgetInstateCommand }, - { "state", WidgetStateCommand }, - { "identify", WidgetIdentifyCommand }, + { "instate", TtkWidgetInstateCommand }, + { "state", TtkWidgetStateCommand }, + { "identify", TtkWidgetIdentifyCommand }, { NULL, NULL } }; -WidgetSpec ButtonWidgetSpec = +MODULE_SCOPE WidgetSpec ttkButtonWidgetSpec; +WidgetSpec ttkButtonWidgetSpec = { "TButton", /* className */ sizeof(Button), /* recordSize */ @@ -464,10 +466,10 @@ WidgetSpec ButtonWidgetSpec = BaseCleanup, /* cleanupProc */ ButtonConfigure, /* configureProc */ BasePostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ - WidgetDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetGetLayout, /* getLayoutProc */ + TtkWidgetSize, /* sizeProc */ + TtkWidgetDoLayout, /* layoutProc */ + TtkWidgetDisplay /* displayProc */ }; /*------------------------------------------------------------------------ @@ -522,15 +524,15 @@ static void CheckbuttonVariableChanged(void *clientData, const char *value) } if (!value) { - WidgetChangeState(&checkPtr->core, TTK_STATE_ALTERNATE, 0); + TtkWidgetChangeState(&checkPtr->core, TTK_STATE_ALTERNATE, 0); return; } /* else */ - WidgetChangeState(&checkPtr->core, 0, TTK_STATE_ALTERNATE); + TtkWidgetChangeState(&checkPtr->core, 0, TTK_STATE_ALTERNATE); if (!strcmp(value, Tcl_GetString(checkPtr->checkbutton.onValueObj))) { - WidgetChangeState(&checkPtr->core, TTK_STATE_SELECTED, 0); + TtkWidgetChangeState(&checkPtr->core, TTK_STATE_SELECTED, 0); } else { - WidgetChangeState(&checkPtr->core, 0, TTK_STATE_SELECTED); + TtkWidgetChangeState(&checkPtr->core, 0, TTK_STATE_SELECTED); } } @@ -636,17 +638,18 @@ CheckbuttonInvokeCommand( static WidgetCommandSpec CheckbuttonCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, { "invoke", CheckbuttonInvokeCommand }, - { "instate", WidgetInstateCommand }, - { "state", WidgetStateCommand }, - { "identify", WidgetIdentifyCommand }, + { "instate", TtkWidgetInstateCommand }, + { "state", TtkWidgetStateCommand }, + { "identify", TtkWidgetIdentifyCommand }, /* MISSING: select, deselect, toggle */ { NULL, NULL } }; -WidgetSpec CheckbuttonWidgetSpec = +MODULE_SCOPE WidgetSpec ttkCheckbuttonWidgetSpec; +WidgetSpec ttkCheckbuttonWidgetSpec = { "TCheckbutton", /* className */ sizeof(Checkbutton), /* recordSize */ @@ -656,10 +659,10 @@ WidgetSpec CheckbuttonWidgetSpec = CheckbuttonCleanup, /* cleanupProc */ CheckbuttonConfigure, /* configureProc */ CheckbuttonPostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ - WidgetDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetGetLayout, /* getLayoutProc */ + TtkWidgetSize, /* sizeProc */ + TtkWidgetDoLayout, /* layoutProc */ + TtkWidgetDisplay /* displayProc */ }; /*------------------------------------------------------------------------ @@ -716,15 +719,15 @@ RadiobuttonVariableChanged(void *clientData, const char *value) } if (!value) { - WidgetChangeState(&radioPtr->core, TTK_STATE_ALTERNATE, 0); + TtkWidgetChangeState(&radioPtr->core, TTK_STATE_ALTERNATE, 0); return; } /* else */ - WidgetChangeState(&radioPtr->core, 0, TTK_STATE_ALTERNATE); + TtkWidgetChangeState(&radioPtr->core, 0, TTK_STATE_ALTERNATE); if (!strcmp(value, Tcl_GetString(radioPtr->radiobutton.valueObj))) { - WidgetChangeState(&radioPtr->core, TTK_STATE_SELECTED, 0); + TtkWidgetChangeState(&radioPtr->core, TTK_STATE_SELECTED, 0); } else { - WidgetChangeState(&radioPtr->core, 0, TTK_STATE_SELECTED); + TtkWidgetChangeState(&radioPtr->core, 0, TTK_STATE_SELECTED); } } @@ -807,17 +810,18 @@ RadiobuttonInvokeCommand( static WidgetCommandSpec RadiobuttonCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, { "invoke", RadiobuttonInvokeCommand }, - { "instate", WidgetInstateCommand }, - { "state", WidgetStateCommand }, - { "identify", WidgetIdentifyCommand }, + { "instate", TtkWidgetInstateCommand }, + { "state", TtkWidgetStateCommand }, + { "identify", TtkWidgetIdentifyCommand }, /* MISSING: select, deselect */ { NULL, NULL } }; -WidgetSpec RadiobuttonWidgetSpec = +MODULE_SCOPE WidgetSpec ttkRadiobuttonWidgetSpec; +WidgetSpec ttkRadiobuttonWidgetSpec = { "TRadiobutton", /* className */ sizeof(Radiobutton), /* recordSize */ @@ -827,10 +831,10 @@ WidgetSpec RadiobuttonWidgetSpec = RadiobuttonCleanup, /* cleanupProc */ RadiobuttonConfigure, /* configureProc */ RadiobuttonPostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ - WidgetDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetGetLayout, /* getLayoutProc */ + TtkWidgetSize, /* sizeProc */ + TtkWidgetDoLayout, /* layoutProc */ + TtkWidgetDisplay /* displayProc */ }; /*------------------------------------------------------------------------ @@ -871,15 +875,16 @@ static Tk_OptionSpec MenubuttonOptionSpecs[] = static WidgetCommandSpec MenubuttonCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, - { "instate", WidgetInstateCommand }, - { "state", WidgetStateCommand }, - { "identify", WidgetIdentifyCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "instate", TtkWidgetInstateCommand }, + { "state", TtkWidgetStateCommand }, + { "identify", TtkWidgetIdentifyCommand }, { NULL, NULL } }; -WidgetSpec MenubuttonWidgetSpec = +MODULE_SCOPE WidgetSpec ttkMenubuttonWidgetSpec; +WidgetSpec ttkMenubuttonWidgetSpec = { "TMenubutton", /* className */ sizeof(Menubutton), /* recordSize */ @@ -889,9 +894,9 @@ WidgetSpec MenubuttonWidgetSpec = BaseCleanup, /* cleanupProc */ BaseConfigure, /* configureProc */ BasePostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ - WidgetDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetGetLayout, /* getLayoutProc */ + TtkWidgetSize, /* sizeProc */ + TtkWidgetDoLayout, /* layoutProc */ + TtkWidgetDisplay /* displayProc */ }; diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 0165a9f..87e5d23 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkClamTheme.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkClamTheme.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * Copyright (C) 2004 Joe English * @@ -424,7 +424,7 @@ static void MenuIndicatorElementSize( MenuIndicatorElement *indicator = elementRecord; int size = MENUBUTTON_ARROW_SIZE; Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); - ArrowSize(size, ARROW_DOWN, widthPtr, heightPtr); + TtkArrowSize(size, ARROW_DOWN, widthPtr, heightPtr); Ttk_GetPaddingFromObj(NULL, tkwin, indicator->paddingObj, paddingPtr); } @@ -440,9 +440,9 @@ static void MenuIndicatorElementDraw( Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); - ArrowSize(size, ARROW_DOWN, &width, &height); + TtkArrowSize(size, ARROW_DOWN, &width, &height); b = Ttk_StickBox(b, width, height, 0); - FillArrow(Tk_Display(tkwin), d, gc, b, ARROW_DOWN); + TtkFillArrow(Tk_Display(tkwin), d, gc, b, ARROW_DOWN); } static Ttk_ElementSpec MenuIndicatorElementSpec = @@ -594,7 +594,7 @@ static Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, - NullElementGeometry, + TtkNullElementGeometry, TroughElementDraw }; @@ -762,10 +762,10 @@ static void ArrowElementDraw( b = Ttk_PadBox(b, Ttk_UniformPadding(3)); h = b.width < b.height ? b.width : b.height; - ArrowSize(h/2, dir, &cx, &cy); + TtkArrowSize(h/2, dir, &cx, &cy); b = Ttk_AnchorBox(b, cx, cy, TK_ANCHOR_CENTER); - FillArrow(Tk_Display(tkwin), d, gc, b, dir); + TtkFillArrow(Tk_Display(tkwin), d, gc, b, dir); } static Ttk_ElementSpec ArrowElementSpec = { @@ -914,8 +914,8 @@ TTK_END_LAYOUT * +++ Initialization. */ -int DLLEXPORT -ClamTheme_Init(Tcl_Interp *interp) +MODULE_SCOPE int +TtkClamTheme_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_CreateTheme(interp, "clam", 0); diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index 9ddaee4..f62c6f2 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkClassicTheme.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkClassicTheme.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * Copyright (c) 2004, Joe English * @@ -475,11 +475,11 @@ TTK_END_LAYOUT */ /*------------------------------------------------------------------------ - * ClassicTheme_Init -- + * TtkClassicTheme_Init -- * Install classic theme. */ -int ClassicTheme_Init(Tcl_Interp *interp) +MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_CreateTheme(interp, "classic", NULL); diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h index 20fcd85..743c056 100644 --- a/generic/ttk/ttkDecls.h +++ b/generic/ttk/ttkDecls.h @@ -1,9 +1,11 @@ /* - * $Id: ttkDecls.h,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkDecls.h,v 1.2 2006/11/03 03:06:22 das Exp $ * * This file is (mostly) automatically generated from ttk.decls. */ +#ifndef _TTKDECLS +#define _TTKDECLS #if defined(USE_TTK_STUBS) @@ -334,3 +336,5 @@ extern const TtkStubs *ttkStubsPtr; #endif /* defined(USE_TTK_STUBS) */ /* !END!: Do not edit above this line. */ + +#endif /* _TTKDECLS */ diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index dd7ad67..6971b3e 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -1,4 +1,4 @@ -/* $Id: ttkDefaultTheme.c,v 1.2 2006/10/31 13:56:58 das Exp $ +/* $Id: ttkDefaultTheme.c,v 1.3 2006/11/03 03:06:22 das Exp $ * * Copyright (c) 2003, Joe English * @@ -54,7 +54,7 @@ static int shadowColors[6][4] = }; /* top-left, bottom-right */ -int thinShadowColors[6][4] = +static int thinShadowColors[6][4] = { { FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/ { DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/ @@ -194,7 +194,7 @@ static void ArrowPoints(Ttk_Box b, ArrowDirection dir, XPoint points[4]) } /*public*/ -void ArrowSize(int h, ArrowDirection dir, int *widthPtr, int *heightPtr) +void TtkArrowSize(int h, ArrowDirection dir, int *widthPtr, int *heightPtr) { switch (dir) { case ARROW_UP: @@ -205,11 +205,11 @@ void ArrowSize(int h, ArrowDirection dir, int *widthPtr, int *heightPtr) } /* - * DrawArrow, FillArrow -- + * TtkDrawArrow, TtkFillArrow -- * Draw an arrow in the indicated direction inside the specified box. */ /*public*/ -void FillArrow( +void TtkFillArrow( Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir) { XPoint points[4]; @@ -219,7 +219,7 @@ void FillArrow( } /*public*/ -void DrawArrow( +void TtkDrawArrow( Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir) { XPoint points[4]; @@ -405,7 +405,7 @@ static char *button_images[] = { }; #endif -Ttk_StateTable checkbutton_states[] = +static Ttk_StateTable checkbutton_states[] = { { 0, 0, TTK_STATE_SELECTED|TTK_STATE_DISABLED }, { 1, TTK_STATE_SELECTED, TTK_STATE_DISABLED }, @@ -429,14 +429,14 @@ static char *checkbutton_pixels[] = { "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", }; -IndicatorSpec checkbutton_spec = +static IndicatorSpec checkbutton_spec = { 13, 13, 4, /* width, height, nimages */ checkbutton_pixels, checkbutton_states }; -Ttk_StateTable radiobutton_states[] = +static Ttk_StateTable radiobutton_states[] = { { 0, 0, TTK_STATE_SELECTED|TTK_STATE_DISABLED }, { 1, TTK_STATE_SELECTED, TTK_STATE_DISABLED }, @@ -461,7 +461,7 @@ static char *radiobutton_pixels[] = { "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", }; -IndicatorSpec radiobutton_spec = +static IndicatorSpec radiobutton_spec = { 13, 13, 4, /* width, height, nimages */ radiobutton_pixels, @@ -653,7 +653,7 @@ static void ArrowElementSize( Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width); width -= Ttk_PaddingWidth(ArrowPadding); - ArrowSize(width/2, direction, widthPtr, heightPtr); + TtkArrowSize(width/2, direction, widthPtr, heightPtr); *paddingPtr = ArrowPadding; } @@ -675,7 +675,7 @@ static void ArrowElementDraw( tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT); DrawBorder(tkwin,d,border,borderColor,b,borderWidth,relief); - FillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d), + TtkFillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d), Ttk_PadBox(b, ArrowPadding), direction); } @@ -755,10 +755,10 @@ static void MenubuttonArrowElementDraw( case POST_FLUSH: arrowDirection = ARROW_DOWN; break; } - ArrowSize(size, arrowDirection, &width, &height); + TtkArrowSize(size, arrowDirection, &width, &height); b = Ttk_PadBox(b, MenubuttonArrowPadding); b = Ttk_AnchorBox(b, width, height, TK_ANCHOR_CENTER); - FillArrow(Tk_Display(tkwin), d, gc, b, arrowDirection); + TtkFillArrow(Tk_Display(tkwin), d, gc, b, arrowDirection); } static Ttk_ElementSpec MenubuttonArrowElementSpec = @@ -1113,10 +1113,10 @@ static Ttk_ElementSpec TreeitemIndicatorElementSpec = /*------------------------------------------------------------------------ - * AltTheme_Init -- + * TtkAltTheme_Init -- * Install alternate theme. */ -int AltTheme_Init(Tcl_Interp *interp) +MODULE_SCOPE int TtkAltTheme_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_CreateTheme(interp, "alt", NULL); diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 8cd5c6b..787ea64 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -1,4 +1,4 @@ -/* $Id: ttkElements.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkElements.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * Copyright (c) 2003, Joe English * @@ -10,6 +10,7 @@ #include <tk.h> #include <string.h> #include "ttkTheme.h" +#include "ttkWidget.h" #define DEFAULT_BORDERWIDTH "2" #define DEFAULT_ARROW_SIZE "15" @@ -21,29 +22,29 @@ * and may be used in other engines. */ -/* public */ Ttk_ElementOptionSpec NullElementOptions[] = { {NULL} }; +/* public */ Ttk_ElementOptionSpec TtkNullElementOptions[] = { {NULL} }; /* public */ void -NullElementGeometry( +TtkNullElementGeometry( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { } /* public */ void -NullElementDraw( +TtkNullElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { } -/* public */ Ttk_ElementSpec NullElementSpec = +/* public */ Ttk_ElementSpec ttkNullElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, - NullElementGeometry, - NullElementDraw + TtkNullElementOptions, + TtkNullElementGeometry, + TtkNullElementDraw }; /*---------------------------------------------------------------------- @@ -767,7 +768,7 @@ ArrowElementGeometry( Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &width); width -= Ttk_PaddingWidth(ArrowPadding); - ArrowSize(width/2, direction, widthPtr, heightPtr); + TtkArrowSize(width/2, direction, widthPtr, heightPtr); *paddingPtr = ArrowPadding; } @@ -788,7 +789,7 @@ ArrowElementDraw( Tk_Fill3DRectangle( tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); - FillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d), + TtkFillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d), Ttk_PadBox(b, ArrowPadding), direction); } @@ -1357,17 +1358,17 @@ TTK_BEGIN_LAYOUT(SizegripLayout) TTK_END_LAYOUT /*---------------------------------------------------------------------- - * RegisterElements -- + * TtkRegisterElements -- * * Register all elements and layouts defined in this package. */ -extern Ttk_ElementSpec TextElementSpec; -extern Ttk_ElementSpec ImageElementSpec; -extern Ttk_ElementSpec ImageTextElementSpec; -extern Ttk_ElementSpec LabelElementSpec; +extern Ttk_ElementSpec ttkTextElementSpec; +extern Ttk_ElementSpec ttkImageElementSpec; +extern Ttk_ElementSpec ttkImageTextElementSpec; +extern Ttk_ElementSpec ttkLabelElementSpec; -void RegisterElements(Tcl_Interp *interp) +void TtkRegisterElements(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); @@ -1382,11 +1383,11 @@ void RegisterElements(Tcl_Interp *interp) Ttk_RegisterElement(interp, theme, "focus", &FocusElementSpec, NULL); Ttk_RegisterElement(interp, theme, "padding", &PaddingElementSpec, NULL); - Ttk_RegisterElement(interp, theme, "text", &TextElementSpec, NULL); + Ttk_RegisterElement(interp, theme, "text", &ttkTextElementSpec, NULL); Ttk_RegisterElement(interp, theme, - "Labelframe.text",&ImageTextElementSpec,NULL); - Ttk_RegisterElement(interp, theme, "image", &ImageElementSpec, interp); - Ttk_RegisterElement(interp, theme, "label", &LabelElementSpec, interp); + "Labelframe.text",&ttkImageTextElementSpec,NULL); + Ttk_RegisterElement(interp, theme, "image", &ttkImageElementSpec, interp); + Ttk_RegisterElement(interp, theme, "label", &ttkLabelElementSpec, interp); Ttk_RegisterElement(interp, theme, "Checkbutton.indicator", &CheckbuttonIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Radiobutton.indicator", @@ -1394,7 +1395,7 @@ void RegisterElements(Tcl_Interp *interp) Ttk_RegisterElement(interp, theme, "Menubutton.indicator", &MenuIndicatorElementSpec, NULL); - Ttk_RegisterElement(interp, theme, "indicator", &NullElementSpec,NULL); + Ttk_RegisterElement(interp, theme, "indicator", &ttkNullElementSpec,NULL); Ttk_RegisterElement(interp, theme, "uparrow", &ArrowElementSpec, &ArrowElements[0]); diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index d6e3616..897c6b6 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1,5 +1,5 @@ /* - * $Id: ttkEntry.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkEntry.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * DERIVED FROM: tk/generic/tkEntry.c r1.35. * @@ -204,7 +204,7 @@ static Tk_OptionSpec EntryOptionSpecs[] = NULL, Tk_Offset(Entry, entry.styleData.backgroundObj), -1, TK_OPTION_NULL_OK,0,0}, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ @@ -642,9 +642,9 @@ static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason) entryPtr, entryPtr->entry.string, -1,0, reason); if (code == TCL_BREAK) { - WidgetChangeState(&entryPtr->core, TTK_STATE_INVALID, 0); + TtkWidgetChangeState(&entryPtr->core, TTK_STATE_INVALID, 0); } else if (code == TCL_OK) { - WidgetChangeState(&entryPtr->core, 0, TTK_STATE_INVALID); + TtkWidgetChangeState(&entryPtr->core, 0, TTK_STATE_INVALID); } return code; @@ -927,7 +927,7 @@ EntryInitialize(Tcl_Interp *interp, void *recordPtr) entryPtr->core.tkwin, EntryEventMask, EntryEventProc, entryPtr); Tk_CreateSelHandler(entryPtr->core.tkwin, XA_PRIMARY, XA_STRING, EntryFetchSelection, (ClientData) entryPtr, XA_STRING); - BlinkCursor(&entryPtr->core); + TtkBlinkCursor(&entryPtr->core); entryPtr->entry.string = ckalloc(1); *entryPtr->entry.string = '\0'; @@ -938,7 +938,7 @@ EntryInitialize(Tcl_Interp *interp, void *recordPtr) EntryInitStyleDefaults(&entryPtr->entry.styleDefaults); entryPtr->entry.xscrollHandle = - CreateScrollHandle(&entryPtr->core, &entryPtr->entry.xscroll); + TtkCreateScrollHandle(&entryPtr->core, &entryPtr->entry.xscroll); entryPtr->entry.insertPos = 0; entryPtr->entry.selectFirst = -1; @@ -955,7 +955,7 @@ EntryCleanup(void *recordPtr) if (entryPtr->entry.textVariableTrace) Ttk_UntraceVariable(entryPtr->entry.textVariableTrace); - FreeScrollHandle(entryPtr->entry.xscrollHandle); + TtkFreeScrollHandle(entryPtr->entry.xscrollHandle); EntryFreeStyleDefaults(&entryPtr->entry.styleDefaults); @@ -984,7 +984,7 @@ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) } } - if (CoreConfigure(interp, recordPtr, mask) != TCL_OK) { + if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } @@ -1006,13 +1006,13 @@ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) /* Handle -state compatibility option: */ if (mask & STATE_CHANGED) { - CheckStateOption(&entryPtr->core, entryPtr->entry.stateObj); + TtkCheckStateOption(&entryPtr->core, entryPtr->entry.stateObj); } /* Force scrollbar update if needed: */ if (mask & SCROLLCMD_CHANGED) { - ScrollbarUpdateRequired(entryPtr->entry.xscrollHandle); + TtkScrollbarUpdateRequired(entryPtr->entry.xscrollHandle); } /* Recompute the displayString, in case showChar changed: @@ -1139,7 +1139,7 @@ EntryDoLayout(void *recordPtr) entryPtr->entry.layoutX = textarea.x - leftX; } - Scrolled(entryPtr->entry.xscrollHandle, + TtkScrolled(entryPtr->entry.xscrollHandle, leftIndex, rightIndex, entryPtr->entry.numChars); } @@ -1581,7 +1581,7 @@ static int EntrySelectionCommand( { "range", EntrySelectionRangeCommand }, {0,0} }; - return WidgetEnsembleCommand( + return TtkWidgetEnsembleCommand( EntrySelectionCommands, 2, interp, objc, objv, recordPtr); } @@ -1630,23 +1630,23 @@ static int EntryXViewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Entry *entryPtr = recordPtr; - return ScrollviewCommand(interp, objc, objv, entryPtr->entry.xscrollHandle); + return TtkScrollviewCommand(interp, objc, objv, entryPtr->entry.xscrollHandle); } static WidgetCommandSpec EntryCommands[] = { { "bbox", EntryBBoxCommand }, - { "cget", WidgetCgetCommand }, - { "configure", WidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "configure", TtkWidgetConfigureCommand }, { "delete", EntryDeleteCommand }, { "get", EntryGetCommand }, { "icursor", EntryICursorCommand }, - { "identify", WidgetIdentifyCommand }, + { "identify", TtkWidgetIdentifyCommand }, { "index", EntryIndexCommand }, { "insert", EntryInsertCommand }, - { "instate", WidgetInstateCommand }, + { "instate", TtkWidgetInstateCommand }, { "selection", EntrySelectionCommand }, - { "state", WidgetStateCommand }, + { "state", TtkWidgetStateCommand }, { "validate", EntryValidateCommand }, { "xview", EntryXViewCommand }, {0,0} @@ -1656,7 +1656,7 @@ static WidgetCommandSpec EntryCommands[] = * +++ Entry widget definition. */ -WidgetSpec EntryWidgetSpec = +static WidgetSpec EntryWidgetSpec = { "TEntry", /* className */ sizeof(Entry), /* recordSize */ @@ -1666,8 +1666,8 @@ WidgetSpec EntryWidgetSpec = EntryCleanup, /* cleanupProc */ EntryConfigure, /* configureProc */ EntryPostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ + TtkWidgetGetLayout, /* getLayoutProc */ + TtkWidgetSize, /* sizeProc */ EntryDoLayout, /* layoutProc */ EntryDisplay /* displayProc */ }; @@ -1707,7 +1707,7 @@ ComboboxInitialize(Tcl_Interp *interp, void *recordPtr) { Combobox *cb = recordPtr; cb->combobox.currentIndex = -1; - TrackElementState(&cb->core); + TtkTrackElementState(&cb->core); return EntryInitialize(interp, recordPtr); } @@ -1795,24 +1795,24 @@ static int ComboboxCurrentCommand( static WidgetCommandSpec ComboboxCommands[] = { { "bbox", EntryBBoxCommand }, - { "cget", WidgetCgetCommand }, - { "configure", WidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "configure", TtkWidgetConfigureCommand }, { "current", ComboboxCurrentCommand }, { "delete", EntryDeleteCommand }, { "get", EntryGetCommand }, { "icursor", EntryICursorCommand }, - { "identify", WidgetIdentifyCommand }, + { "identify", TtkWidgetIdentifyCommand }, { "index", EntryIndexCommand }, { "insert", EntryInsertCommand }, - { "instate", WidgetInstateCommand }, + { "instate", TtkWidgetInstateCommand }, { "selection", EntrySelectionCommand }, - { "state", WidgetStateCommand }, + { "state", TtkWidgetStateCommand }, { "set", EntrySetCommand }, { "xview", EntryXViewCommand }, {0,0} }; -WidgetSpec ComboboxWidgetSpec = +static WidgetSpec ComboboxWidgetSpec = { "TCombobox", /* className */ sizeof(Combobox), /* recordSize */ @@ -1822,8 +1822,8 @@ WidgetSpec ComboboxWidgetSpec = EntryCleanup, /* cleanupProc */ ComboboxConfigure, /* configureProc */ EntryPostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ + TtkWidgetGetLayout, /* getLayoutProc */ + TtkWidgetSize, /* sizeProc */ EntryDoLayout, /* layoutProc */ EntryDisplay /* displayProc */ }; @@ -1872,7 +1872,7 @@ static Ttk_ElementSpec TextareaElementSpec = { sizeof(TextareaElement), TextareaElementOptions, TextareaElementGeometry, - NullElementDraw + TtkNullElementDraw }; TTK_BEGIN_LAYOUT(EntryLayout) @@ -1888,10 +1888,10 @@ TTK_BEGIN_LAYOUT(ComboboxLayout) TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT -/* EntryWidget_Init -- +/* TtkEntryWidget_Init -- * Register entry-based widgets and related resources. */ -int EntryWidget_Init(Tcl_Interp *interp) +MODULE_SCOPE int TtkEntryWidget_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index c0a9b6e..958cb3e 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -1,4 +1,4 @@ -/* $Id: ttkFrame.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkFrame.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (c) 2004, Joe English * * Ttk widget set: frame and labelframe widgets @@ -47,16 +47,16 @@ static Tk_OptionSpec FrameOptionSpecs[] = Tk_Offset(Frame,frame.heightObj), -1, 0,0,GEOMETRY_CHANGED }, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static WidgetCommandSpec FrameCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, - { "instate", WidgetInstateCommand }, - { "state", WidgetStateCommand }, - { "identify", WidgetIdentifyCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "instate", TtkWidgetInstateCommand }, + { "state", TtkWidgetStateCommand }, + { "identify", TtkWidgetIdentifyCommand }, { NULL, NULL } }; @@ -146,24 +146,25 @@ static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask) Tk_GeometryRequest(framePtr->core.tkwin, width, height); } - return CoreConfigure(interp, recordPtr, mask); + return TtkCoreConfigure(interp, recordPtr, mask); } /* public */ -WidgetSpec FrameWidgetSpec = +MODULE_SCOPE WidgetSpec ttkFrameWidgetSpec; +WidgetSpec ttkFrameWidgetSpec = { "TFrame", /* className */ sizeof(Frame), /* recordSize */ FrameOptionSpecs, /* optionSpecs */ FrameCommands, /* subcommands */ - NullInitialize, /* initializeProc */ - NullCleanup, /* cleanupProc */ + TtkNullInitialize, /* initializeProc */ + TtkNullCleanup, /* cleanupProc */ FrameConfigure, /* configureProc */ - NullPostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ + TtkNullPostConfigure, /* postConfigureProc */ + TtkWidgetGetLayout, /* getLayoutProc */ FrameSize, /* sizeProc */ - WidgetDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetDoLayout, /* layoutProc */ + TtkWidgetDisplay /* displayProc */ }; /* ====================================================================== @@ -602,7 +603,8 @@ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask) } /* public */ -WidgetSpec LabelframeWidgetSpec = +MODULE_SCOPE WidgetSpec ttkLabelframeWidgetSpec; +WidgetSpec ttkLabelframeWidgetSpec = { "TLabelframe", /* className */ sizeof(Labelframe), /* recordSize */ @@ -611,10 +613,10 @@ WidgetSpec LabelframeWidgetSpec = LabelframeInitialize, /* initializeProc */ LabelframeCleanup, /* cleanupProc */ LabelframeConfigure, /* configureProc */ - NullPostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ + TtkNullPostConfigure, /* postConfigureProc */ + TtkWidgetGetLayout, /* getLayoutProc */ LabelframeSize, /* sizeProc */ LabelframeDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetDisplay /* displayProc */ }; diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 4e93235..130fcee 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -1,4 +1,4 @@ -/* $Id: ttkImage.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkImage.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Ttk widget set -- image element factory. * * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net> @@ -202,7 +202,7 @@ static Ttk_ElementSpec ImageElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, ImageElementGeometry, ImageElementDraw }; @@ -283,9 +283,10 @@ error: return TCL_ERROR; } -void Ttk_ImageInit(Tcl_Interp *interp) +MODULE_SCOPE int Ttk_ImageInit(Tcl_Interp *); +int Ttk_ImageInit(Tcl_Interp *interp) { - Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL); + return Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL); } /*EOF*/ diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index 723708f..0b3143d 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -1,4 +1,4 @@ -/* $Id: ttkInit.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkInit.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (c) 2003, Joe English * * Ttk package: initialization routine and miscellaneous utilities. @@ -13,7 +13,7 @@ * Legal values for the button -default option. * See also: enum Ttk_ButtonDefaultState in ttkTheme.h. */ -CONST char *TTKDefaultStrings[] = { +CONST char *ttkDefaultStrings[] = { "normal", "active", "disabled", NULL }; @@ -22,14 +22,14 @@ int Ttk_GetButtonDefaultStateFromObj( { *statePtr = TTK_BUTTON_DEFAULT_DISABLED; return Tcl_GetIndexFromObj(interp, objPtr, - TTKDefaultStrings, "default state", 0, statePtr); + ttkDefaultStrings, "default state", 0, statePtr); } /* * Legal values for the -compound option. * See also: enum Ttk_Compound in ttkTheme.h */ -const char *TTKCompoundStrings[] = { +const char *ttkCompoundStrings[] = { "none", "text", "image", "center", "top", "bottom", "left", "right", NULL }; @@ -39,14 +39,14 @@ int Ttk_GetCompoundFromObj( { *statePtr = TTK_COMPOUND_NONE; return Tcl_GetIndexFromObj(interp, objPtr, - TTKCompoundStrings, "compound layout", 0, statePtr); + ttkCompoundStrings, "compound layout", 0, statePtr); } /* * Legal values for the -orient option. * See also: enum TTK_ORIENT in ttkTheme.h */ -CONST char *TTKOrientStrings[] = { +CONST char *ttkOrientStrings[] = { "horizontal", "vertical", NULL }; @@ -55,7 +55,7 @@ int Ttk_GetOrientFromObj( { *resultPtr = TTK_ORIENT_HORIZONTAL; return Tcl_GetIndexFromObj(interp, objPtr, - TTKOrientStrings, "orientation", 0, resultPtr); + ttkOrientStrings, "orientation", 0, resultPtr); } /* @@ -72,7 +72,7 @@ enum { TTK_COMPAT_STATE_ACTIVE }; -/* CheckStateOption -- +/* TtkCheckStateOption -- * Handle -state compatibility option. * * NOTE: setting -state disabled / -state enabled affects the @@ -80,11 +80,11 @@ enum { * the value of the -state option. * This option is present for compatibility only. */ -void CheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr) +void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr) { int stateOption = TTK_COMPAT_STATE_NORMAL; unsigned all = TTK_STATE_DISABLED|TTK_STATE_READONLY|TTK_STATE_ACTIVE; -# define SETFLAGS(f) WidgetChangeState(corePtr, f, all^f) +# define SETFLAGS(f) TtkWidgetChangeState(corePtr, f, all^f) (void)Tcl_GetIndexFromObj(NULL,objPtr,TTKStateStrings,"",0,&stateOption); switch (stateOption) { @@ -105,14 +105,14 @@ void CheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr) # undef SETFLAGS } -/* SendVirtualEvent -- +/* TtkSendVirtualEvent -- * Send a virtual event notification to the specified target window. * Equivalent to "event generate $tgtWindow <<$eventName>>" * * Note that we use Tk_QueueWindowEvent, not Tk_HandleEvent, * so this routine does not reenter the interpreter. */ -void SendVirtualEvent(Tk_Window tgtWin, const char *eventName) +void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName) { XEvent event; @@ -127,10 +127,10 @@ void SendVirtualEvent(Tk_Window tgtWin, const char *eventName) Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } -/* EnumerateOptions, GetOptionValue -- +/* TtkEnumerateOptions, TtkGetOptionValue -- * Common factors for data accessor commands. */ -int EnumerateOptions( +int TtkEnumerateOptions( Tcl_Interp *interp, void *recordPtr, Tk_OptionSpec *specPtr, Tk_OptionTable optionTable, Tk_Window tkwin) { @@ -155,7 +155,7 @@ int EnumerateOptions( return TCL_OK; } -int GetOptionValue( +int TtkGetOptionValue( Tcl_Interp *interp, void *recordPtr, Tcl_Obj *optionName, Tk_OptionTable optionTable, Tk_Window tkwin) { @@ -175,7 +175,7 @@ int GetOptionValue( */ /* public */ -Tk_OptionSpec CoreOptionSpecs[] = +Tk_OptionSpec ttkCoreOptionSpecs[] = { {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", "", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 }, @@ -192,51 +192,51 @@ Tk_OptionSpec CoreOptionSpecs[] = * +++ Widget definitions. */ -extern WidgetSpec FrameWidgetSpec; -extern WidgetSpec LabelframeWidgetSpec; -extern WidgetSpec LabelWidgetSpec; -extern WidgetSpec ButtonWidgetSpec; -extern WidgetSpec CheckbuttonWidgetSpec; -extern WidgetSpec RadiobuttonWidgetSpec; -extern WidgetSpec MenubuttonWidgetSpec; -extern WidgetSpec ScrollbarWidgetSpec; -extern WidgetSpec ScaleWidgetSpec; -extern WidgetSpec SeparatorWidgetSpec; -extern WidgetSpec SizegripWidgetSpec; - -extern void Progressbar_Init(Tcl_Interp *); -extern void Notebook_Init(Tcl_Interp *); -extern void EntryWidget_Init(Tcl_Interp *); -extern void Treeview_Init(Tcl_Interp *); -extern void Paned_Init(Tcl_Interp *); - +extern WidgetSpec ttkFrameWidgetSpec; +extern WidgetSpec ttkLabelframeWidgetSpec; +extern WidgetSpec ttkLabelWidgetSpec; +extern WidgetSpec ttkButtonWidgetSpec; +extern WidgetSpec ttkCheckbuttonWidgetSpec; +extern WidgetSpec ttkRadiobuttonWidgetSpec; +extern WidgetSpec ttkMenubuttonWidgetSpec; +extern WidgetSpec ttkScrollbarWidgetSpec; +extern WidgetSpec ttkScaleWidgetSpec; +extern WidgetSpec ttkSeparatorWidgetSpec; +extern WidgetSpec ttkSizegripWidgetSpec; + +extern int TtkProgressbar_Init(Tcl_Interp *); +extern int TtkNotebook_Init(Tcl_Interp *); +extern int TtkEntryWidget_Init(Tcl_Interp *); +#ifdef TTK_TREEVIEW_WIDGET +extern int TtkTreeview_Init(Tcl_Interp *); +#endif +extern int TtkPaned_Init(Tcl_Interp *); #ifdef TTK_SQUARE_WIDGET -extern void SquareWidget_Init(Tcl_Interp *); +extern int TtkSquareWidget_Init(Tcl_Interp *); #endif static void RegisterWidgets(Tcl_Interp *interp) { - RegisterWidget(interp, "::ttk::frame", &FrameWidgetSpec); - RegisterWidget(interp, "::ttk::labelframe", &LabelframeWidgetSpec); - RegisterWidget(interp, "::ttk::label", &LabelWidgetSpec); - RegisterWidget(interp, "::ttk::button", &ButtonWidgetSpec); - RegisterWidget(interp, "::ttk::checkbutton", &CheckbuttonWidgetSpec); - RegisterWidget(interp, "::ttk::radiobutton", &RadiobuttonWidgetSpec); - RegisterWidget(interp, "::ttk::menubutton", &MenubuttonWidgetSpec); - RegisterWidget(interp, "::ttk::scrollbar", &ScrollbarWidgetSpec); - RegisterWidget(interp, "::ttk::scale", &ScaleWidgetSpec); - RegisterWidget(interp, "::ttk::separator", &SeparatorWidgetSpec); - RegisterWidget(interp, "::ttk::sizegrip", &SizegripWidgetSpec); - Notebook_Init(interp); - EntryWidget_Init(interp); - Progressbar_Init(interp); - Paned_Init(interp); + RegisterWidget(interp, "::ttk::frame", &ttkFrameWidgetSpec); + RegisterWidget(interp, "::ttk::labelframe", &ttkLabelframeWidgetSpec); + RegisterWidget(interp, "::ttk::label", &ttkLabelWidgetSpec); + RegisterWidget(interp, "::ttk::button", &ttkButtonWidgetSpec); + RegisterWidget(interp, "::ttk::checkbutton", &ttkCheckbuttonWidgetSpec); + RegisterWidget(interp, "::ttk::radiobutton", &ttkRadiobuttonWidgetSpec); + RegisterWidget(interp, "::ttk::menubutton", &ttkMenubuttonWidgetSpec); + RegisterWidget(interp, "::ttk::scrollbar", &ttkScrollbarWidgetSpec); + RegisterWidget(interp, "::ttk::scale", &ttkScaleWidgetSpec); + RegisterWidget(interp, "::ttk::separator", &ttkSeparatorWidgetSpec); + RegisterWidget(interp, "::ttk::sizegrip", &ttkSizegripWidgetSpec); + TtkNotebook_Init(interp); + TtkEntryWidget_Init(interp); + TtkProgressbar_Init(interp); + TtkPaned_Init(interp); #ifdef TTK_TREEVIEW_WIDGET - Treeview_Init(interp); + TtkTreeview_Init(interp); #endif - #ifdef TTK_SQUARE_WIDGET - SquareWidget_Init(interp); + TtkSquareWidget_Init(interp); #endif } @@ -244,18 +244,18 @@ static void RegisterWidgets(Tcl_Interp *interp) * +++ Built-in themes. */ -extern int AltTheme_Init(Tcl_Interp *); -extern int ClassicTheme_Init(Tcl_Interp *); -extern int ClamTheme_Init(Tcl_Interp *); +extern int TtkAltTheme_Init(Tcl_Interp *); +extern int TtkClassicTheme_Init(Tcl_Interp *); +extern int TtkClamTheme_Init(Tcl_Interp *); extern int Ttk_ImageInit(Tcl_Interp *); static void RegisterThemes(Tcl_Interp *interp) { Ttk_ImageInit(interp); /* not really a theme... */ - AltTheme_Init(interp); - ClassicTheme_Init(interp); - ClamTheme_Init(interp); + TtkAltTheme_Init(interp); + TtkClassicTheme_Init(interp); + TtkClamTheme_Init(interp); } /* @@ -264,7 +264,7 @@ static void RegisterThemes(Tcl_Interp *interp) extern TtkStubs ttkStubs; -int DLLEXPORT +MODULE_SCOPE int Ttk_Init(Tcl_Interp *interp) { /* @@ -273,7 +273,7 @@ Ttk_Init(Tcl_Interp *interp) */ Ttk_StylePkgInit(interp); - RegisterElements(interp); + TtkRegisterElements(interp); RegisterWidgets(interp); RegisterThemes(interp); diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index e2ccc6f..4d90722 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -1,4 +1,4 @@ -/* $Id: ttkLabel.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkLabel.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * Ttk widget set: text, image, and label elements. * @@ -209,7 +209,8 @@ static void TextElementDraw( } } -/*public*/ Ttk_ElementSpec TextElementSpec = +MODULE_SCOPE Ttk_ElementSpec ttkTextElementSpec; +/*public*/ Ttk_ElementSpec ttkTextElementSpec = { TK_STYLE_VERSION_2, sizeof(TextElement), @@ -239,7 +240,8 @@ static void ImageTextElementDraw( TextCleanup(text); } -/*public*/ Ttk_ElementSpec ImageTextElementSpec = +MODULE_SCOPE Ttk_ElementSpec ttkImageTextElementSpec; +/*public*/ Ttk_ElementSpec ttkImageTextElementSpec = { TK_STYLE_VERSION_2, sizeof(TextElement), @@ -432,7 +434,8 @@ static void ImageElementDraw( } } -/*public*/ Ttk_ElementSpec ImageElementSpec = +MODULE_SCOPE Ttk_ElementSpec ttkImageElementSpec; +/*public*/ Ttk_ElementSpec ttkImageElementSpec = { TK_STYLE_VERSION_2, sizeof(ImageElement), @@ -729,7 +732,8 @@ static void LabelElementDraw( LabelCleanup(l); } -/*public*/ Ttk_ElementSpec LabelElementSpec = +MODULE_SCOPE Ttk_ElementSpec ttkLabelElementSpec; +/*public*/ Ttk_ElementSpec ttkLabelElementSpec = { TK_STYLE_VERSION_2, sizeof(LabelElement), diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index 54ebc34..c1b394a 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -1,11 +1,11 @@ /* - * layout.c -- + * ttkLayout.c -- * * Generic layout processing. * * Copyright (c) 2003 Joe English. Freely redistributable. * - * $Id: ttkLayout.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkLayout.c,v 1.2 2006/11/03 03:06:22 das Exp $ */ #include <string.h> diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h index d046cd7..0e22ce0 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -1,4 +1,4 @@ -/* $Id: ttkManager.h,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkManager.h,v 1.2 2006/11/03 03:06:22 das Exp $ * * Copyright (c) 2005, Joe English. Freely redistributable. * @@ -7,8 +7,8 @@ * TODO: opacify data structures. */ -#ifndef TTK_MANAGER_H -#define TTK_MANAGER_H 1 +#ifndef _TTKMANAGER +#define _TTKMANAGER typedef struct TtkManager_ Ttk_Manager; /* forward */ typedef struct TtkSlave_ Ttk_Slave; /* forward */ @@ -44,8 +44,8 @@ typedef struct { /* Manager hooks */ /* * Default implementations for Tk_GeomMgr hooks: */ -extern void Ttk_GeometryRequestProc(ClientData, Tk_Window slave); -extern void Ttk_LostSlaveProc(ClientData, Tk_Window slave); +MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window slave); +MODULE_SCOPE void Ttk_LostSlaveProc(ClientData, Tk_Window slave); struct TtkSlave_ { @@ -69,54 +69,54 @@ struct TtkManager_ /* * Public API: */ -extern Ttk_Manager *Ttk_CreateManager( +MODULE_SCOPE Ttk_Manager *Ttk_CreateManager( Ttk_ManagerSpec *, void *managerData, Tk_Window masterWindow); -extern void Ttk_DeleteManager(Ttk_Manager *); +MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *); -extern int Ttk_AddSlave( +MODULE_SCOPE int Ttk_AddSlave( Tcl_Interp *, Ttk_Manager *, Tk_Window, int position, int objc, Tcl_Obj *CONST objv[]); -extern void Ttk_ForgetSlave(Ttk_Manager *, int slaveIndex); +MODULE_SCOPE void Ttk_ForgetSlave(Ttk_Manager *, int slaveIndex); -extern int Ttk_ConfigureSlave( +MODULE_SCOPE int Ttk_ConfigureSlave( Tcl_Interp *interp, Ttk_Manager *, Ttk_Slave *, int objc, Tcl_Obj *CONST objv[]); -extern void Ttk_ReorderSlave(Ttk_Manager *, int fromIndex, int toIndex); +MODULE_SCOPE void Ttk_ReorderSlave(Ttk_Manager *, int fromIndex, int toIndex); /* Rearrange slave positions */ -extern void Ttk_PlaceSlave( +MODULE_SCOPE void Ttk_PlaceSlave( Ttk_Manager *, int slaveIndex, int x, int y, int width, int height); /* Position and map the slave */ -extern void Ttk_UnmapSlave(Ttk_Manager *, int slaveIndex); +MODULE_SCOPE void Ttk_UnmapSlave(Ttk_Manager *, int slaveIndex); /* Unmap the slave */ -extern void Ttk_ManagerSizeChanged(Ttk_Manager *); -extern void Ttk_ManagerLayoutChanged(Ttk_Manager *); +MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *); +MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); /* Notify manager that size (resp. layout) needs to be recomputed */ /* Utilities: */ -extern int Ttk_SlaveIndex(Ttk_Manager *, Tk_Window); +MODULE_SCOPE int Ttk_SlaveIndex(Ttk_Manager *, Tk_Window); /* Returns: index in slave array of specified window, -1 if not found */ -extern Ttk_Slave *Ttk_GetSlaveFromObj( +MODULE_SCOPE Ttk_Slave *Ttk_GetSlaveFromObj( Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, int *indexPtr); /* Accessor functions: */ -extern int Ttk_NumberSlaves(Ttk_Manager *); +MODULE_SCOPE int Ttk_NumberSlaves(Ttk_Manager *); /* Returns: number of managed slaves */ -extern void *Ttk_SlaveData(Ttk_Manager *, int slaveIndex); +MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, int slaveIndex); /* Returns: private data associated with slave */ -extern Tk_Window Ttk_SlaveWindow(Ttk_Manager *, int slaveIndex); +MODULE_SCOPE Tk_Window Ttk_SlaveWindow(Ttk_Manager *, int slaveIndex); /* Returns: slave window */ -extern int Ttk_Maintainable(Tcl_Interp *, Tk_Window slave, Tk_Window master); +MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window slave, Tk_Window master); /* Returns: 1 if master can manage slave; 0 otherwise leaving error msg */ -#endif +#endif /* _TTKMANAGER */ diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index e8b6640..c801bfe 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -1,4 +1,4 @@ -/* $Id: ttkNotebook.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkNotebook.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (c) 2004, Joe English * * NOTE-ACTIVE: activeTabIndex is not always correct (it's @@ -73,7 +73,7 @@ static Tk_OptionSpec TabOptionSpecs[] = Tk_Offset(Tab,imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", "none", Tk_Offset(Tab,compoundObj), -1, - 0,(ClientData)TTKCompoundStrings,GEOMETRY_CHANGED }, + 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", Tk_Offset(Tab,underlineObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_END} @@ -128,7 +128,7 @@ static Tk_OptionSpec NotebookOptionSpecs[] = Tk_Offset(Notebook,notebook.paddingObj),-1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* Notebook style options: @@ -546,7 +546,7 @@ static void SelectTab(Notebook *nb, int index) nb->notebook.currentIndex = index; TtkRedisplayWidget(&nb->core); - SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); + TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); } /* NextTab -- @@ -599,7 +599,7 @@ static void SelectNearestTab(Notebook *nb) */ if (nb->notebook.currentIndex >= 0) { Ttk_UnmapSlave(nb->notebook.mgr, nb->notebook.currentIndex); - SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); + TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); } nb->notebook.currentIndex = -1; } @@ -638,7 +638,7 @@ static int TabConfigured( Tk_Window tkwin = mgr->masterWindow; /* Check options: - * @@@ TODO: validate -image option with GetImageList() + * @@@ TODO: validate -image option with TtkGetImageList() */ if (Ttk_GetStickyFromObj(interp, tab->stickyObj, &sticky) != TCL_OK) { return TCL_ERROR; @@ -1054,10 +1054,10 @@ static int NotebookTabCommand( tab = Ttk_SlaveData(mgr, index); if (objc == 3) { - return EnumerateOptions(interp, tab, + return TtkEnumerateOptions(interp, tab, PaneOptionSpecs, nb->notebook.paneOptionTable, nb->core.tkwin); } else if (objc == 4) { - return GetOptionValue(interp, tab, objv[3], + return TtkGetOptionValue(interp, tab, objv[3], nb->notebook.paneOptionTable, nb->core.tkwin); } /* else */ @@ -1081,15 +1081,15 @@ static int NotebookTabCommand( static WidgetCommandSpec NotebookCommands[] = { { "add", NotebookAddCommand }, - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, { "forget", NotebookForgetCommand }, { "identify", NotebookIdentifyCommand }, { "index", NotebookIndexCommand }, { "insert", NotebookInsertCommand }, - { "instate", WidgetInstateCommand }, + { "instate", TtkWidgetInstateCommand }, { "select", NotebookSelectCommand }, - { "state", WidgetStateCommand }, + { "state", TtkWidgetStateCommand }, { "tab", NotebookTabCommand }, { "tabs", NotebookTabsCommand }, { 0,0 } @@ -1150,7 +1150,7 @@ static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) } } - return CoreConfigure(interp, clientData, mask); + return TtkCoreConfigure(interp, clientData, mask); } /* NotebookGetLayout -- @@ -1160,7 +1160,7 @@ static Ttk_Layout NotebookGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Notebook *nb = recordPtr; - Ttk_Layout notebookLayout = WidgetGetLayout(interp, theme, recordPtr); + Ttk_Layout notebookLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout tabLayout; if (!notebookLayout) { @@ -1231,7 +1231,7 @@ static WidgetSpec NotebookWidgetSpec = NotebookInitialize, /* initializeProc */ NotebookCleanup, /* cleanupProc */ NotebookConfigure, /* configureProc */ - NullPostConfigure, /* postConfigureProc */ + TtkNullPostConfigure, /* postConfigureProc */ NotebookGetLayout, /* getLayoutProc */ NotebookSize, /* geometryProc */ NotebookDoLayout, /* layoutProc */ @@ -1249,7 +1249,7 @@ TTK_BEGIN_LAYOUT(TabLayout) TTK_NODE("Notebook.label", TTK_PACK_TOP)))) TTK_END_LAYOUT -int Notebook_Init(Tcl_Interp *interp) +MODULE_SCOPE int TtkNotebook_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 8b55e50..7fe1cc8 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -1,4 +1,4 @@ -/* $Id: ttkPanedwindow.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkPanedwindow.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * Copyright (c) 2005, Joe English. Freely redistributable. * @@ -78,9 +78,9 @@ typedef struct { static Tk_OptionSpec PanedOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", Tk_Offset(Paned,paned.orientObj), Tk_Offset(Paned,paned.orient), - 0,(ClientData)TTKOrientStrings,READONLY_OPTION|STYLE_CHANGED }, + 0,(ClientData)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED }, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ @@ -406,7 +406,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr) if ( eventPtr->type == LeaveNotify && eventPtr->xcrossing.detail == NotifyInferior) { - SendVirtualEvent(corePtr->tkwin, "EnteredChild"); + TtkSendVirtualEvent(corePtr->tkwin, "EnteredChild"); } } @@ -445,7 +445,7 @@ static Ttk_Layout PanedGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { Paned *pw = recordPtr; - Ttk_Layout panedLayout = WidgetGetLayout(interp, themePtr, recordPtr); + Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; const char *layoutName = horizontal ? ".Vertical.Sash" : ".Horizontal.Sash"; Ttk_Layout sashLayout = Ttk_CreateSublayout(interp, themePtr, panedLayout, @@ -483,7 +483,7 @@ static void PanedDisplay(void *recordPtr, Drawable d) int nPanes = Ttk_NumberSlaves(pw->paned.mgr); int i; - WidgetDisplay(recordPtr, d); + TtkWidgetDisplay(recordPtr, d); /* Draw sashes: */ @@ -652,10 +652,10 @@ static int PanedPaneCommand( switch (objc) { case 3: - return EnumerateOptions(interp, slave->slaveData, PaneOptionSpecs, + return TtkEnumerateOptions(interp, slave->slaveData, PaneOptionSpecs, pw->paned.mgr->slaveOptionTable, slave->slaveWindow); case 4: - return GetOptionValue(interp, slave->slaveData,objv[3], + return TtkGetOptionValue(interp, slave->slaveData,objv[3], pw->paned.mgr->slaveOptionTable, slave->slaveWindow); default: return Ttk_ConfigureSlave( @@ -715,15 +715,15 @@ static int PanedSashposCommand( static WidgetCommandSpec PanedCommands[] = { { "add", PanedAddCommand }, - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, { "forget", PanedForgetCommand }, { "identify", PanedIdentifyCommand }, { "insert", PanedInsertCommand }, - { "instate", WidgetInstateCommand }, + { "instate", TtkWidgetInstateCommand }, { "pane", PanedPaneCommand }, { "sashpos", PanedSashposCommand }, - { "state", WidgetStateCommand }, + { "state", TtkWidgetStateCommand }, { 0,0 } }; @@ -739,11 +739,11 @@ static WidgetSpec PanedWidgetSpec = PanedCommands, /* subcommands */ PanedInitialize, /* initializeProc */ PanedCleanup, /* cleanupProc */ - CoreConfigure, /* configureProc */ - NullPostConfigure, /* postConfigureProc */ + TtkCoreConfigure, /* configureProc */ + TtkNullPostConfigure, /* postConfigureProc */ PanedGetLayout, /* getLayoutProc */ PanedSize, /* sizeProc */ - WidgetDoLayout, /* layoutProc */ + TtkWidgetDoLayout, /* layoutProc */ PanedDisplay /* displayProc */ }; @@ -776,7 +776,7 @@ static Ttk_ElementSpec SashElementSpec = { sizeof(SashElement), SashElementOptions, SashElementSize, - NullElementDraw + TtkNullElementDraw }; TTK_BEGIN_LAYOUT(PanedLayout) @@ -794,7 +794,7 @@ TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Registration routine. */ -void Paned_Init(Tcl_Interp *interp) +MODULE_SCOPE int TtkPaned_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); RegisterWidget(interp, "ttk::panedwindow", &PanedWidgetSpec); @@ -805,5 +805,7 @@ void Paned_Init(Tcl_Interp *interp) Ttk_RegisterLayout(themePtr, "TPanedwindow", PanedLayout); Ttk_RegisterLayout(themePtr, "Horizontal.Sash", HorizontalSashLayout); Ttk_RegisterLayout(themePtr, "Vertical.Sash", VerticalSashLayout); + + return TCL_OK; } diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index bb1bc0c..45b4415 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -1,4 +1,4 @@ -/* $Id: ttkProgress.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkProgress.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham * @@ -49,7 +49,7 @@ static Tk_OptionSpec ProgressbarOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Progressbar,progress.orientObj), -1, - 0, (ClientData)TTKOrientStrings, STYLE_CHANGED }, + 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_PROGRESSBAR_LENGTH, Tk_Offset(Progressbar,progress.lengthObj), -1, 0, 0, GEOMETRY_CHANGED }, @@ -69,7 +69,7 @@ static Tk_OptionSpec ProgressbarOptionSpecs[] = {TK_OPTION_INT, "-phase", "phase", "Phase", "0", Tk_Offset(Progressbar,progress.phaseObj), -1, 0, 0, 0 }, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ @@ -162,18 +162,18 @@ static void VariableChanged(void *recordPtr, const char *value) if (!value) { /* Linked variable is unset -- disable widget */ - WidgetChangeState(&pb->core, TTK_STATE_DISABLED, 0); + TtkWidgetChangeState(&pb->core, TTK_STATE_DISABLED, 0); return; } - WidgetChangeState(&pb->core, 0, TTK_STATE_DISABLED); + TtkWidgetChangeState(&pb->core, 0, TTK_STATE_DISABLED); newValue = Tcl_NewStringObj(value, -1); Tcl_IncrRefCount(newValue); if (Tcl_GetDoubleFromObj(NULL, newValue, &scratch) != TCL_OK) { - WidgetChangeState(&pb->core, TTK_STATE_INVALID, 0); + TtkWidgetChangeState(&pb->core, TTK_STATE_INVALID, 0); return; } - WidgetChangeState(&pb->core, 0, TTK_STATE_INVALID); + TtkWidgetChangeState(&pb->core, 0, TTK_STATE_INVALID); Tcl_DecrRefCount(pb->progress.valueObj); pb->progress.valueObj = newValue; @@ -218,7 +218,7 @@ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask) if (!vt) return TCL_ERROR; } - if (CoreConfigure(interp, recordPtr, mask) != TCL_OK) { + if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } @@ -269,7 +269,7 @@ static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr) Progressbar *pb = recordPtr; int length = 100, orient = TTK_ORIENT_HORIZONTAL; - WidgetSize(recordPtr, widthPtr, heightPtr); + TtkWidgetSize(recordPtr, widthPtr, heightPtr); /* Override requested width (height) based on -length and -orient */ @@ -372,7 +372,7 @@ static Ttk_Layout ProgressbarGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Progressbar *pb = recordPtr; - Ttk_Layout layout = WidgetGetOrientedLayout( + Ttk_Layout layout = TtkWidgetGetOrientedLayout( interp, theme, recordPtr, pb->progress.orientObj); /* @@ -488,12 +488,12 @@ static int ProgressbarStopCommand( static WidgetCommandSpec ProgressbarCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, - { "identify", WidgetIdentifyCommand }, - { "instate", WidgetInstateCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "identify", TtkWidgetIdentifyCommand }, + { "instate", TtkWidgetInstateCommand }, { "start", ProgressbarStartCommand }, - { "state", WidgetStateCommand }, + { "state", TtkWidgetStateCommand }, { "step", ProgressbarStepCommand }, { "stop", ProgressbarStopCommand }, { NULL, NULL } @@ -515,7 +515,7 @@ static WidgetSpec ProgressbarWidgetSpec = ProgressbarGetLayout, /* getLayoutProc */ ProgressbarSize, /* sizeProc */ ProgressbarDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetDisplay /* displayProc */ }; /* @@ -534,7 +534,7 @@ TTK_END_LAYOUT /* * Initialization: */ -int Progressbar_Init(Tcl_Interp *interp) +MODULE_SCOPE int TtkProgressbar_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 346183a..56169d0 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -1,4 +1,4 @@ -/* $Id: ttkScale.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkScale.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net> * * Ttk widget set: scale widget. @@ -56,7 +56,7 @@ static Tk_OptionSpec ScaleOptionSpecs[] = {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Scale,scale.orientObj), Tk_Offset(Scale,scale.orient), 0, - (ClientData)TTKOrientStrings, STYLE_CHANGED }, + (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0}, @@ -68,7 +68,7 @@ static Tk_OptionSpec ScaleOptionSpecs[] = DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0, GEOMETRY_CHANGED}, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static XPoint ValueToPoint(Scale *scalePtr, double value); @@ -86,13 +86,13 @@ static void ScaleVariableChanged(void *recordPtr, const char *value) double v; if (value == NULL || Tcl_GetDouble(0, value, &v) != TCL_OK) { - WidgetChangeState(&scale->core, TTK_STATE_INVALID, 0); + TtkWidgetChangeState(&scale->core, TTK_STATE_INVALID, 0); } else { Tcl_Obj *valueObj = Tcl_NewDoubleObj(v); Tcl_IncrRefCount(valueObj); Tcl_DecrRefCount(scale->scale.valueObj); scale->scale.valueObj = valueObj; - WidgetChangeState(&scale->core, 0, TTK_STATE_INVALID); + TtkWidgetChangeState(&scale->core, 0, TTK_STATE_INVALID); } TtkRedisplayWidget(&scale->core); } @@ -104,7 +104,7 @@ static int ScaleInitialize(Tcl_Interp *interp, void *recordPtr) { Scale *scalePtr = recordPtr; - TrackElementState(&scalePtr->core); + TtkTrackElementState(&scalePtr->core); return TCL_OK; } @@ -132,7 +132,7 @@ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask) if (!vt) return TCL_ERROR; } - if (CoreConfigure(interp, recordPtr, mask) != TCL_OK) { + if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } @@ -179,7 +179,7 @@ static Ttk_Layout ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Scale *scalePtr = recordPtr; - return WidgetGetOrientedLayout( + return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, scalePtr->scale.orientObj); } @@ -474,18 +474,19 @@ ValueToPoint(Scale *scalePtr, double value) static WidgetCommandSpec ScaleCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, - { "state", WidgetStateCommand }, - { "instate", WidgetInstateCommand }, - { "identify", WidgetIdentifyCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "state", TtkWidgetStateCommand }, + { "instate", TtkWidgetInstateCommand }, + { "identify", TtkWidgetIdentifyCommand }, { "set", ScaleSetCommand }, { "get", ScaleGetCommand }, { "coords", ScaleCoordsCommand }, { 0, 0 } }; -WidgetSpec ScaleWidgetSpec = +MODULE_SCOPE WidgetSpec ttkScaleWidgetSpec; +WidgetSpec ttkScaleWidgetSpec = { "TScale", /* Class name */ sizeof(Scale), /* record size */ @@ -498,6 +499,6 @@ WidgetSpec ScaleWidgetSpec = ScaleGetLayout, /* getLayoutProc */ ScaleSize, /* sizeProc */ ScaleDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetDisplay /* displayProc */ }; diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index 32c9477..cc40a66 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -1,4 +1,4 @@ -/* $Id: ttkScroll.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkScroll.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * Copyright 2004, Joe English * @@ -17,22 +17,22 @@ * * 1. User adjusts scrollbar, scrollbar widget calls its -command * 2. Scrollbar -command invokes the scrollee [xy]view widget method - * 3. ScrollviewCommand calls ScrollTo(), which updates + * 3. TtkScrollviewCommand calls TtkScrollTo(), which updates * 'first' and schedules a redisplay. * 4. Once the scrollee knows 'total' and 'last' (typically in - * the LayoutProc), call Scrolled(h,first,last,total) to + * the LayoutProc), call TtkScrolled(h,first,last,total) to * synchronize the scrollbar. * 5. The scrollee -[xy]scrollcommand is called (in an idle callback) * 6. Which calls the scrollbar 'set' method and redisplays the scrollbar. * * If the scrollee has internal scrolling (e.g., a 'see' method), - * it should ScrollTo() directly (step 2). + * it should TtkScrollTo() directly (step 2). * - * If the widget value changes, it should call Scrolled() (step 4). + * If the widget value changes, it should call TtkScrolled() (step 4). * (This usually happens automatically when the widget is redisplayed). * * If the scrollee's -[xy]scrollcommand changes, it should call - * ScrollbarUpdateRequired, which will invoke step (5) (@@@ Fix this) + * TtkScrollbarUpdateRequired, which will invoke step (5) (@@@ Fix this) */ #include <tk.h> @@ -51,10 +51,10 @@ struct ScrollHandleRec Scrollable *scrollPtr; }; -/* CreateScrollHandle -- +/* TtkCreateScrollHandle -- * Initialize scroll handle. */ -ScrollHandle CreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr) +ScrollHandle TtkCreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr) { ScrollHandle h = (ScrollHandle)ckalloc(sizeof(*h)); @@ -68,7 +68,7 @@ ScrollHandle CreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr) return h; } -void FreeScrollHandle(ScrollHandle h) +void TtkFreeScrollHandle(ScrollHandle h) { Tcl_EventuallyFree((ClientData)h, TCL_DYNAMIC); } @@ -137,10 +137,10 @@ static void UpdateScrollbarBG(ClientData clientData) Tcl_Release(clientData); } -/* Scrolled -- +/* TtkScrolled -- * Update scroll info, schedule scrollbar update. */ -void Scrolled(ScrollHandle h, int first, int last, int total) +void TtkScrolled(ScrollHandle h, int first, int last, int total) { Scrollable *s = h->scrollPtr; @@ -167,18 +167,18 @@ void Scrolled(ScrollHandle h, int first, int last, int total) } } -/* ScrollbarUpdateRequired -- - * Force a scrollbar update at the next call to Scrolled(), +/* TtkScrollbarUpdateRequired -- + * Force a scrollbar update at the next call to TtkScrolled(), * even if scroll parameters haven't changed (e.g., if * -yscrollcommand has changed). */ -void ScrollbarUpdateRequired(ScrollHandle h) +void TtkScrollbarUpdateRequired(ScrollHandle h) { h->flags |= SCROLL_UPDATE_REQUIRED; } -/* ScrollviewCommand -- +/* TtkScrollviewCommand -- * Widget [xy]view command implementation. * * $w [xy]view -- return current view region @@ -186,7 +186,7 @@ void ScrollbarUpdateRequired(ScrollHandle h) * $w [xy]view moveto $fraction * $w [xy]view scroll $number $what -- scrollbar interface */ -int ScrollviewCommand( +int TtkScrollviewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle h) { Scrollable *s = h->scrollPtr; @@ -224,12 +224,12 @@ int ScrollviewCommand( } } - ScrollTo(h, newFirst); + TtkScrollTo(h, newFirst); return TCL_OK; } -void ScrollTo(ScrollHandle h, int newFirst) +void TtkScrollTo(ScrollHandle h, int newFirst) { Scrollable *s = h->scrollPtr; diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 1431c46..4558a4c 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -1,4 +1,4 @@ -/* $Id: ttkScrollbar.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkScrollbar.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (c) 2003, Joe English * Ttk widget set: scrollbar widget implementation. */ @@ -40,9 +40,9 @@ static Tk_OptionSpec ScrollbarOptionSpecs[] = {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", Tk_Offset(Scrollbar,scrollbar.orientObj), Tk_Offset(Scrollbar,scrollbar.orient), - 0,(ClientData)TTKOrientStrings,STYLE_CHANGED }, + 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ @@ -56,7 +56,7 @@ ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) sb->scrollbar.first = 0.0; sb->scrollbar.last = 1.0; - TrackElementState(&sb->core); + TtkTrackElementState(&sb->core); return TCL_OK; } @@ -65,7 +65,7 @@ static Ttk_Layout ScrollbarGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Scrollbar *sb = recordPtr; - return WidgetGetOrientedLayout( + return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, sb->scrollbar.orientObj); } @@ -282,35 +282,36 @@ ScrollbarFractionCommand( static WidgetCommandSpec ScrollbarCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, { "delta", ScrollbarDeltaCommand }, { "fraction", ScrollbarFractionCommand }, { "get", ScrollbarGetCommand }, - { "identify", WidgetIdentifyCommand }, - { "instate", WidgetInstateCommand }, + { "identify", TtkWidgetIdentifyCommand }, + { "instate", TtkWidgetInstateCommand }, { "set", ScrollbarSetCommand }, - { "state", WidgetStateCommand }, + { "state", TtkWidgetStateCommand }, { 0,0 } }; /*------------------------------------------------------------------------ * +++ Widget specification. */ -WidgetSpec ScrollbarWidgetSpec = +MODULE_SCOPE WidgetSpec ttkScrollbarWidgetSpec; +WidgetSpec ttkScrollbarWidgetSpec = { "TScrollbar", /* className */ sizeof(Scrollbar), /* recordSize */ ScrollbarOptionSpecs, /* optionSpecs */ ScrollbarCommands, /* subcommands */ ScrollbarInitialize, /* initializeProc */ - NullCleanup, /* cleanupProc */ - CoreConfigure, /* configureProc */ - NullPostConfigure, /* postConfigureProc */ + TtkNullCleanup, /* cleanupProc */ + TtkCoreConfigure, /* configureProc */ + TtkNullPostConfigure, /* postConfigureProc */ ScrollbarGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ + TtkWidgetSize, /* sizeProc */ ScrollbarDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetDisplay /* displayProc */ }; /*EOF*/ diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c index 7914928..feb8763 100644 --- a/generic/ttk/ttkSeparator.c +++ b/generic/ttk/ttkSeparator.c @@ -1,4 +1,4 @@ -/* $Id: ttkSeparator.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkSeparator.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * Copyright (c) 2004, Joe English * @@ -29,9 +29,9 @@ static Tk_OptionSpec SeparatorOptionSpecs[] = {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Separator,separator.orientObj), Tk_Offset(Separator,separator.orient), - 0,(ClientData)TTKOrientStrings,STYLE_CHANGED }, + 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* @@ -42,7 +42,7 @@ static Ttk_Layout SeparatorGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Separator *sep = recordPtr; - return WidgetGetOrientedLayout( + return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, sep->separator.orientObj); } @@ -51,31 +51,32 @@ static Ttk_Layout SeparatorGetLayout( */ static WidgetCommandSpec SeparatorCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, - { "identify", WidgetIdentifyCommand }, - { "instate", WidgetInstateCommand }, - { "state", WidgetStateCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "identify", TtkWidgetIdentifyCommand }, + { "instate", TtkWidgetInstateCommand }, + { "state", TtkWidgetStateCommand }, { NULL, NULL } }; /* * Widget specification: */ -WidgetSpec SeparatorWidgetSpec = +MODULE_SCOPE WidgetSpec ttkSeparatorWidgetSpec; +WidgetSpec ttkSeparatorWidgetSpec = { "TSeparator", /* className */ sizeof(Separator), /* recordSize */ SeparatorOptionSpecs, /* optionSpecs */ SeparatorCommands, /* subcommands */ - NullInitialize, /* initializeProc */ - NullCleanup, /* cleanupProc */ - CoreConfigure, /* configureProc */ - NullPostConfigure, /* postConfigureProc */ + TtkNullInitialize, /* initializeProc */ + TtkNullCleanup, /* cleanupProc */ + TtkCoreConfigure, /* configureProc */ + TtkNullPostConfigure, /* postConfigureProc */ SeparatorGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ - WidgetDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetSize, /* sizeProc */ + TtkWidgetDoLayout, /* layoutProc */ + TtkWidgetDisplay /* displayProc */ }; /* +++ Sizegrip widget: @@ -84,28 +85,29 @@ WidgetSpec SeparatorWidgetSpec = static WidgetCommandSpec SizegripCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, - { "identify", WidgetIdentifyCommand }, - { "instate", WidgetInstateCommand }, - { "state", WidgetStateCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "identify", TtkWidgetIdentifyCommand }, + { "instate", TtkWidgetInstateCommand }, + { "state", TtkWidgetStateCommand }, { NULL, NULL } }; -WidgetSpec SizegripWidgetSpec = +MODULE_SCOPE WidgetSpec ttkSizegripWidgetSpec; +WidgetSpec ttkSizegripWidgetSpec = { "TSizegrip", /* className */ sizeof(WidgetCore), /* recordSize */ - CoreOptionSpecs, /* optionSpecs */ + ttkCoreOptionSpecs, /* optionSpecs */ SizegripCommands, /* subcommands */ - NullInitialize, /* initializeProc */ - NullCleanup, /* cleanupProc */ - CoreConfigure, /* configureProc */ - NullPostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ - WidgetDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkNullInitialize, /* initializeProc */ + TtkNullCleanup, /* cleanupProc */ + TtkCoreConfigure, /* configureProc */ + TtkNullPostConfigure, /* postConfigureProc */ + TtkWidgetGetLayout, /* getLayoutProc */ + TtkWidgetSize, /* sizeProc */ + TtkWidgetDoLayout, /* layoutProc */ + TtkWidgetDisplay /* displayProc */ }; /*EOF*/ diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c index eec4776..e9c9bcb 100644 --- a/generic/ttk/ttkSquare.c +++ b/generic/ttk/ttkSquare.c @@ -2,13 +2,15 @@ * * Minimal sample ttk widget. * - * $Id: ttkSquare.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkSquare.c,v 1.2 2006/11/03 03:06:22 das Exp $ */ #include <tk.h> #include "ttkTheme.h" #include "ttkWidget.h" +#ifdef TTK_SQUARE_WIDGET + #ifndef DEFAULT_BORDERWIDTH #define DEFAULT_BORDERWIDTH "2" #endif @@ -76,7 +78,7 @@ static Tk_OptionSpec SquareOptionSpecs[] = {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0}, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* @@ -131,11 +133,11 @@ SquareDoLayout(void *clientData) static WidgetCommandSpec SquareCommands[] = { - { "configure", WidgetConfigureCommand }, - { "cget", WidgetCgetCommand }, - { "identify", WidgetIdentifyCommand }, - { "instate", WidgetInstateCommand }, - { "state", WidgetStateCommand }, + { "configure", TtkWidgetConfigureCommand }, + { "cget", TtkWidgetCgetCommand }, + { "identify", TtkWidgetIdentifyCommand }, + { "instate", TtkWidgetInstateCommand }, + { "state", TtkWidgetStateCommand }, { NULL, NULL } }; @@ -145,20 +147,20 @@ static WidgetCommandSpec SquareCommands[] = * with Tk in the package initialization code (see bottom). */ -WidgetSpec SquareWidgetSpec = +static WidgetSpec SquareWidgetSpec = { "TSquare", /* className */ sizeof(Square), /* recordSize */ SquareOptionSpecs, /* optionSpecs */ SquareCommands, /* subcommands */ - NullInitialize, /* initializeProc */ - NullCleanup, /* cleanupProc */ - CoreConfigure, /* configureProc */ - NullPostConfigure, /* postConfigureProc */ - WidgetGetLayout, /* getLayoutProc */ - WidgetSize, /* sizeProc */ + TtkNullInitialize, /* initializeProc */ + TtkNullCleanup, /* cleanupProc */ + TtkCoreConfigure, /* configureProc */ + TtkNullPostConfigure, /* postConfigureProc */ + TtkWidgetGetLayout, /* getLayoutProc */ + TtkWidgetSize, /* sizeProc */ SquareDoLayout, /* layoutProc */ - WidgetDisplay /* displayProc */ + TtkWidgetDisplay /* displayProc */ }; /* ---------------------------------------------------------------------- @@ -284,8 +286,8 @@ TTK_END_LAYOUT * free to specify a new style using completely different elements. */ -/* public */ int -SquareWidget_Init(Tcl_Interp *interp) +/* public */ MODULE_SCOPE int +TtkSquareWidget_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); @@ -301,3 +303,5 @@ SquareWidget_Init(Tcl_Interp *interp) return TCL_OK; } +#endif /* TTK_SQUARE_WIDGET */ + diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c index c1223d3..11b60f9 100644 --- a/generic/ttk/ttkStubInit.c +++ b/generic/ttk/ttkStubInit.c @@ -1,5 +1,5 @@ /* - * $Id: ttkStubInit.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkStubInit.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * This file is (mostly) automatically generated from ttk.decls. * It is compiled and linked in with the ttk package proper. @@ -8,6 +8,8 @@ #include "tk.h" #include "ttkTheme.h" +MODULE_SCOPE TtkStubs ttkStubs; + /* !BEGIN!: Do not edit below this line. */ TtkStubs ttkStubs = { diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c index e13abde..a693fcf 100644 --- a/generic/ttk/ttkStubLib.c +++ b/generic/ttk/ttkStubLib.c @@ -1,5 +1,5 @@ /* - * $Id: ttkStubLib.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkStubLib.c,v 1.2 2006/11/03 03:06:22 das Exp $ * SOURCE: tk/generic/tkStubLib.c, version 1.9 2004/03/17 */ @@ -8,6 +8,7 @@ #define USE_TTK_STUBS 1 #include "ttkTheme.h" +MODULE_SCOPE const TtkStubs *ttkStubsPtr; const TtkStubs *ttkStubsPtr; /* @@ -25,7 +26,8 @@ const TtkStubs *ttkStubsPtr; * Sets the stub table pointer. * */ -const char *TtkInitializeStubs( +MODULE_SCOPE const char * +TtkInitializeStubs( Tcl_Interp *interp, const char *version, int epoch, int revision) { int exact = 0; diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index c8b8010..af33606 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -1,5 +1,5 @@ /* - * tkTheme.c -- + * ttkTheme.c -- * * This file implements the widget styles and themes support. * @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * $Id: ttkTheme.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkTheme.c,v 1.2 2006/11/03 03:06:22 das Exp $ */ #include <stdlib.h> @@ -1607,7 +1607,7 @@ struct Ensemble { struct Ensemble *ensemble; /* subcommand ensemble */ }; -struct Ensemble StyleThemeEnsemble[] = { +static struct Ensemble StyleThemeEnsemble[] = { { "create", StyleThemeCreateCmd, 0 }, { "names", StyleThemeNamesCmd, 0 }, { "settings", StyleThemeSettingsCmd, 0 }, @@ -1615,14 +1615,14 @@ struct Ensemble StyleThemeEnsemble[] = { { NULL, 0, 0 } }; -struct Ensemble StyleElementEnsemble[] = { +static struct Ensemble StyleElementEnsemble[] = { { "create", StyleElementCreateCmd, 0 }, { "names", StyleElementNamesCmd, 0 }, { "options", StyleElementOptionsCmd, 0 }, { NULL, 0, 0 } }; -struct Ensemble StyleEnsemble[] = { +static struct Ensemble StyleEnsemble[] = { { "configure", StyleConfigureCmd, 0 }, { "map", StyleMapCmd, 0 }, { "lookup", StyleLookupCmd, 0 }, @@ -1701,7 +1701,7 @@ void Ttk_StylePkgInit(Tcl_Interp *interp) /* * Register null element, used as a last-resort fallback: */ - Ttk_RegisterElement(interp, pkgPtr->defaultTheme, "", &NullElementSpec, 0); + Ttk_RegisterElement(interp, pkgPtr->defaultTheme, "", &ttkNullElementSpec, 0); /* * Register commands: diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index 2bdba70..9df78ae 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -4,11 +4,11 @@ * * Copyright (c) 2003 Joe English. Freely redistributable. * - * $Id: ttkTheme.h,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkTheme.h,v 1.2 2006/11/03 03:06:22 das Exp $ */ -#ifndef TKTHEME_H -#define TKTHEME_H 1 +#ifndef _TTKTHEME +#define _TTKTHEME #ifdef __cplusplus extern "C" { @@ -170,7 +170,7 @@ typedef unsigned int Ttk_Sticky; #define TTK_FILL_BOTH (0xF) /* -sticky nswe */ TTKAPI int Ttk_GetStickyFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_Sticky *); -TTKAPI Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky); +MODULE_SCOPE Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky); /* * Extra bits for position specifications (combine -side and -sticky) @@ -202,12 +202,12 @@ TTKAPI Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int w, int h, Tk_Anchor anchor); TTKAPI Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p); TTKAPI Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p); TTKAPI Ttk_Box Ttk_PlaceBox(Ttk_Box *cavity, int w,int h, Ttk_Side,Ttk_Sticky); -TTKAPI Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int w, int h, Ttk_PositionSpec); +MODULE_SCOPE Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int w, int h, Ttk_PositionSpec); /*------------------------------------------------------------------------ * +++ Themes. */ -extern void Ttk_StylePkgInit(Tcl_Interp *); +MODULE_SCOPE void Ttk_StylePkgInit(Tcl_Interp *); typedef struct Ttk_Theme_ *Ttk_Theme; typedef struct Ttk_ElementImpl_ *Ttk_Element; @@ -222,9 +222,9 @@ TTKAPI Ttk_Theme Ttk_CreateTheme( Tcl_Interp *interp, const char *name, Ttk_Theme parent); typedef int (Ttk_ThemeEnabledProc)(Ttk_Theme theme, void *clientData); -extern void Ttk_SetThemeEnabledProc(Ttk_Theme, Ttk_ThemeEnabledProc, void *); +MODULE_SCOPE void Ttk_SetThemeEnabledProc(Ttk_Theme, Ttk_ThemeEnabledProc, void *); -extern int Ttk_UseTheme(Tcl_Interp *, Ttk_Theme); +MODULE_SCOPE int Ttk_UseTheme(Tcl_Interp *, Ttk_Theme); typedef void (Ttk_CleanupProc)(void *clientData); TTKAPI void Ttk_RegisterCleanup( @@ -279,12 +279,12 @@ typedef struct { Tcl_Obj *unused; } NullElement; -extern void NullElementGeometry +MODULE_SCOPE void TtkNullElementGeometry (void *, void *, Tk_Window, int *, int *, Ttk_Padding *); -extern void NullElementDraw +MODULE_SCOPE void TtkNullElementDraw (void *, void *, Tk_Window, Drawable, Ttk_Box, Ttk_State); -extern Ttk_ElementOptionSpec NullElementOptions[]; -extern Ttk_ElementSpec NullElementSpec; +MODULE_SCOPE Ttk_ElementOptionSpec TtkNullElementOptions[]; +MODULE_SCOPE Ttk_ElementSpec ttkNullElementSpec; /*------------------------------------------------------------------------ * +++ Layout templates. @@ -309,35 +309,35 @@ TTKAPI void Ttk_RegisterLayout( * +++ Layout instances. */ -extern Ttk_Layout Ttk_CreateLayout( +MODULE_SCOPE Ttk_Layout Ttk_CreateLayout( Tcl_Interp *, Ttk_Theme, const char *name, void *recordPtr, Tk_OptionTable, Tk_Window tkwin); -extern Ttk_Layout Ttk_CreateSublayout( +MODULE_SCOPE Ttk_Layout Ttk_CreateSublayout( Tcl_Interp *, Ttk_Theme, Ttk_Layout, const char *name, Tk_OptionTable); -extern void Ttk_FreeLayout(Ttk_Layout); +MODULE_SCOPE void Ttk_FreeLayout(Ttk_Layout); -extern void Ttk_LayoutSize(Ttk_Layout,Ttk_State,int *widthPtr,int *heightPtr); -extern void Ttk_PlaceLayout(Ttk_Layout, Ttk_State, Ttk_Box); -extern void Ttk_DrawLayout(Ttk_Layout, Ttk_State, Drawable); +MODULE_SCOPE void Ttk_LayoutSize(Ttk_Layout,Ttk_State,int *widthPtr,int *heightPtr); +MODULE_SCOPE void Ttk_PlaceLayout(Ttk_Layout, Ttk_State, Ttk_Box); +MODULE_SCOPE void Ttk_DrawLayout(Ttk_Layout, Ttk_State, Drawable); -extern void Ttk_RebindSublayout(Ttk_Layout, void *recordPtr); +MODULE_SCOPE void Ttk_RebindSublayout(Ttk_Layout, void *recordPtr); -extern Ttk_LayoutNode *Ttk_LayoutIdentify(Ttk_Layout, int x, int y); -extern Ttk_LayoutNode *Ttk_LayoutFindNode(Ttk_Layout, const char *nodeName); +MODULE_SCOPE Ttk_LayoutNode *Ttk_LayoutIdentify(Ttk_Layout, int x, int y); +MODULE_SCOPE Ttk_LayoutNode *Ttk_LayoutFindNode(Ttk_Layout, const char *nodeName); -extern const char *Ttk_LayoutNodeName(Ttk_LayoutNode *); -extern Ttk_Box Ttk_LayoutNodeParcel(Ttk_LayoutNode *); -extern Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout,Ttk_LayoutNode *); -extern Ttk_Padding Ttk_LayoutNodeInternalPadding(Ttk_Layout,Ttk_LayoutNode *); -extern void Ttk_LayoutNodeReqSize(Ttk_Layout, Ttk_LayoutNode *, int *w, int *h); +MODULE_SCOPE const char *Ttk_LayoutNodeName(Ttk_LayoutNode *); +MODULE_SCOPE Ttk_Box Ttk_LayoutNodeParcel(Ttk_LayoutNode *); +MODULE_SCOPE Ttk_Box Ttk_LayoutNodeInternalParcel(Ttk_Layout,Ttk_LayoutNode *); +MODULE_SCOPE Ttk_Padding Ttk_LayoutNodeInternalPadding(Ttk_Layout,Ttk_LayoutNode *); +MODULE_SCOPE void Ttk_LayoutNodeReqSize(Ttk_Layout, Ttk_LayoutNode *, int *w, int *h); -extern void Ttk_LayoutNodeSetParcel(Ttk_LayoutNode *node, Ttk_Box parcel); -extern void Ttk_PlaceLayoutNode(Ttk_Layout,Ttk_LayoutNode *, Ttk_Box); -extern void Ttk_ChangeElementState(Ttk_LayoutNode *,unsigned set,unsigned clr); +MODULE_SCOPE void Ttk_LayoutNodeSetParcel(Ttk_LayoutNode *node, Ttk_Box parcel); +MODULE_SCOPE void Ttk_PlaceLayoutNode(Ttk_Layout,Ttk_LayoutNode *, Ttk_Box); +MODULE_SCOPE void Ttk_ChangeElementState(Ttk_LayoutNode *,unsigned set,unsigned clr); -extern Tcl_Obj *Ttk_QueryOption(Ttk_Layout, const char *, Ttk_State); +MODULE_SCOPE Tcl_Obj *Ttk_QueryOption(Ttk_Layout, const char *, Ttk_State); /*------------------------------------------------------------------------ * +++ Resource cache. @@ -345,16 +345,16 @@ extern Tcl_Obj *Ttk_QueryOption(Ttk_Layout, const char *, Ttk_State); */ typedef struct Ttk_ResourceCache_ *Ttk_ResourceCache; -extern Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *); -extern void Ttk_FreeResourceCache(Ttk_ResourceCache); +MODULE_SCOPE Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *); +MODULE_SCOPE void Ttk_FreeResourceCache(Ttk_ResourceCache); -extern Ttk_ResourceCache Ttk_GetResourceCache(Tcl_Interp*); -extern Tcl_Obj *Ttk_UseFont(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); -extern Tcl_Obj *Ttk_UseColor(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); -extern Tcl_Obj *Ttk_UseBorder(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); -extern Tk_Image Ttk_UseImage(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); +MODULE_SCOPE Ttk_ResourceCache Ttk_GetResourceCache(Tcl_Interp*); +MODULE_SCOPE Tcl_Obj *Ttk_UseFont(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); +MODULE_SCOPE Tcl_Obj *Ttk_UseColor(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); +MODULE_SCOPE Tcl_Obj *Ttk_UseBorder(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); +MODULE_SCOPE Tk_Image Ttk_UseImage(Ttk_ResourceCache, Tk_Window, Tcl_Obj *); -extern void Ttk_RegisterNamedColor(Ttk_ResourceCache, const char *, XColor *); +MODULE_SCOPE void Ttk_RegisterNamedColor(Ttk_ResourceCache, const char *, XColor *); /*------------------------------------------------------------------------ * +++ Miscellaneous enumerations. @@ -367,7 +367,7 @@ typedef enum /* -default option values */ TTK_BUTTON_DEFAULT_DISABLED /* not defaultable */ } Ttk_ButtonDefaultState; -extern int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, int *); +MODULE_SCOPE int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, int *); typedef enum /* -compound option values */ { @@ -381,7 +381,7 @@ typedef enum /* -compound option values */ TTK_COMPOUND_RIGHT /* image to right of text */ } Ttk_Compound; -extern int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, int *); +MODULE_SCOPE int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, int *); typedef enum { /* -orient option values */ TTK_ORIENT_HORIZONTAL, @@ -399,11 +399,11 @@ typedef enum { /* -orient option values */ * (@@@ find a better home for this) */ typedef enum { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT } ArrowDirection; -extern void ArrowSize(int h, ArrowDirection, int *widthPtr, int *heightPtr); -extern void DrawArrow(Display *, Drawable, GC, Ttk_Box, ArrowDirection); -extern void FillArrow(Display *, Drawable, GC, Ttk_Box, ArrowDirection); +MODULE_SCOPE void TtkArrowSize(int h, ArrowDirection, int *widthPtr, int *heightPtr); +MODULE_SCOPE void TtkDrawArrow(Display *, Drawable, GC, Ttk_Box, ArrowDirection); +MODULE_SCOPE void TtkFillArrow(Display *, Drawable, GC, Ttk_Box, ArrowDirection); #ifdef __cplusplus } #endif -#endif /* TKTHEME_H */ +#endif /* _TTKTHEME */ diff --git a/generic/ttk/ttkThemeInt.h b/generic/ttk/ttkThemeInt.h index 065dd44..9915714 100644 --- a/generic/ttk/ttkThemeInt.h +++ b/generic/ttk/ttkThemeInt.h @@ -1,43 +1,42 @@ /* - * $Id: ttkThemeInt.h,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkThemeInt.h,v 1.2 2006/11/03 03:06:22 das Exp $ * * Theme engine: private definitions. * * Copyright (c) 2004 Joe English. Freely redistributable. */ -#ifndef TKTHEMEINT_INCLUDED -#define TKTHEMEINT_INCLUDED 1 +#ifndef _TTKTHEMEINT +#define _TTKTHEMEINT #include "ttkTheme.h" typedef struct Ttk_Style_ *Ttk_Style; typedef struct Ttk_TemplateNode_ Ttk_TemplateNode, *Ttk_LayoutTemplate; -extern Ttk_Element Ttk_GetElement(Ttk_Theme theme, const char *name); -extern const char *Ttk_ElementName(Ttk_Element); +MODULE_SCOPE Ttk_Element Ttk_GetElement(Ttk_Theme theme, const char *name); +MODULE_SCOPE const char *Ttk_ElementName(Ttk_Element); -extern void Ttk_ElementSize( +MODULE_SCOPE void Ttk_ElementSize( Ttk_Element element, Ttk_Style, char *recordPtr, Tk_OptionTable, Tk_Window tkwin, Ttk_State state, int *widthPtr, int *heightPtr, Ttk_Padding*); -extern void Ttk_DrawElement( +MODULE_SCOPE void Ttk_DrawElement( Ttk_Element element, Ttk_Style, char *recordPtr, Tk_OptionTable, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); -extern Tcl_Obj *Ttk_QueryStyle( +MODULE_SCOPE Tcl_Obj *Ttk_QueryStyle( Ttk_Style, void *, Tk_OptionTable, const char *, Ttk_State state); -extern Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *, Tcl_Obj *); -extern Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_LayoutTemplate); -extern Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec); -extern void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate); +MODULE_SCOPE Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *, Tcl_Obj *); +MODULE_SCOPE Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_LayoutTemplate); +MODULE_SCOPE Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec); +MODULE_SCOPE void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate); -extern Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName); -extern Ttk_LayoutTemplate Ttk_FindLayoutTemplate( +MODULE_SCOPE Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName); +MODULE_SCOPE Ttk_LayoutTemplate Ttk_FindLayoutTemplate( Ttk_Theme themePtr, const char *layoutName); -extern const char *Ttk_StyleName(Ttk_Style); +MODULE_SCOPE const char *Ttk_StyleName(Ttk_Style); - -#endif /* TKTHEMEINT_INCLUDED */ +#endif /* _TTKTHEMEINT */ diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c index 4a6337e..6f0cc35 100644 --- a/generic/ttk/ttkTrack.c +++ b/generic/ttk/ttkTrack.c @@ -1,12 +1,12 @@ -/* $Id: ttkTrack.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkTrack.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (c) 2004, Joe English * - * TrackElementState() -- helper routine for widgets + * TtkTrackElementState() -- helper routine for widgets * like scrollbars in which individual elements may * be active or pressed instead of the widget as a whole. * * Usage: - * TrackElementState(&recordPtr->core); + * TtkTrackElementState(&recordPtr->core); * * Registers an event handler on the widget that tracks pointer * events and updates the state of the element under the @@ -158,12 +158,12 @@ ElementStateEventProc(ClientData clientData, XEvent *ev) } /* - * TrackElementState -- + * TtkTrackElementState -- * Register an event handler to manage the 'pressed' * and 'active' states of individual widget elements. */ -void TrackElementState(WidgetCore *corePtr) +void TtkTrackElementState(WidgetCore *corePtr) { ElementStateTracker *es = (ElementStateTracker*)ckalloc(sizeof(*es)); es->corePtr = corePtr; diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 4038a5d..ec61201 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -1,5 +1,5 @@ /* - * $Id: ttkTreeview.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkTreeview.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (c) 2004, Joe English * * Ttk widget set: treeview widget. @@ -10,6 +10,8 @@ #include "ttkTheme.h" #include "ttkWidget.h" +#ifdef TTK_TREEVIEW_WIDGET + #define DEF_TREE_ROWS "10" #define DEF_TREE_PADDING "4" #define DEF_COLWIDTH "200" @@ -439,7 +441,7 @@ static Tk_OptionSpec TreeviewOptionSpecs[] = NULL, -1, Tk_Offset(Treeview, tree.yscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, - WIDGET_INHERIT_OPTIONS(CoreOptionSpecs) + WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ @@ -739,7 +741,7 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv) static TreeItem *IdentifyItem(Treeview *tv,int y,Ttk_Box *itemPos); /*forward*/ -const unsigned int TreeviewBindEventMask = +static const unsigned int TreeviewBindEventMask = KeyPressMask|KeyReleaseMask | ButtonPressMask|ButtonReleaseMask | PointerMotionMask|ButtonMotionMask @@ -853,7 +855,7 @@ static int TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) /* Scroll handles: */ - tv->tree.yscrollHandle = CreateScrollHandle(&tv->core, &tv->tree.yscroll); + tv->tree.yscrollHandle = TtkCreateScrollHandle(&tv->core, &tv->tree.yscroll); return TCL_OK; } @@ -880,7 +882,7 @@ static void TreeviewCleanup(void *recordPtr) foreachHashEntry(&tv->tree.items, FreeItemCB); Tcl_DeleteHashTable(&tv->tree.items); - FreeScrollHandle(tv->tree.yscrollHandle); + TtkFreeScrollHandle(tv->tree.yscrollHandle); } /* + TreeviewConfigure -- @@ -905,7 +907,7 @@ TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask) return TCL_ERROR; } if (mask & SCROLLCMD_CHANGED) { - ScrollbarUpdateRequired(tv->tree.yscrollHandle); + TtkScrollbarUpdateRequired(tv->tree.yscrollHandle); } if ( (mask & SHOW_CHANGED) @@ -915,7 +917,7 @@ TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask) return TCL_ERROR; } - if (CoreConfigure(interp, recordPtr, mask) != TCL_OK) { + if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { return TCL_ERROR; } @@ -951,10 +953,10 @@ static int ConfigureItem( */ if (item->imageObj) { Tk_Image *images = NULL; - if (GetImageList(interp, &tv->core, item->imageObj, &images) != TCL_OK) + if (TtkGetImageList(interp, &tv->core, item->imageObj, &images) != TCL_OK) goto error; if (images) - FreeImageList(images); + TtkFreeImageList(images); } /* Keep TTK_STATE_OPEN flag in sync with item->openObj. @@ -1274,7 +1276,7 @@ static Ttk_Layout TreeviewGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { Treeview *tv = recordPtr; - Ttk_Layout treeLayout = WidgetGetLayout(interp, themePtr, recordPtr); + Ttk_Layout treeLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); if (!( GetSublayout(interp, themePtr, treeLayout, ".Item", @@ -1321,7 +1323,7 @@ static void TreeviewDoLayout(void *clientData) } tv->tree.root->state |= TTK_STATE_OPEN; - Scrolled(tv->tree.yscrollHandle, + TtkScrolled(tv->tree.yscrollHandle, tv->tree.yscroll.first, tv->tree.yscroll.first + (tv->tree.treeArea.height / ROWHEIGHT), CountRows(tv->tree.root) - 1); @@ -2105,10 +2107,10 @@ static int TreeviewItemCommand( } if (objc == 3) { - return EnumerateOptions(interp, item, ItemOptionSpecs, + return TtkEnumerateOptions(interp, item, ItemOptionSpecs, tv->tree.itemOptionTable, tv->core.tkwin); } else if (objc == 4) { - return GetOptionValue(interp, item, objv[3], + return TtkGetOptionValue(interp, item, objv[3], tv->tree.itemOptionTable, tv->core.tkwin); } else { return ConfigureItem(interp, tv, item, objc-3, objv+3); @@ -2133,10 +2135,10 @@ static int TreeviewColumnCommand( } if (objc == 3) { - return EnumerateOptions(interp, column, ColumnOptionSpecs, + return TtkEnumerateOptions(interp, column, ColumnOptionSpecs, tv->tree.columnOptionTable, tv->core.tkwin); } else if (objc == 4) { - return GetOptionValue(interp, column, objv[3], + return TtkGetOptionValue(interp, column, objv[3], tv->tree.columnOptionTable, tv->core.tkwin); } else { return ConfigureColumn(interp, tv, column, objc-3, objv+3); @@ -2163,10 +2165,10 @@ static int TreeviewHeadingCommand( } if (objc == 3) { - return EnumerateOptions( + return TtkEnumerateOptions( interp, column, HeadingOptionSpecs, optionTable, tkwin); } else if (objc == 4) { - return GetOptionValue( + return TtkGetOptionValue( interp, column, objv[3], optionTable, tkwin); } else { return ConfigureHeading(interp, tv, column, objc-3,objv+3); @@ -2497,7 +2499,7 @@ static int TreeviewYViewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Treeview *tv = recordPtr; - return ScrollviewCommand(interp, objc, objv, tv->tree.yscrollHandle); + return TtkScrollviewCommand(interp, objc, objv, tv->tree.yscrollHandle); } /* $tree see $item -- @@ -2533,9 +2535,9 @@ static int TreeviewSeeCommand( */ rowNumber = RowNumber(tv, item); if (rowNumber < tv->tree.yscroll.first) { - ScrollTo(tv->tree.yscrollHandle, rowNumber); + TtkScrollTo(tv->tree.yscrollHandle, rowNumber); } else if (rowNumber >= tv->tree.yscroll.last) { - ScrollTo(tv->tree.yscrollHandle, + TtkScrollTo(tv->tree.yscrollHandle, tv->tree.yscroll.first + (1+rowNumber - tv->tree.yscroll.last)); } @@ -2638,7 +2640,7 @@ static int TreeviewSelectionCommand( } ckfree((ClientData)items); - SendVirtualEvent(tv->core.tkwin, "TreeviewSelect"); + TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect"); TtkRedisplayWidget(&tv->core); return TCL_OK; @@ -2714,10 +2716,10 @@ static int TreeviewTagConfigureCommand( tagRecord = Ttk_TagRecord(tag); if (objc == 4) { - return EnumerateOptions(interp, tagRecord, TagOptionSpecs, + return TtkEnumerateOptions(interp, tagRecord, TagOptionSpecs, tv->tree.tagOptionTable, tv->core.tkwin); } else if (objc == 5) { - return GetOptionValue(interp, tagRecord, objv[4], + return TtkGetOptionValue(interp, tagRecord, objv[4], tv->tree.tagOptionTable, tv->core.tkwin); } /* else */ @@ -2738,7 +2740,7 @@ static int TreeviewTagCommand( { "configure", TreeviewTagConfigureCommand }, {0,0} }; - return WidgetEnsembleCommand( + return TtkWidgetEnsembleCommand( TreeviewTagCommands, 2, interp, objc, objv, recordPtr); } @@ -2749,9 +2751,9 @@ static WidgetCommandSpec TreeviewCommands[] = { { "bbox", TreeviewBBoxCommand }, { "children", TreeviewChildrenCommand }, - { "cget", WidgetCgetCommand }, + { "cget", TtkWidgetCgetCommand }, { "column", TreeviewColumnCommand }, - { "configure", WidgetConfigureCommand }, + { "configure", TtkWidgetConfigureCommand }, { "delete", TreeviewDeleteCommand }, { "detach", TreeviewDetachCommand }, { "exists", TreeviewExistsCommand }, @@ -2759,7 +2761,7 @@ static WidgetCommandSpec TreeviewCommands[] = { "heading", TreeviewHeadingCommand }, { "identify", TreeviewIdentifyCommand }, { "index", TreeviewIndexCommand }, - { "instate", WidgetInstateCommand }, + { "instate", TtkWidgetInstateCommand }, { "insert", TreeviewInsertCommand }, { "item", TreeviewItemCommand }, { "move", TreeviewMoveCommand }, @@ -2769,7 +2771,7 @@ static WidgetCommandSpec TreeviewCommands[] = { "see", TreeviewSeeCommand }, { "selection" , TreeviewSelectionCommand }, { "set", TreeviewSetCommand }, - { "state", WidgetStateCommand }, + { "state", TtkWidgetStateCommand }, { "tag", TreeviewTagCommand }, { "yview", TreeviewYViewCommand }, { NULL, NULL } @@ -2779,7 +2781,7 @@ static WidgetCommandSpec TreeviewCommands[] = * +++ Widget definition. */ -WidgetSpec TreeviewWidgetSpec = +static WidgetSpec TreeviewWidgetSpec = { "Treeview", /* className */ sizeof(Treeview), /* recordSize */ @@ -2788,7 +2790,7 @@ WidgetSpec TreeviewWidgetSpec = TreeviewInitialize, /* initializeProc */ TreeviewCleanup, /* cleanupProc */ TreeviewConfigure, /* configureProc */ - NullPostConfigure, /* postConfigureProc */ + TtkNullPostConfigure, /* postConfigureProc */ TreeviewGetLayout, /* getLayoutProc */ TreeviewSize, /* sizeProc */ TreeviewDoLayout, /* layoutProc */ @@ -2892,7 +2894,7 @@ static void TreeitemIndicatorDraw( mask = GCForeground | GCLineWidth; gc = Tk_GetGC(tkwin, mask, &gcvalues); - DrawArrow(Tk_Display(tkwin), d, gc, b, direction); + TtkDrawArrow(Tk_Display(tkwin), d, gc, b, direction); Tk_FreeGC(Tk_Display(tkwin), gc); } @@ -2941,14 +2943,14 @@ static Ttk_ElementSpec RowElementSpec = TK_STYLE_VERSION_2, sizeof(RowElement), RowElementOptions, - NullElementGeometry, + TtkNullElementGeometry, RowElementDraw }; /*------------------------------------------------------------------------ * +++ Initialisation. */ -DLLEXPORT int Treeview_Init(Tcl_Interp *interp) +MODULE_SCOPE int TtkTreeview_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); @@ -2970,4 +2972,6 @@ DLLEXPORT int Treeview_Init(Tcl_Interp *interp) return TCL_OK; } +#endif /* TTK_TREEVIEW_WIDGET */ + /*EOF*/ diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 6f4e56f..77a6641 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -1,4 +1,4 @@ -/* $Id: ttkWidget.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkWidget.c,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (c) 2003, Joe English * * Ttk widget implementation, core widget utilities. @@ -120,10 +120,10 @@ void TtkResizeWidget(WidgetCore *corePtr) TtkRedisplayWidget(corePtr); } -/* WidgetEnsembleCommand -- +/* TtkWidgetEnsembleCommand -- * Invoke an ensemble defined by a WidgetCommandSpec. */ -int WidgetEnsembleCommand( +int TtkWidgetEnsembleCommand( WidgetCommandSpec *commands, /* Ensemble definition */ int cmdIndex, /* Index of command word */ Tcl_Interp *interp, /* Interpreter to use */ @@ -160,7 +160,7 @@ WidgetInstanceObjCmd( int status = TCL_OK; Tcl_Preserve(clientData); - status = WidgetEnsembleCommand(commands, 1, interp, objc, objv, clientData); + status = TtkWidgetEnsembleCommand(commands, 1, interp, objc, objv, clientData); Tcl_Release(clientData); return status; @@ -328,11 +328,11 @@ static struct Tk_ClassProcs widgetClassProcs = { }; /* - * WidgetConstructorObjCmd -- + * TtkWidgetConstructorObjCmd -- * General-purpose widget constructor command implementation. * ClientData is a WidgetSpec *. */ -int WidgetConstructorObjCmd( +int TtkWidgetConstructorObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { WidgetSpec *widgetSpec = (WidgetSpec *)clientData; @@ -434,10 +434,10 @@ error: } /* - * WidgetChangeState -- + * TtkWidgetChangeState -- * Set / clear the specified bits in the 'state' flag, */ -void WidgetChangeState(WidgetCore *corePtr, +void TtkWidgetChangeState(WidgetCore *corePtr, unsigned int setBits, unsigned int clearBits) { Ttk_State oldState = corePtr->state; @@ -448,12 +448,12 @@ void WidgetChangeState(WidgetCore *corePtr, } /* - * WidgetGetLayout -- + * TtkWidgetGetLayout -- * Default getLayoutProc. * Looks up the layout based on the -style resource (if specified), * otherwise use the widget class. */ -Ttk_Layout WidgetGetLayout( +Ttk_Layout TtkWidgetGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { WidgetCore *corePtr = recordPtr; @@ -470,12 +470,12 @@ Ttk_Layout WidgetGetLayout( } /* - * WidgetGetOrientedLayout -- - * Helper routine. Same as WidgetGetLayout, but prefixes + * TtkWidgetGetOrientedLayout -- + * Helper routine. Same as TtkWidgetGetLayout, but prefixes * "Horizontal." or "Vertical." to the style name, depending * on the value of the 'orient' option. */ -Ttk_Layout WidgetGetOrientedLayout( +Ttk_Layout TtkWidgetGetOrientedLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr, Tcl_Obj *orientObj) { WidgetCore *corePtr = recordPtr; @@ -515,27 +515,27 @@ Ttk_Layout WidgetGetOrientedLayout( } /* - * NullInitialize -- + * TtkNullInitialize -- * Default widget initializeProc (no-op) */ -int NullInitialize(Tcl_Interp *interp, void *recordPtr) +int TtkNullInitialize(Tcl_Interp *interp, void *recordPtr) { return TCL_OK; } /* - * NullPostConfigure -- + * TtkNullPostConfigure -- * Default widget postConfigureProc (no-op) */ -int NullPostConfigure(Tcl_Interp *interp, void *clientData, int mask) +int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask) { return TCL_OK; } -/* CoreConfigure -- +/* TtkCoreConfigure -- * Default widget configureProc. */ -int CoreConfigure(Tcl_Interp *interp, void *clientData, int mask) +int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask) { WidgetCore *corePtr = clientData; @@ -557,39 +557,39 @@ int CoreConfigure(Tcl_Interp *interp, void *clientData, int mask) } /* - * NullCleanup -- + * TtkNullCleanup -- * Default widget cleanupProc (no-op) */ -void NullCleanup(void *recordPtr) +void TtkNullCleanup(void *recordPtr) { return; } /* - * WidgetDoLayout -- + * TtkWidgetDoLayout -- * Default widget layoutProc. */ -void WidgetDoLayout(void *clientData) +void TtkWidgetDoLayout(void *clientData) { WidgetCore *corePtr = clientData; Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); } /* - * WidgetDisplay -- + * TtkWidgetDisplay -- * Default widget displayProc. */ -void WidgetDisplay(void *recordPtr, Drawable d) +void TtkWidgetDisplay(void *recordPtr, Drawable d) { WidgetCore *corePtr = recordPtr; Ttk_DrawLayout(corePtr->layout, corePtr->state, d); } /* - * WidgetSize -- + * TtkWidgetSize -- * Default widget sizeProc() */ -int WidgetSize(void *recordPtr, int *widthPtr, int *heightPtr) +int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr) { WidgetCore *corePtr = recordPtr; Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr); @@ -604,7 +604,7 @@ int WidgetSize(void *recordPtr, int *widthPtr, int *heightPtr) /* Default implementations for widget subcommands: */ -int WidgetCgetCommand( +int TtkWidgetCgetCommand( Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; @@ -622,7 +622,7 @@ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr) return TCL_OK; } -int WidgetConfigureCommand( +int TtkWidgetConfigureCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; @@ -688,7 +688,7 @@ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) * Otherwise, return a statespec matching all the currently-set bits. */ -int WidgetStateCommand( +int TtkWidgetStateCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; @@ -728,7 +728,7 @@ int WidgetStateCommand( * Otherwise, return true/false */ -int WidgetInstateCommand( +int TtkWidgetInstateCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; @@ -758,7 +758,7 @@ int WidgetInstateCommand( /* $w identify $x $y * Returns: name of element at $x, $y */ -int WidgetIdentifyCommand( +int TtkWidgetIdentifyCommand( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index aa749ee..0a0f10f 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -1,4 +1,4 @@ -/* $Id: ttkWidget.h,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkWidget.h,v 1.2 2006/11/03 03:06:22 das Exp $ * Copyright (c) 2003, Joe English * * Helper routines for widget implementations. @@ -6,8 +6,8 @@ * Require: ttkTheme.h. */ -#ifndef WIDGET_H -#define WIDGET_H 1 +#ifndef _TTKWIDGET +#define _TTKWIDGET /* State flags for 'flags' field. * @@@ todo: distinguish: @@ -16,7 +16,7 @@ #define WIDGET_DESTROYED 0x0001 #define REDISPLAY_PENDING 0x0002 /* scheduled call to RedisplayWidget */ #define WIDGET_REALIZED 0x0010 /* set at first ConfigureNotify */ -#define CURSOR_ON 0x0020 /* See BlinkCursor() */ +#define CURSOR_ON 0x0020 /* See TtkBlinkCursor() */ #define WIDGET_USER_FLAG 0x0100 /* 0x0100 - 0x8000 for user flags */ /* @@ -63,7 +63,7 @@ typedef struct { WidgetSubcommandProc command; } WidgetCommandSpec; -extern int WidgetEnsembleCommand( /* Run an ensemble command */ +MODULE_SCOPE int TtkWidgetEnsembleCommand( /* Run an ensemble command */ WidgetCommandSpec *commands, int cmdIndex, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr); @@ -93,34 +93,34 @@ struct WidgetSpec_ /* * Common factors for widget implementations: */ -extern int NullInitialize(Tcl_Interp *, void *); -extern int NullPostConfigure(Tcl_Interp *, void *, int); -extern void NullCleanup(void *recordPtr); -extern Ttk_Layout WidgetGetLayout(Tcl_Interp *, Ttk_Theme, void *recordPtr); -extern Ttk_Layout WidgetGetOrientedLayout( +MODULE_SCOPE int TtkNullInitialize(Tcl_Interp *, void *); +MODULE_SCOPE int TtkNullPostConfigure(Tcl_Interp *, void *, int); +MODULE_SCOPE void TtkNullCleanup(void *recordPtr); +MODULE_SCOPE Ttk_Layout TtkWidgetGetLayout(Tcl_Interp *, Ttk_Theme, void *recordPtr); +MODULE_SCOPE Ttk_Layout TtkWidgetGetOrientedLayout( Tcl_Interp *, Ttk_Theme, void *recordPtr, Tcl_Obj *orientObj); -extern int WidgetSize(void *recordPtr, int *w, int *h); -extern void WidgetDoLayout(void *recordPtr); -extern void WidgetDisplay(void *recordPtr, Drawable); +MODULE_SCOPE int TtkWidgetSize(void *recordPtr, int *w, int *h); +MODULE_SCOPE void TtkWidgetDoLayout(void *recordPtr); +MODULE_SCOPE void TtkWidgetDisplay(void *recordPtr, Drawable); -extern int CoreConfigure(Tcl_Interp*, void *, int mask); +MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask); /* Commands present in all widgets: */ -extern int WidgetConfigureCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); -extern int WidgetCgetCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); -extern int WidgetInstateCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); -extern int WidgetStateCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); +MODULE_SCOPE int TtkWidgetConfigureCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); +MODULE_SCOPE int TtkWidgetCgetCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); +MODULE_SCOPE int TtkWidgetInstateCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); +MODULE_SCOPE int TtkWidgetStateCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); /* Common widget commands: */ -extern int WidgetIdentifyCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); +MODULE_SCOPE int TtkWidgetIdentifyCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); -extern int WidgetConstructorObjCmd(ClientData,Tcl_Interp*,int,Tcl_Obj*CONST[]); +MODULE_SCOPE int TtkWidgetConstructorObjCmd(ClientData,Tcl_Interp*,int,Tcl_Obj*CONST[]); #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand(interp, name, \ - WidgetConstructorObjCmd, (ClientData)specPtr,NULL) + TtkWidgetConstructorObjCmd, (ClientData)specPtr,NULL) /* WIDGET_TAKES_FOCUS -- * Add this to the OptionSpecs table of widgets that @@ -141,22 +141,22 @@ extern int WidgetConstructorObjCmd(ClientData,Tcl_Interp*,int,Tcl_Obj*CONST[]); /* * Useful routines for use inside widget implementations: */ -extern int WidgetDestroyed(WidgetCore *); +/* extern int WidgetDestroyed(WidgetCore *); */ #define WidgetDestroyed(corePtr) ((corePtr)->flags & WIDGET_DESTROYED) -extern void WidgetChangeState(WidgetCore *, +MODULE_SCOPE void TtkWidgetChangeState(WidgetCore *, unsigned int setBits, unsigned int clearBits); -extern void TtkRedisplayWidget(WidgetCore *); -extern void TtkResizeWidget(WidgetCore *); +MODULE_SCOPE void TtkRedisplayWidget(WidgetCore *); +MODULE_SCOPE void TtkResizeWidget(WidgetCore *); -extern void TrackElementState(WidgetCore *); -extern void BlinkCursor(WidgetCore *); +MODULE_SCOPE void TtkTrackElementState(WidgetCore *); +MODULE_SCOPE void TtkBlinkCursor(WidgetCore *); /* * -state option values (compatibility) */ -extern void CheckStateOption(WidgetCore *, Tcl_Obj *); +MODULE_SCOPE void TtkCheckStateOption(WidgetCore *, Tcl_Obj *); /* * Variable traces: @@ -164,29 +164,29 @@ extern void CheckStateOption(WidgetCore *, Tcl_Obj *); typedef void (*Ttk_TraceProc)(void *recordPtr, const char *value); typedef struct TtkTraceHandle_ Ttk_TraceHandle; -extern Ttk_TraceHandle *Ttk_TraceVariable( +MODULE_SCOPE Ttk_TraceHandle *Ttk_TraceVariable( Tcl_Interp*, Tcl_Obj *varnameObj, Ttk_TraceProc callback, void *clientData); -extern void Ttk_UntraceVariable(Ttk_TraceHandle *); -extern int Ttk_FireTrace(Ttk_TraceHandle *); +MODULE_SCOPE void Ttk_UntraceVariable(Ttk_TraceHandle *); +MODULE_SCOPE int Ttk_FireTrace(Ttk_TraceHandle *); /* * Utility routines for managing -image option: */ -extern int GetImageList( +MODULE_SCOPE int TtkGetImageList( Tcl_Interp *, WidgetCore *, Tcl_Obj *imageOption, Tk_Image **imageListPtr); -extern void FreeImageList(Tk_Image *); +MODULE_SCOPE void TtkFreeImageList(Tk_Image *); /* * Virtual events: */ -extern void SendVirtualEvent(Tk_Window tgtWin, const char *eventName); +MODULE_SCOPE void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName); /* * Helper routines for data accessor commands: */ -extern int EnumerateOptions( +MODULE_SCOPE int TtkEnumerateOptions( Tcl_Interp *, void *recordPtr, Tk_OptionSpec *, Tk_OptionTable, Tk_Window); -extern int GetOptionValue( +MODULE_SCOPE int TtkGetOptionValue( Tcl_Interp *, void *recordPtr, Tcl_Obj *optName, Tk_OptionTable, Tk_Window); /* @@ -201,15 +201,15 @@ typedef struct { typedef struct ScrollHandleRec *ScrollHandle; -extern ScrollHandle CreateScrollHandle(WidgetCore *, Scrollable *); -extern void FreeScrollHandle(ScrollHandle); +MODULE_SCOPE ScrollHandle TtkCreateScrollHandle(WidgetCore *, Scrollable *); +MODULE_SCOPE void TtkFreeScrollHandle(ScrollHandle); -extern int ScrollviewCommand( +MODULE_SCOPE int TtkScrollviewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle); -extern void ScrollTo(ScrollHandle, int newFirst); -extern void Scrolled(ScrollHandle, int first, int last, int total); -extern void ScrollbarUpdateRequired(ScrollHandle); +MODULE_SCOPE void TtkScrollTo(ScrollHandle, int newFirst); +MODULE_SCOPE void TtkScrolled(ScrollHandle, int first, int last, int total); +MODULE_SCOPE void TtkScrollbarUpdateRequired(ScrollHandle); /* * Tag sets (work in progress, half-baked) @@ -218,52 +218,52 @@ extern void ScrollbarUpdateRequired(ScrollHandle); typedef struct TtkTag *Ttk_Tag; typedef struct TtkTagTable *Ttk_TagTable; -extern Ttk_TagTable Ttk_CreateTagTable(Tk_OptionTable, int tagRecSize); -extern void Ttk_DeleteTagTable(Ttk_TagTable); +MODULE_SCOPE Ttk_TagTable Ttk_CreateTagTable(Tk_OptionTable, int tagRecSize); +MODULE_SCOPE void Ttk_DeleteTagTable(Ttk_TagTable); -extern Ttk_Tag Ttk_GetTag(Ttk_TagTable, const char *tagName); -extern Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable, Tcl_Obj *); +MODULE_SCOPE Ttk_Tag Ttk_GetTag(Ttk_TagTable, const char *tagName); +MODULE_SCOPE Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable, Tcl_Obj *); -extern Tcl_Obj **Ttk_TagRecord(Ttk_Tag); +MODULE_SCOPE Tcl_Obj **Ttk_TagRecord(Ttk_Tag); -extern int Ttk_GetTagListFromObj( +MODULE_SCOPE int Ttk_GetTagListFromObj( Tcl_Interp *interp, Ttk_TagTable, Tcl_Obj *objPtr, int *nTags_rtn, void **taglist_rtn); -extern void Ttk_FreeTagList(void **taglist); +MODULE_SCOPE void Ttk_FreeTagList(void **taglist); /* * Useful widget base classes: */ -extern Tk_OptionSpec CoreOptionSpecs[]; +MODULE_SCOPE Tk_OptionSpec ttkCoreOptionSpecs[]; /* * String tables for widget resource specifications: */ -extern const char *TTKOrientStrings[]; -extern const char *TTKCompoundStrings[]; -extern const char *TTKDefaultStrings[]; +MODULE_SCOPE const char *ttkOrientStrings[]; +MODULE_SCOPE const char *ttkCompoundStrings[]; +MODULE_SCOPE const char *ttkDefaultStrings[]; /* * ... other option types... */ -extern int TtkGetLabelAnchorFromObj(Tcl_Interp*,Tcl_Obj*,Ttk_PositionSpec *); +MODULE_SCOPE int TtkGetLabelAnchorFromObj(Tcl_Interp*,Tcl_Obj*,Ttk_PositionSpec *); /* * Package initialiation routines: */ -extern void RegisterElements(Tcl_Interp *); +MODULE_SCOPE void TtkRegisterElements(Tcl_Interp *); #if defined(__WIN32__) #define Ttk_PlatformInit Ttk_WinPlatformInit -extern int Ttk_WinPlatformInit(Tcl_Interp *); +MODULE_SCOPE int Ttk_PlatformInit(Tcl_Interp *); #elif defined(MAC_OSX_TK) -#define Ttk_PlatformInit Ttk_MacPlatformInit -extern int Ttk_MacPlatformInit(Tcl_Interp *); +#define Ttk_PlatformInit Ttk_MacOSXPlatformInit +MODULE_SCOPE int Ttk_PlatformInit(Tcl_Interp *); #else #define Ttk_PlatformInit(interp) /* TTK_X11PlatformInit() */ #endif -#endif /* WIDGET_H */ +#endif /* _TTKWIDGET */ diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 186565f..7cd46ae 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkMacOSXTheme.c,v 1.2 2006/10/31 13:56:58 das Exp $ + * $Id: ttkMacOSXTheme.c,v 1.3 2006/11/03 03:06:22 das Exp $ * * Tk theme engine for Mac OSX, using the Appearance Manager API. * @@ -189,7 +189,7 @@ static Ttk_ElementSpec ButtonElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, ButtonElementGeometry, ButtonElementDraw }; @@ -242,7 +242,7 @@ static Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, TabElementGeometry, TabElementDraw }; @@ -272,7 +272,7 @@ static Ttk_ElementSpec PaneElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, PaneElementGeometry, PaneElementDraw }; @@ -308,7 +308,7 @@ static Ttk_ElementSpec GroupElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, GroupElementGeometry, GroupElementDraw }; @@ -425,7 +425,7 @@ static Ttk_ElementSpec PopupArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, PopupArrowElementGeometry, PopupArrowElementDraw }; @@ -549,9 +549,9 @@ static void SliderElementGeometry( static Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, SliderElementGeometry, - NullElementDraw + TtkNullElementDraw }; /*---------------------------------------------------------------------- @@ -670,7 +670,7 @@ static Ttk_ElementSpec SeparatorElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, SeparatorElementSize, SeparatorElementDraw }; @@ -716,7 +716,7 @@ static Ttk_ElementSpec SizegripElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, SizegripElementSize, SizegripElementDraw }; @@ -781,8 +781,8 @@ static Ttk_ElementSpec BackgroundElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, - NullElementGeometry, + TtkNullElementOptions, + TtkNullElementGeometry, BackgroundElementDraw }; @@ -823,8 +823,8 @@ static Ttk_ElementSpec ToolbarBackgroundElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, - NullElementGeometry, + TtkNullElementOptions, + TtkNullElementGeometry, ToolbarBackgroundElementDraw }; @@ -861,7 +861,7 @@ static Ttk_ElementSpec TreeHeaderElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, ButtonElementGeometryNoPadding, TreeHeaderElementDraw }; @@ -920,7 +920,7 @@ TTK_END_LAYOUT * +++ Initialization. */ -int AquaTheme_Init(Tcl_Interp *interp) +static int AquaTheme_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_CreateTheme(interp, "aqua", NULL); @@ -988,7 +988,7 @@ int AquaTheme_Init(Tcl_Interp *interp) return TCL_OK; } -int Ttk_MacPlatformInit(Tcl_Interp *interp) +MODULE_SCOPE int Ttk_MacOSXPlatformInit(Tcl_Interp *interp) { return AquaTheme_Init(interp); } diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c index b13c36d..345eed9 100644 --- a/win/ttkWinMonitor.c +++ b/win/ttkWinMonitor.c @@ -1,4 +1,4 @@ -/* $Id: ttkWinMonitor.c,v 1.1 2006/10/31 01:42:28 hobbs Exp $ +/* $Id: ttkWinMonitor.c,v 1.2 2006/11/03 03:06:22 das Exp $ */ #ifdef _MSC_VER @@ -146,10 +146,10 @@ WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) * Windows-specific platform initialization: */ -extern int WinTheme_Init(Tcl_Interp *, HWND hwnd); -extern int XPTheme_Init(Tcl_Interp *, HWND hwnd); +extern int TtkWinTheme_Init(Tcl_Interp *, HWND hwnd); +extern int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd); -int Ttk_WinPlatformInit(Tcl_Interp *interp) +MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp) { HWND hwnd; diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index eb3a9eb..73010f3 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -1,6 +1,6 @@ /* winTheme.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net> * - * $Id: ttkWinTheme.c,v 1.1 2006/10/31 01:42:28 hobbs Exp $ + * $Id: ttkWinTheme.c,v 1.2 2006/11/03 03:06:22 das Exp $ */ #ifdef _MSC_VER @@ -155,7 +155,7 @@ static Ttk_ElementSpec FrameControlElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, FrameControlElementGeometry, FrameControlElementDraw }; @@ -392,7 +392,7 @@ static Ttk_ElementSpec FocusElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, FocusElementGeometry, FocusElementDraw }; @@ -519,8 +519,8 @@ static Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, - NullElementGeometry, + TtkNullElementOptions, + TtkNullElementGeometry, TroughElementDraw }; @@ -665,7 +665,7 @@ static Ttk_ElementSpec ClientElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, ClientElementGeometry, ClientElementDraw }; @@ -691,7 +691,7 @@ TTK_END_LAYOUT /* ---------------------------------------------------------------------- */ -int WinTheme_Init(Tcl_Interp *interp, HWND hwnd) +MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd) { Ttk_Theme themePtr, parentPtr; FrameControlElementData *fce = FrameControlElements; diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 107aa55..d8748c0 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkWinXPTheme.c,v 1.1 2006/10/31 01:42:28 hobbs Exp $ + * $Id: ttkWinXPTheme.c,v 1.2 2006/11/03 03:06:22 das Exp $ * * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. @@ -535,7 +535,7 @@ static Ttk_ElementSpec GenericElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, GenericElementGeometry, GenericElementDraw }; @@ -574,7 +574,7 @@ static Ttk_ElementSpec ThumbElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, GenericElementGeometry, ThumbElementDraw }; @@ -606,7 +606,7 @@ static Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, PbarElementGeometry, GenericElementDraw }; @@ -647,7 +647,7 @@ static Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, GenericElementGeometry, TabElementDraw }; @@ -687,7 +687,7 @@ static Ttk_ElementSpec TreeIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), - NullElementOptions, + TtkNullElementOptions, GenericElementGeometry, TreeIndicatorElementDraw }; @@ -933,7 +933,7 @@ static ElementInfo ElementInfoTable[] = { * +++ Initialization routine: */ -int XPTheme_Init(Tcl_Interp *interp, HWND hwnd) +MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { XPThemeData *themeData; XPThemeProcs *procs; @@ -976,7 +976,7 @@ int XPTheme_Init(Tcl_Interp *interp, HWND hwnd) Ttk_RegisterCleanup(interp, clientData, DestroyElementData); } - Ttk_RegisterElementSpec(themePtr, "Scale.trough", &NullElementSpec, 0); + Ttk_RegisterElementSpec(themePtr, "Scale.trough", &ttkNullElementSpec, 0); /* * Layouts: |