need help putting up/down arrows into Small square



=====
Organization: Thought Unlimited.  Public service Unix since 1986.
Of_Interest: With 28 years  of service  to the  Unix  community.


Guys,

I've been at this before noon; bushed.  it compiles as-is with 
GTK 2.0 but if you use 3.0 you need to comment out the lines around 
+47.

since nobody out there in GTK land can help I  am going back to the wayi
did most of the program.  brrute force.  I figure if I can cram the 
up and down arrows into a small square then I will be able to expand the 
TOPLEVEL window into something like 850 by 1500 and put my 30 to 50
text.[i].txt into the large rectange.  take it from there.

Encl arrow.c


-- 
 Gary Kline  kline thought org  http://www.thought.org  Public Service Unix
             Twenty-eight years of service to the Unix community.



  /*
     COMPILE WITH:
     gcc -Wall -Wextra -g arrow.c -o arrow `pkg-config --cflags gtk+-2.0`
     `pkg-config --libs gtk+-2.0`       
   */
#include <gtk/gtk.h>
  /*
     Create an Arrow widget with the specified parameters
     * and pack it into a button 
   */
  GtkWidget * create_arrow_button (GtkArrowType arrow_type,
                                   GtkShadowType shadow_type)
{
  GtkWidget *button;
  GtkWidget *arrow;

  button = gtk_button_new ();
  arrow = gtk_arrow_new (arrow_type, shadow_type);

  gtk_container_add (GTK_CONTAINER (button), arrow);

  gtk_widget_show (button);
  gtk_widget_show (arrow);

  return (button);
}

int
main (int argc, char *argv[])
{
  /*
     GtkWidget is the storage type for widgets 
   */
  GtkWidget *window;
  GtkWidget *button;
  GtkWidget *box;
  GtkWidget *hbox, *vbox;

  /*
     Initialize the toolkit 
   */
  gtk_init (&argc, &argv);

  /*
     Create a new window 
   */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size (GTK_WINDOW (window), 850, 100);

  /*
     Sets the border width of the window. 
   */
  gtk_container_set_border_width (GTK_CONTAINER (window), 10);

  /*
     It's a good idea to do this for all windows.
     gtk_signal_connect (GTK_OBJECT (window), "destroy",
     GTK_SIGNAL_FUNC (gtk_main_quit), NULL); 
   */

  /*
     Create a box to hold the arrows/buttons 
   */
  box = gtk_hbox_new (FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (box), 2);
  gtk_container_add (GTK_CONTAINER (window), box);

  button = create_arrow_button (GTK_ARROW_UP, GTK_SHADOW_IN);
  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);

  button = create_arrow_button (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);

  //hbox = gtk_hbox_new(FALSE, 2);

  gtk_widget_show_all (window);

  /*
     Rest in gtk_main and wait for the fun to begin! 
   */
  gtk_main ();

  return (0);
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]