Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
karudu
/
C-editor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c01398b1
authored
Mar 23, 2022
by
castro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete search_koodid.c
parent
7d8b28dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
63 deletions
search_koodid.c
search_koodid.c
deleted
100644 → 0
View file @
7d8b28dc
//struckt Otsi_akna jaoks
typedef
struct
_App
{
GtkWidget
*
text_view
;
GtkWidget
*
search_entry
;
}
App
;
//
****
//
// funktsioon selleks kui search nuppu vajutatakse
void
Otsi_nupp_vajutatud
(
GtkWidget
*
Otsi_nupp
,
App
*
app
)
{
const
gchar
*
text
;
GtkTextBuffer
*
buffer
;
GtkTextIter
iter
;
GtkTextIter
mstart
,
mend
;
gboolean
found
;
text
=
gtk_entry_get_text
(
GTK_ENTRY
(
app
->
search_entry
));
/* Get the buffer associated with the text view widget. */
buffer
=
gtk_text_view_get_buffer
(
GTK_TEXT_VIEW
(
app
->
text_view
));
/* Search from the start from buffer for text. */
gtk_text_buffer_get_start_iter
(
buffer
,
&
iter
);
found
=
gtk_text_iter_forward_search
(
&
iter
,
text
,
0
,
&
mstart
,
&
mend
,
NULL
);
if
(
found
)
{
/* If found, hilight the text. */
gtk_text_buffer_select_range
(
buffer
,
&
mstart
,
&
mend
);
}
}
//
****
//
// Search
GtkWidget
*
Otsi_nupp
=
gtk_button_new_with_label
(
"Otsi"
);
// Otsi nupp
GtkWidget
*
Otsi_aken
=
gtk_scrolled_window_new
(
NULL
,
NULL
);
// Otsi aken
gtk_scrolled_window_set_policy
(
GTK_SCROLLED_WINDOW
(
Otsi_aken
),
GTK_POLICY_AUTOMATIC
,
GTK_POLICY_AUTOMATIC
);
App
app
;
gtk_box_pack_start
(
GTK_BOX
(
Box
),
Otsi_nupp
,
FALSE
,
FALSE
,
0
);
app
.
search_entry
=
gtk_entry_new
();
gtk_box_pack_start
(
GTK_BOX
(
Box
),
app
.
search_entry
,
TRUE
,
TRUE
,
0
);
g_signal_connect
(
G_OBJECT
(
Otsi_nupp
),
"clicked"
,
G_CALLBACK
(
Otsi_nupp_vajutatud
),
&
app
);
//
****
//
// paneb Otsi_aken boxi
gtk_box_pack_start
(
GTK_BOX
(
Box
),
Otsi_aken
,
TRUE
,
TRUE
,
0
);
app
.
text_view
=
gtk_text_view_new
();
gtk_container_add
(
GTK_CONTAINER
(
Otsi_aken
),
app
.
text_view
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment