def build_widget_structure(self):
        """Create objects which compose the panel."""
        ### create a current path entry

        ## width is the length between the left of
        ## the current path entry defined on the file
        ## manager and the right of the file manager
        ## (with a bit of padding)

        width = (self.fm.rect.right - 18) - (
            self.fm.rect.left + self.fm.navigation_entry_offset[0]
        )

        ## creation

        self.navigation_entry = StringEntry(
            str(self.current_dir),
            loop_holder=self.fm,
            font_height=FONT_HEIGHT,
            foreground_color=NORMAL_PATH_FG,
            background_color=NORMAL_PATH_BG,
            command=self.load_from_entry,
            validation_command=ensure_valid_dir,
            width=width,
        )

        ### create and store buttons

        for button_fg_surf, button_attr_name, behaviour in (
            (HOME_BUTTON_SURF, "home_button", self.load_home),
            (
                RELOAD_DIR_BUTTON_SURF,
                "reload_dir_button",
                self.load_current_dir_contents,
            ),
            (PARENT_BUTTON_SURF, "parent_button", self.load_parent),
            (NEW_FILE_BUTTON_SURF, "new_file_button", self.present_new_file_form),
            (NEW_FOLDER_BUTTON_SURF, "new_folder_button", self.present_new_folder_form),
        ):

            ## create button

            # button with surface filled with background
            # color

            button = Object2D.from_surface(
                render_rect(
                    *button_fg_surf.get_size(),
                    color=BUTTON_BG,
                )
            )

            # combine both surfs

            blit_aligned(
                surface_to_blit=button_fg_surf,
                target_surface=button.image,
                retrieve_pos_from="center",
                assign_pos_to="center",
            )

            # improve style
            draw_depth_finish(button.image)

            ## assign behaviour
            button.on_mouse_release = get_oblivious_callable(behaviour)

            ## store button in attribute
            setattr(self, button_attr_name, button)

        ### create a control variable to keep track of frame
        ### where mouse release events happen
        self.last_release_frame = 0

        ### create path objects
        self.create_path_objects()

        ### create and store surface to use as background

        self.image = render_rect(*self.path_objs.rect.size, NORMAL_PATH_BG)

        draw_border(self.image)  # XXX is this needed?
Create objects which compose the panel.
nodezator/fileman/dirpanel/main.py