简体   繁体   English

GTK + 3如何指定堆栈的子属性

[英]Gtk+3 How to specify child properties of stack

I am new to gtk and I am trying to build a gtk application. 我是gtk的新手,正在尝试构建gtk应用程序。

I went through the gtk tutorial to create gtk application. 我通过了gtk教程来创建gtk应用程序。

I want to specify "gtk stack child property title" in xml which is loaded via gktbuilder. 我想在通过gktbuilder加载的xml中指定“ gtk堆栈子属性标题”。

How can I specify "gtk stack child property title" in xml and where can I get manual for the xml I cannot find it anywhere? 如何在xml中指定“ gtk堆栈子属性标题”,以及在哪里可以找到的xml手册?

<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <!-- interface-requires gtk+ 3.8 -->
  <object class="GtkWindow" id="window">
<property name="title" translatable="yes">GLocalshare</property>

<property name="default-width">600</property>
<property name="default-height">400</property>
<child>
  <object class="GtkBox" id="content_box">
    <property name="visible">True</property>
    <property name="orientation">vertical</property>
    <child>
      <object class="GtkHeaderBar" id="header">
        <property name="visible">True</property>
        <property name="show-close-button">True</property>

        <child type="title">
          <object class="GtkStackSwitcher" id="tabs">
            <property name="visible">True</property>
            <property name="margin">6</property>
            <property name="stack">stack</property>
    <child>
    </child>

      </object>
    </child>
          </object>
    </child>
    <child>
      <object class="GtkStack" id="stack">
        <property name="visible">True</property>
    <property name="visible-child">label1</property>
    <child>

      <object class="GtkLabel" id="label1">
    <property name="visible">True</property>
    <property name="label">label1</property>
    <property name="title">label1</property>
    <property name="name">label1</property>
      </object>
    </child>
    <child >

      <object class="GtkLabel" id="label2">
    <property name="title">label2</property>
    <property name="visible">True</property>
    <property name="label">label2</property>
    <property name="name">label2</property>
      </object>
       </child>
      </object>
    </child>
  </object>
</child>
 </object>
</interface>

You can find the documentation on this here , in the sections "Child properties" and "GtkContainer as GtkBuildable": 你可以找到这个文件在这里 ,在部分“儿童性”和“GtkContainer为GtkBuildable”:

The GtkContainer implementation of the GtkBuildable interface supports a <packing> element for children, which can contain multiple <property> elements that specify child properties for the child. GtkBuildable接口的GtkContainer实现支持子元素的<packing>元素,该元素可以包含多个<property>元素,这些元素为子元素指定子属性。 An example of child properties in UI definitions: UI定义中的子属性的示例:

 <object class="GtkVBox"> <child> <object class="GtkLabel"/> <packing> <property name="pack-type">start</property> </packing> </child> </object> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM