Difference between revisions of "Tabbed Gadget Class"

From wiki.amiga.org
Jump to navigation Jump to search
Line 82: Line 82:
 
==ATTRIBUTES==
 
==ATTRIBUTES==
  
        GA_BackFill (struct Hook *)
+
;        GA_BackFill (struct Hook *)
        REACTION_BackFill
+
:        REACTION_BackFill
            GM_RENDER installs the given backfill hook before doing its
+
:        GM_RENDER installs the given backfill hook before doing it's rendering
            rendering
+
:        Applicability is (OM_NEW, OM_SET, OM_UPDATE)
  
            Applicability is (OM_NEW, OM_SET, OM_UPDATE)
+
;        TABBED_Labels (STRPTR *)
 +
:            A NULL-terminated array of string pointers. Replaces all tabs.
 +
:            The previous tab list is freed. Each string in the array gives
 +
:            a new tab. The tbn_ID field of each tab is initialized with a
 +
:            sequential number starting at 0 for the first tab.
 +
:            Applicability is (OM_NEW, OM_SET, OM_UPDATE)
  
        TABBED_Labels (STRPTR *)
+
;        TABBED_Active (ULONG)
            A NULL-terminated array of string pointers. Replaces all tabs.
+
:            Sets or returns the place number of the currently active tab.
            The previous tab list is freed. Each string in the array gives
+
:            -1 means no tab is active. Defaults to -1.
            a new tab. The tbn_ID field of each tab is initialized with a
+
:            Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE, OM_NOTIFY)
            sequential number starting at 0 for the first tab.
 
  
            Applicability is (OM_NEW, OM_SET, OM_UPDATE)
+
;        TABBED_ActiveNode (struct TabbedNode *)
 
+
:            Sets or returns a pointer to the TabbedNode of the currently
        TABBED_Active (ULONG)
+
:            active tab. Defaults to NULL.
            Sets or returns the place number of the currently active tab.
+
;            Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE, OM_NOTIFY)
            -1 means no tab is active. Defaults to -1.
 
 
 
            Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE, OM_NOTIFY)
 
 
 
        TABBED_ActiveNode (struct TabbedNode *)
 
            Sets or returns a pointer to the TabbedNode of the currently
 
            active tab. Defaults to NULL.
 
 
 
            Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE, OM_NOTIFY)
 
  
 
         TABBED_ActiveID (ULONG)
 
         TABBED_ActiveID (ULONG)
Line 249: Line 244:
  
  
�tabbed_gc/--background--                            tabbed_gc/--background--
+
tabbed_gc/--background--                            tabbed_gc/--background--
  
 
     BACKGROUND
 
     BACKGROUND
Line 322: Line 317:
  
  
�tabbed_gc/TABBED_GetClass                          tabbed_gc/TABBED_GetClass
+
tabbed_gc/TABBED_GetClass                          tabbed_gc/TABBED_GetClass
  
 
     NAME
 
     NAME

Revision as of 15:06, 18 April 2021

Tabbed Gadget V54
Tabbed Gadget V46

Datasheet

NAME
tabbed.gadget -- Create a tabbed bar
SUPERCLASS
gadgetclass
REQUIRES
DESCRIPTION
The tabbed gadget class is used to create a clickable bar with a variable number of tabs (like index cards).

Supported methods

Method ID Description
OM_NEW Passed to superclass, defaults set, then OM_SET.
OM_SET Passed to superclass, custom tags set. Calls GM_RENDER if gps_GInfo is supplied.
OM_GET Custom tag returned or passed to superclass.
OM_UPDATE Same as OM_SET
OM_NOTIFY Tag set then passed to superclass.
OM_DISPOSE Free all TabbedNodes and all temporary gfx memory, then passed to superclass.
GM_RENDER Render tab bar.
GM_HITTEST Checks which tab was hit and returns GMR_GADGETHIT if one was hit.
GM_GOACTIVE Re-renders the tab bar with the new active tab highlighted.
GM_HANDLEINPUT Processes input. If the clicked tab was inactive, it acts like a button and becomes active if the mouse button was released over it. If the clicked tab was the active one, it can be dragged left or right.
GM_GOINACTIVE Re-renders the tab bar with the new active tab highlighted.
GM_DOMAIN Returns the required dimensions matching the value in gpd_Which.
GM_LAYOUT calculates the size and position of each tab relative to the total space given.
TGM_ADDTAB Inserts a new tab with the given labal and flags at the given position. Returns a pointer to the TabbedNode of the new tab or NULL in case of failure. Calls GM_RENDER if tgp_GInfo is supplied.
TGM_REMTAB Removes the tab at the given position and frees the TabbedNode.Calls GM_RENDER if tgp_GInfo is supplied.
TGM_MOVETAB Moves the tab at the given position to the new position. Calls GM_RENDER if tgp_GInfo is supplied.
TGM_ADDNODE Inserts a new tab before the given successor TabbedNode. If tgp_Succ is NULL the new tab is added to the end of the list. Returns a pointer to the TabbedNode of the new tab or NULL in case of failure. Calls GM_RENDER if tgp_GInfo is supplied.
TGM_REMNODE Removes the given TabbedNode and frees its memory.Calls GM_RENDER if tgp_GInfo is supplied.
TGM_MOVENODE Removes the given TabbedNode and inserts it back before the new successor. Calls GM_RENDER if tgp_GInfo is supplied.

ATTRIBUTES

GA_BackFill (struct Hook *)
REACTION_BackFill
GM_RENDER installs the given backfill hook before doing it's rendering
Applicability is (OM_NEW, OM_SET, OM_UPDATE)
TABBED_Labels (STRPTR *)
A NULL-terminated array of string pointers. Replaces all tabs.
The previous tab list is freed. Each string in the array gives
a new tab. The tbn_ID field of each tab is initialized with a
sequential number starting at 0 for the first tab.
Applicability is (OM_NEW, OM_SET, OM_UPDATE)
TABBED_Active (ULONG)
Sets or returns the place number of the currently active tab.
-1 means no tab is active. Defaults to -1.
Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE, OM_NOTIFY)
TABBED_ActiveNode (struct TabbedNode *)
Sets or returns a pointer to the TabbedNode of the currently
active tab. Defaults to NULL.
Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE, OM_NOTIFY)
       TABBED_ActiveID (ULONG)
           When a new tab becomes active, the ICA_TARGET is notifed with
           this tag. Contains the tbn_ID of the active TabbedNode or -1
           if no tab is active. Defaults to -1.
           Applicability is (OM_NOTIFY)
       TABBED_Skew (ULONG)
           Sets or returns the level of skewing. For rounded corners it
           defines the radius of the rounding. Defaults to 8.
           Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE)
       TABBED_Rounded (BOOL)
           Selects whether the tabs have rounded corners (TRUE) or are
           skewed squares (FALSE). Defaults to FALSE.
           Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE)
       TABBED_Font (struct TextFont *)
           Sets the font used by tab labels. Defaults to the screen font.
           Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE)
       TABBED_MinWidth (ULONG)
           Minimum width of each tab. Useful when using TBNF_NameIsHook
           because the hook does not have a width or if the labels are
           very short. Defaults to 0.
           Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE)
       TABBED_AllowDragging (BOOL)
           Selects whether tabs can be reordered by dragging the active tab
           with the mouse (TRUE) or not (FALSE). Defaults to FALSE.
           Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE)
       TABBED_FirstNode (struct TabbedNode *)
           Returns a pointer to the TabbedNode of the first tab in the list.
           Returns NULL if there are no tabs.
           Applicability is (OM_GET)
       TABBED_LastNode (struct TabbedNode *)
           Returns a pointer to the TabbedNode of the last tab in the list.
           Returns NULL if there are no tabs.
           Applicability is (OM_GET)
       TABBED_TabMovedFrom (ULONG)
       TABBED_TabMovedTo (ULONG)
           If the user has dragged a tab to a new position, the ICA_TARGET 
           is notified with these tags.
           Note that only the active tab can be dragged. So if you receive
           an update with these tags, you can get the TABBED_ActiveNode
           attribute to find out details about the dragged node.
           Applicability is (OM_NOTIFY)
       TABBED_SmallWidth (ULONG)
           Like TABBED_MinWidth, but for tabs with TBNF_SmallTab set.
           Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE)


       TABBED_Pens (UWORD *)
           Points to an array of pen numbers. The entries match those in
           the dri_Pens field of struct DrawInfo (see intuition/screens.h).
           The array does not need to be terminated, but it must contain
           all these entries:
           SHINEPEN         -> bright edges of the border surrounding each tab
           SHADOWPEN        -> dark edges and shadow of the active tab's label
           HIGHLIGHTTEXTPEN -> label of the active tab
           FILLTEXTPEN      -> label of a tab when the user clicks on it
           TEXTPEN          -> label of all other tabs
           DETAILPEN        -> background of the active tab
           FILLPEN          -> background of a tab when the user clicks on it
           BACKGROUNDPEN    -> background of all other tabs
           HIGHLIGHTTEXTPEN is the highest index which means the array must
           contain at least 9 entries.
           If set to NULL the pens from the screen the GUI runs on are used.
           Defaults to NULL.
           Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE)
       TABBED_CloseImage (struct Image *)
           Sets the image used for nodes with the TBNF_HasCloseButton flag
           set. A BOOPSI image is preferred. If not set it defaults to a 
           small round button with a cross in it.
           Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE)
       TABBED_CloseImagePens (UWORD *)
           This tag is forwarded to the TABBED_CloseImage object as IA_Pens.
           Points to an array of pen numbers. The entries match those in
           the dri_Pens field of struct DrawInfo (see intuition/screens.h).
           For the default close button image the array does not need to be
           terminated, but it must contain all these entries:
           FILLPEN       -> the area inside the button
           SHINEPEN      -> the bright edges of the outer border and
                            the inner of the cross if not selected
           SHADOWPEN     -> the dark edges of the outer border and
                            the outer of the cross
           BACKGROUNDPEN -> the inner of the cross when selected
           BACKGROUNDPEN is the highest index which means the array must
           contain at least 8 entries.
           If set to NULL the pens from the screen the GUI runs on are used.
           Defaults to NULL.
           Applicability is (OM_NEW, OM_SET, OM_GET, OM_UPDATE)
       TABBED_ClosedTab (ULONG)
       TABBED_ClosedNode (struct TabbedNode *)
       TABBED_ClosedID (ULONG)
           When the close button of a tab was clicked by the user, the
           ICA_TARGET will be notified about these tags.
           TABBED_ClosedTab is the place in the list of the clicked tab.
           TABBED_ClosedNode is the TabbedNode of the clicked tab.
           TABBED_ClosedID is the tbn_ID of the clicked tab.
           Applicability is (OM_GET, OM_NOTIFY)
       TABBED_ClickedTab (ULONG)
       TABBED_ClickedNode (struct TabbedNode *)
       TABBED_ClickedID (ULONG)
           When a tab with the TBNF_DontActivate flag set was clicked by the
           user, the ICA_TARGET will be notified about these tags.
           TABBED_ClickedTab is the place in the list of the clicked tab.
           TABBED_ClickedNode is the TabbedNode of the clicked tab.
           TABBED_ClickedID is the tbn_ID of the clicked tab.
           Applicability is (OM_GET, OM_NOTIFY)


tabbed_gc/--background-- tabbed_gc/--background--

   BACKGROUND
     Initially tabbed class only supported setting the list of tabs through
     the TABBED_Labels attribute. This has kind of static character. Although
     you could set it to a new value at any time, it would always replace the
     whole list of tabs. And tabs could only have textual labels.
     Internally it always worked with a linked list of TabbedNode structures,
     therefore new methods were introduced which allow basic access to the
     internal TabbedNodes.
     While TGM_ADDTAB, TGM_REMTAB and TGM_MOVETAB still work with place numbers,
     TGM_ADDNODE, TGM_REMNODE and TGM_MOVENODE allow to use node pointers.
     Still you have to use TGM_ADDTAB or TGM_ADDNODE to create a new tab. You
     must not allocate your own TabbedNode and insert it into the list!
     The ln_Name field holds a pointer to the label. Depending on tbn_Flags
     this pointer can be interpreted in different ways:
     TBNF_NameIsLabel      -> ln_Name points to a string
     TBNF_NameIsIntuiText  -> ln_Name points to a struct IntuiText
     TBNF_NameIsImage      -> ln_Name points to a struct Image or to a
                              BOOPSI image object
     TBNF_NameIsHook       -> ln_Name points to a struct Hook. This is
                              very similar to GTLV_CallBack in GadTools.
     There is one flag which is only relevant when the tab is added by
     TGM_ADDTAB or TGM_ADDNODE:
     TBNF_Activate -> if this flag is set, the new tab will become the
                      active one.
     These flags are for advanced functions:
     TBNF_HasCloseButton   -> this flag adds a close button to the tab. The
                              image used can be set by the TABBED_CloseImage
                              tag. The size of the close button adds to the 
                              minimum width of the tab.
                              When the user clicks the close button, there 
                              will be no action except that the application
                              is notified about the TABBED_ClosedTab,
                              TABBED_ClosedNode and TABBED_ClosedID tags.


     TBNF_SmallTab         -> if this flag is set, the tab will stay at its 
                              minimum width and won't be resized like regular
                              tabs.
                              You can define a minimum width for all tabs
                              with the TBNF_SmallTab flag set using the
                              TABBED_SmallWidth tag.
     TBNF_DontActivate     -> if this flag is set, the tab won't become the
                              active tab when the user clicks on it. The
                              application will be notified via the 
                              TABBED_ClickedTab, TABBED_ClickedNode and
                              TABBED_ClickedID tags.
     TBNF_StopDrag         -> if this flag is set, the user cannot drag other
                              tabs beyond this one. It is especially useful
                              if the tab shall stay at the end or at the
                              beginning of the list. But it can also be used
                              to seperate groups of tabs.



   SEE ALSO
     gadgets/tabbed.h


tabbed_gc/TABBED_GetClass tabbed_gc/TABBED_GetClass

   NAME
       TABBED_GetClass -- Gets the pointer to the tabbed class (deprecated).
   SYNOPSIS
       tabbed_class = TABBED_GetClass();
       D0
       Class * TABBED_GetClass(VOID);
   FUNCTION
       For compatibility with ClassAct and ReAction on OS 3 the class
       library contains this function at offset -30 which returns the
       class pointer.
       The preferred method to obtain the class pointer is to read it
       from the cl_Class field of the library base.
   INPUTS
       Nothing.
   RESULT
       tabbed_class - Pointer to the Tabbed gadget class.
   SEE ALSO