fontdbox 4.89 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/* Copyright 1996 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* File:    fontdbox.h
 * Purpose: FontDbox Objects
 * Author:  Timothy G Roddis
 * History: 2-Mar-94: TGR: created
 *
 */

#ifndef __FontDbox_h
#define __FontDbox_h

#ifndef __os_h
#include "os.h"
#endif

#ifndef __window_h
30
#include "objects/window.h"
Neil Turton's avatar
Neil Turton committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
#endif

#ifndef __wimp_h
#include "twimp.h"
#endif

/* FontDbox SWI calls *******************************************************************************/

#define FontDbox_SWIChunkBase    0x82a00
#define FontDbox_ObjectClass     FontDbox_SWIChunkBase
#define FontDbox_ClassSWI        (FontDbox_SWIChunkBase + 0)
#define FontDbox_PostFilter      (FontDbox_SWIChunkBase + 1)
#define FontDbox_PreFilter       (FontDbox_SWIChunkBase + 2)

/* FontDbox SWI flags ***************************************************************************/

#define FontDbox_SetSize_Height   1
#define FontDbox_SetSize_Aspect   2

/* FontDbox Templates *******************************************************************************/

/* flags */

#define FontDbox_GenerateShowEvent    0x00000001
#define FontDbox_GenerateHideEvent    0x00000002
#define FontDbox_IncludeSystemFont    0x00000004

/* templates */

typedef struct
{
        int        flags;
        char      *title;
        int        max_title;
        char      *initial_font;
        int        initial_height;
        int        initial_aspect;
        char      *try_string;
        char      *window;

} FontDboxTemplate;

/* component IDs */

#define FontDbox_ComponentIDBase              (FontDbox_SWIChunkBase<<4)

#define FontDbox_ActionButton_Apply               (FontDbox_ComponentIDBase)
#define FontDbox_ActionButton_Cancel              (FontDbox_ComponentIDBase + 1)
#define FontDbox_ActionButton_Try                 (FontDbox_ComponentIDBase + 2)
#define FontDbox_WritableField_TryString          (FontDbox_ComponentIDBase + 3)
#define FontDbox_NumberRange_AspectRatio          (FontDbox_ComponentIDBase + 4)
#define FontDbox_NumberRange_Height               (FontDbox_ComponentIDBase + 5)
#define FontDbox_ActionButton_StandardSize(A)     (FontDbox_ComponentIDBase + (A+6)) /* For 0 <= A <= 9 */
#define FontDbox_StringSet_Style                  (FontDbox_ComponentIDBase + 16)
#define FontDbox_StringSet_Weight                 (FontDbox_ComponentIDBase + 17)
#define FontDbox_StringSet_Font                   (FontDbox_ComponentIDBase + 18)


/* FontDbox Methods *********************************************************************************/

#define FontDbox_GetWindowID           0
#define FontDbox_SetFont               1
#define FontDbox_GetFont               2
#define FontDbox_SetSize               3
#define FontDbox_GetSize               4
#define FontDbox_SetTryString          5
#define FontDbox_GetTryString          6
#define FontDbox_SetTitle              7
#define FontDbox_GetTitle              8

/* FontDbox Toolbox Events **************************************************************************/

#define FontDbox_AboutToBeShown     FontDbox_SWIChunkBase
#define FontDbox_DialogueCompleted  (FontDbox_SWIChunkBase + 1)
#define FontDbox_ApplyFont          (FontDbox_SWIChunkBase + 2)

typedef struct {
   ToolboxEventHeader hdr;
   int                show_type;
   union {
      struct {
         int                x,y;
      } coords;
      WindowShowObjectBlock full;

   } info;

} FontDbox_AboutToBeShown_Event;

typedef struct {
   ToolboxEventHeader hdr;
} FontDbox_DialogueCompleted_Event;

typedef struct {
   ToolboxEventHeader hdr;
   unsigned int       height;
   unsigned int       aspect;
   char               font[208];
} FontDbox_ApplyFont_Event;


/* FontDbox Errors **********************************************************************************/

#define FontDbox_ErrorBase           (Program_Error | 0x0080AF00)

#define FontDbox_AllocFailed        (FontDbox_ErrorBase+0x01)
#define FontDbox_ShortBuffer        (FontDbox_ErrorBase+0x02)
#define FontDbox_NoSuchTask         (FontDbox_ErrorBase+0x11)
#define FontDbox_NoSuchMethod       (FontDbox_ErrorBase+0x12)
#define FontDbox_NoSuchMiscOpMethod (FontDbox_ErrorBase+0x13)
#define FontDbox_NoSuchFont         (FontDbox_ErrorBase+0x14)
#define FontDbox_NoFonts            (FontDbox_ErrorBase+0x21)
#define FontDbox_NotPersistent      (FontDbox_ErrorBase+0x22)
#define FontDbox_OutOfMessageSpace  (FontDbox_ErrorBase+0x31)
#define FontDbox_TasksActive        (FontDbox_ErrorBase+0x00)

#endif