1/* 2 * Copyright (c) 2008 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * The contents of this file constitute Original Code as defined in and 7 * are subject to the Apple Public Source License Version 1.1 (the 8 * "License"). You may not use this file except in compliance with the 9 * License. Please obtain a copy of the License at 10 * http://www.apple.com/publicsource and read it before using this file. 11 * 12 * This Original Code and all software distributed under the License are 13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the 17 * License for the specific language governing rights and limitations 18 * under the License. 19 * 20 * @APPLE_LICENSE_HEADER_END@ 21 */ 22 23#ifndef GENERIC_H 24#define GENERIC_H 25#include "statistic.h" 26 27/* A value large enough for a 64-bit number string rep (greater actually). */ 28enum { GENERIC_INT_SIZE = 30 }; 29 30struct generic_cell { 31 char *string; 32 size_t allocated_length; 33 size_t length; 34}; 35 36struct generic_cells { 37 struct generic_cell *array; 38 int max_width; /* The maximum width for a generic_cell. */ 39 size_t length; 40 size_t length_allocated; 41}; 42 43enum { 44 GENERIC_DRAW_LEFT, /* Draw with an achor to the left. */ 45 GENERIC_DRAW_CENTERED, /* Draw text as centered as possible. */ 46 GENERIC_DRAW_RIGHT /* Draw text anchored to the right. */ 47}; 48 49void generic_draw_aligned(struct statistic *s, int x); 50void generic_draw(struct statistic *s, int x); 51void generic_draw_extended(struct statistic *s, int x, int y, int anchor, 52 const char *string, int slen); 53void generic_draw_centered(struct statistic *s, int x); 54void generic_draw_right(struct statistic *s, int x); 55bool generic_resize_cells(struct statistic *s, struct statistic_size *size); 56bool generic_move_cells(struct statistic *s, int x, int y); 57void generic_get_request_size(struct statistic *s); 58bool generic_insert_cell(struct statistic *s, const char *sample); 59void generic_reset_insertion(struct statistic *s); 60void generic_get_minimum_size(struct statistic *s); 61 62#endif /*GENERIC_H*/ 63