Panel Functions



OtkWidget OtkMakePanel( OtkWidget container, int panel_type, OtkColor color, float left, 
                                  float top, float width, float height );

        Returns OtkWidget.  Container is the parent container-panel, onto which the new panel 
	is placed, and to whose frame the coordinates will be relative.
        Panel types are one of: Otk_Flat, Otk_Raised, Otk_Recessed.
        Color is an OtkColor record.



void OtkResizePanel( OtkWidget panel, float left, float top, float horiz_size, float vert_size )

	Changes a panel's position and size.  The referenced panel's upper left corner will be placed
	at the horizontal and vertical position of left and top, relative to percentage
	of the panel's parent or container window.  Allowable values range from 0.0 to 100.0, and
	are considered as percent values (example: 50.0%).  The size of the panel will be set to
	horiz_size and vert_size, again specified in percent of the parent panel/window size.
	In other words, the lower left corner of the panel will be (left+horiz_size, top+vert_size).
	Care should be taken to prevent left+horiz_size from exceeding 100.0%, and to prevent
	top+vert_size from exceeding 100.0%.



void Otk_Set_Object_Border_Thickness( OtkWidget container, float thickness )

	This function changes the border thickness of Otk_Raised and Otk_Recessed panels.
	Such panels include buttons and other gadgets.  The border is changed from the default
	thickness by a scale factor passed as thickness.  A value of 1.0 leaves the
	border at it's default thickness.  A value of 0.5 decreases the border thickness to
	one-half the default.



void Otk_Set_Default_Border_Thickness( float thickness )

	This function changes the border thickness of all Otk_Raised mad Otk_Recessed panels created
	after calling this.  Such panels include buttons and other gadgets.  The default border 
	thickness is changed by a scale factor passed as thickness.  A value of 1.0 leaves the
	border at it's default thickness.  A value of 0.5 decreases the border thickness to
	one-half the original default.



OtkTabbedPanel *Otk_Tabbed_Panel_New( OtkWidget parent, int num, char **names, OtkColor color, 
                                      float left, float top, float width, float height, float button_height )

        This function creates tabbed panels.  Tabbed panels are a series of panels
	directly atop one another, except for small tabs at the top edge.  By pressing
	a tab, the desired panel comes to the top.

	To use this function, you must create an array of character-strings (**names), and initialize
	them to the names you wish to appear on the tabs of the panels.  All panels are
	created in a single call.  The color parameter sets the panel background color.

	The left, top, width, and height parameters set the position and size of the panel-stack
	on the parent window/panel.  The button_height parameter set the relative height of the
	tabs.  All positions and sizes are in percentage of the parent window.

	Once created, you can then add objects on the respective panels.
	Otk_Tabbed_Panel_New returns a OtkTabbedPanel structure. The panels field is
	an array of OtkWidget panels.  For example:

		 {
		  OtkWidget panel1, panel2;
		  char *pnames[2];
		  OtkTabbedPanel *tabs;

		  pnames[0] = strdup("Pane1 One");
		  pnames[1] = strdup("Panel Two");
		  tabs = Otk_Tabbed_Panel_New( OtkOuterWindow, 2, pnames, Otk_Gray, 15, 20, 70, 70, 8 );
		  panel1 = tabs->panels[0];
		  panel2 = tabs->panels[1];

	For example usage, see: tabbed_panels_ex1.c



OtkWidget OtkMakeImagePanel( OtkWidget container, char *image_file_name, float left, float top, 
								float horiz_size, float vert_size )

	This function accesses the named image file, and creates a rectangular panel containing the image.
	It is useful for icons, logos, or to add arbitrary background textures.  Specify the position and
	size of where the image should appear relative to the container-panel (or OtkOuterWindow) on which
	it is added.  Presently PPM, PNM, and PGM image file formats (binary/raw or ascii, color and b&w)
	are supported natively.  Other formats such as JPEG, PNG, or GIF are attempted to be automatically
	converted on-the-fly, assuming standard image conversion utilities are on your system.  
	(You can also convert images to PNM via a variety of other tools, such as GIMP, ImageMagick, Net-PBM, 
	XV, etc..) 	

	To use compressed images with a self-contained decompressor to ensure proper operation on all 
	platforms, without depending on external functions, compile with the small SCZ Image Compression
	Library.  Convert your image file to .ppm format, and then compress with image_scz. 
	Image sizes will be significantly reduced, and Otk applications will automatically view them.

	Click here to find more about handling images in Otk.

  

Back to main page

SourceForge.net Logo