The OpenNET Project / Index page

[ ÎÏ×ÏÓÔÉ /+++ | ÆÏÒÕÍ | ÔÅÇÉ | ]

ëÁÔÁÌÏÇ ÄÏËÕÍÅÎÔÁÃÉÉ / òÁÚÄÅÌ "ðÒÏÇÒÁÍÍÉÒÏ×ÁÎÉÅ, ÑÚÙËÉ" / ïÇÌÁ×ÌÅÎÉÅ ÄÏËÕÍÅÎÔÁ

ðÒÉÍÅÒ ÎÁ GtkTable

óÌÅÄÕÀÝÉÊ ËÏÄ ÓÏÚÄÁÅÔ ÔÁÂÌÉÃÕ Ó ÞÅÔÙÒØÍÑ ÑÞÅÊËÁÍÉ É ÔÒÅÍÑ ÄÅÔØÍÉ; ÏÄÉÎ ÒÅÂÅÎÏË ÐÏËÒÙ×ÁÅÔ Ä×Å ÑÞÅÊËÉ. äÅÔÉ ÕÐÁËÏ×ÁÎÙ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÒÁÚÌÉÞÎÙÈ ÐÁÒÁÍÅÔÒÏ×:

GtkWidget *window;
GtkWidget *button;
GtkWidget *container;

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
container = gtk_table_new(2, 2, FALSE);

gtk_container_add(GTK_CONTAINER(window), container);
gtk_window_set_title(GTK_WINDOW(window), "Table Attaching");
gtk_container_set_border_width(GTK_CONTAINER(container), 10);

/* This would be a bad idea in real code; but it lets us
 * experiment with window resizing. */
gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE);

gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                   GTK_SIGNAL_FUNC(delete_event_cb), NULL);

button = gtk_button_new_with_label("1. Dosn't shrink\nor expand");
gtk_table_attach(GTK_TABLE(container), button, 0, 1, 0, 1,
                 GTK_FILL, GTK_FILL, 0, 0);

button = gtk_button_new_with_label("2. Expands and shrinks\nvertically");
gtk_table_attach(GTK_TABLE(container), button, 0, 1, 1, 2,
                 GTK_FILL, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
                 0, 0);

button = gtk_button_new_with_label("3. Expands and shrinks\n"
                                   "in both directions");
gtk_table_attach(GTK_TABLE(container), button, 1, 2, 0, 2,
                 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
                 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0);

ðÏÕÞÉÔÅÌØÎÏ ÐÏÓÍÏÔÒÅÔØ ÎÁ ÒÅÚÕÌØÔÉÒÕÀÝÕÀ ÔÁÂÌÉÃÕ ÐÏÓÌÅ ÉÚÍÅÎÅÎÉÑ ÒÁÚÍÅÒÏ× ÏËÎÁ. óÎÁÞÁÌÁ, ËÒÁÔËÏÅ ÉÚÌÏÖÅÎÉÅ ÔÏÇÏ, ËÁË ÐÒÉÓÏÅÄÉÎÑÀÔÓÑ ÄÅÔÉ:

  1. ðÅÒ×ÙÊ ÒÅÂÅÎÏË ×ÓÅÇÄÁ ÐÏÌÕÞÁÅÔ Ó×ÏÊ ÚÁÔÒÅÂÏ×ÁÎÎÙÊ ÒÁÚÍÅÒ; ÏÎ ÎÅ ÒÁÓÛÉÒÑÅÔÓÑ É ÎÅ ÕÒÅÚÁÅÔÓÑ.
  2. ÷ÔÏÒÏÊ ÒÅÂÅÎÏË ÍÏÖÅÔ ÒÁÓÛÉÒÑÔØÓÑ É ÕÒÅÚÁÔØÓÑ ÔÏÌØËÏ × ÎÁÐÒÁ×ÌÅÎÉÉ ÏÓÉ Y.
  3. ôÒÅÔÉÊ ÒÅÂÅÎÏË ÍÏÖÅÔ ÒÁÓÛÉÒÑÔØÓÑ É ÏÂÒÅÚÁÔØÓÑ × ÌÀÂÏÍ ÎÁÐÒÁ×ÌÅÎÉÉ.

îÁÔÕÒÁÌØÎÙÊ ÒÁÚÍÅÒ ÏËÎÁ ÐÏËÁÚÁÎ ÎÁ ÒÉÓÕÎËÅ 3..9; ÚÁÍÅÔØÔÅ, ÞÔÏ ÎÅËÏÔÏÒÙÍ ÑÞÅÊËÁÍ ×ÙÄÅÌÅÎÏ ÂÏÌØÛÅ ÍÅÓÔÁ, ÞÅÍ ÐÏÔÒÅÂÏ×ÁÌÉ ×ÉÄÖÅÔÙ ×ÎÕÔÒÉ ÎÉÈ, ÐÏÔÏÍÕ ÞÔÏ ÑÞÅÊËÉ ÔÁÂÌÉÃÙ ÄÏÌÖÎÙ ÏÓÔÁ×ÁÔØÓÑ ×ÙÒÏ×ÎÅÎÎÙÍÉ. (÷ÓÐÏÍÎÉÔÅ, ÞÔÏ ËÎÏÐËÁ Ó ÍÅÔËÏÊ ÂÕÄÅÔ ÔÒÅÂÏ×ÁÔØ ÄÏÓÔÁÔÏÞÎÏ ÍÅÓÔÁ ÔÏÌØËÏ ÄÌÑ ÐÏËÁÚÁ ÍÅÔËÉ ÃÅÌÉËÏÍ.) æÌÁÇ "GTK_FILL" ÚÁÓÔÁ×ÌÑÅÔ GtkTable ×ÙÄÅÌÑÔØ ÄÏÐÏÌÎÉÔÅÌØÎÏÅ ÍÅÓÔÏ ÄÌÑ ÓÁÍÉÈ ×ÉÄÖÅÔÏ×, ×ÍÅÓÔÏ ÚÁÐÏÌÎÅÎÉÑ ÐÕÓÔÙÍ ÍÅÓÔÏÍ ÐÒÏÍÅÖÕÔËÏ× ×ÏËÒÕÇ ÎÉÈ.

òÉÓÕÎÏË 3..9: GtkTable ÐÅÒÅÄ ÉÚÍÅÎÅÎÉÅÍ ÒÁÚÍÅÒÏ×

ôÅÐÅÒØ ÐÒÅÄÓÔÁ×ØÔÅ, ÞÔÏ ÐÏÌØÚÏ×ÁÔÅÌØ ÒÁÓÛÉÒÑÅÔ ÏËÎÏ ÐÏ ×ÅÒÔÉËÁÌÉ; ÚÁÍÅÔØÔÅ, ÞÔÏ ÄÏÐÏÌÎÉÔÅÌØÎÏÅ ÐÒÏÓÔÒÁÎÓÔ×Ï ÄÏÂÁ×ÉÌÏÓØ Ë ×ÉÄÖÅÔÁÍ Ó ×ËÌÀÞÅÎÎÙÍ "GTK_EXPAND" × ÎÁÐÒÁ×ÌÅÎÉÉ Y -- Á ÉÍÅÎÎÏ ×ÉÄÖÅÔÁÍ Ä×Á É ÔÒÉ -- × ÔÏ ×ÒÅÍÑ ËÁË ×ÉÄÖÅÔ × ÌÅ×ÏÍ ×ÅÒÈÎÅÍ ÕÇÌÕ ÏÓÔÁÅÔÓÑ ÎÅÉÚÍÅÎÎÙÍ. òÉÓÕÎÏË 3..10 ÐÏËÁÚÙ×ÁÅÔ ÜÔÏ ÓÏÓÔÏÑÎÉÅ ÄÅÌ.

òÉÓÕÎÏË 3..10: GtkTable ÐÏÓÌÅ ×ÅÒÔÉËÁÌØÎÏÇÏ ÒÁÓÛÉÒÅÎÉÑ

äÁÌÅÅ, ÐÒÅÄÓÔÁ×ØÔÅ, ÞÔÏ ÐÏÌØÚÏ×ÁÔÅÌØ ÒÁÓÛÉÒÉÌ ÏËÎÏ ÇÏÒÉÚÏÎÔÁÌØÎÏ; ÔÏÌØËÏ ÄÏÞÅÒÎÉÊ ×ÉÄÖÅÔ ÎÏÍÅÒ ÔÒÉ ÍÏÖÅÔ ÒÁÓÛÉÒÑÔØÓÑ ÇÏÒÉÚÏÎÔÁÌØÎÏ. òÉÓÕÎÏË 3..11 ÜÔÏ ÐÏËÁÚÙ×ÁÅÔ.

òÉÓÕÎÏË 3..11: GtkTable ÐÏÓÌÅ ÇÏÒÉÚÏÎÔÁÌØÎÏÇÏ ÒÁÓÛÉÒÅÎÉÑ

òÉÓÕÎÏË 3..12 ÐÏËÁÚÙ×ÁÅÔ ÒÅÚÕÌØÔÁÔ ÐÏÓÌÅ ÕÍÅÎØÛÅÎÉÑ ×ÅÒÔÉËÁÌØÎÙÈ ÒÁÚÍÅÒÏ× ÔÁÂÌÉÃÙ, ÔÁËÉÍ ÏÂÒÁÚÏÍ ÎÅÄÏÓÔÁÔÏÞÎÏ ÍÅÓÔÁ ÐÏ ×ÅÒÔÉËÁÌÉ, ÞÔÏÂÙ ×ÙÄÅÌÉÔØ ×ÉÄÖÅÔÁÍ ÔÏ, ÞÔÏ ÏÎÉ ÚÁÐÒÏÓÉÌÉ. òÅÂÅÎÏË ÎÏÍÅÒ Ä×Á ÐÏÌÕÞÉÌÓÑ ÕËÏÒÏÞÅÎÎÙÍ, ÔÏÇÄÁ ËÁË ÒÅÂÅÎÏË ÎÏÍÅÒ ÏÄÉÎ ÐÏÌÕÞÁÅÔ ×ÓÅ ×ÅÒÔÉËÁÌØÎÏÅ ÍÅÓÔÏ, ËÏÔÏÒÏÅ ÅÍÕ ÔÒÅÂÕÅÔÓÑ.

òÉÓÕÎÏË 3..12: GtkTable ÐÏÓÌÅ ×ÅÒÔÉËÁÌØÎÏÇÏ ÓÖÁÔÉÑ

é, ÎÁËÏÎÅÃ, ÒÉÓÕÎÏË 3..13 ÐÏËÁÚÙ×ÁÅÔ ÒÅÚÕÌØÔÁÔ ÔÏÇÏ, ÞÔÏ ÐÏÌØÚÏ×ÁÔÅÌØ ÕÍÅÎØÛÉÌ ÇÏÒÉÚÏÎÔÁÌØÎÙÅ ÒÁÚÍÅÒÙ ÔÁÂÌÉÃÙ. òÅÂÅÎÏË ÎÏÍÅÒ ÔÒÉ × ÜÔÏÊ ÓÉÔÕÁÃÉÉ ÐÏÌÕÞÁÅÔ ËÏÒÏÔËÉÊ ËÏÎÅà ÐÁÌËÉ.

òÉÓÕÎÏË 3..13: GtkTable ÐÏÓÌÅ ÇÏÒÉÚÏÎÔÁÌØÎÏÇÏ ÓÖÁÔÉÑ

îÅÐÌÏÈÏ ÂÙÌÏ ÂÙ ÐÏÐÙÔÁÔØÓÑ ÍÅÎÑÔØ ÒÁÚÍÅÒÙ ×ÁÛÅÇÏ ÏËÎÁ ×ÙÛÅÐÒÉ×ÅÄÅÎÎÙÍ ÏÂÒÁÚÏÍ ×ÓÑËÉÊ ÒÁÚ, ËÏÇÄÁ ×Ù ÐÒÏÅËÔÉÒÕÅÔÅ ÒÁÓËÌÁÄËÕ, ÞÔÏÂÙ ÂÙÔØ Õ×ÅÒÅÎÎÙÍ, ÞÔÏ ×ÓÅ ÐÒÏÈÏÄÉÔ ÎÏÒÍÁÌØÎÏ. ïÐÒÅÄÅÌÅÎÉÅ ÎÏÒÍÁÌØÎÏÓÔÉ ×ÁÒØÉÒÕÅÔÓÑ × ÚÁ×ÉÓÉÍÏÓÔÉ ÏÔ ËÏÎËÒÅÔÎÙÈ ×ÉÄÖÅÔÏ×, ËÏÔÏÒÙÅ ×Ù ÐÏÍÅÝÁÅÔÅ × ÒÁÓËÌÁÄËÕ.


Linux Land
2000-09-15



ðÁÒÔΣÒÙ:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
èÏÓÔÉÎÇ:

úÁËÌÁÄËÉ ÎÁ ÓÁÊÔÅ
ðÒÏÓÌÅÄÉÔØ ÚÁ ÓÔÒÁÎÉÃÅÊ
Created 1996-2024 by Maxim Chirkov
äÏÂÁ×ÉÔØ, ðÏÄÄÅÒÖÁÔØ, ÷ÅÂÍÁÓÔÅÒÕ